Ok, first on SQL::Statement "the basic design ... allows joins". Yeah, right. The design allows it and if you want to implement it, all you have to do is implement it. :-) It's on my to-do list but it is not an easy task.

Now for the example of accomplishing joins with multiple statement handles (this uses DBD::AnyData which is newer than DBD::RAM but except for the slightly different "catalog" syntax, it's the same with DBD::RAM:

my $dbh=DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'Class', 'Pipe', 'class.tbl', 'ad_catalog');
$dbh->func( 'Reg', 'Pipe', 'reg.tbl', 'ad_catalog');
my $class_sth = $dbh->prepare( qq{SELECT cid,cname FROM Class} );
my $reg_sth = $dbh->prepare( qq{SELECT sid FROM Reg WHERE cid = ?} );
$class_sth->execute;
while (my($cid,$cname) = $class_sth->fetchrow_array) {

$reg_sth->execute($cid);
my $sid = $reg_sth->fetchrow_arrayref->[0];
print "$cid : $cname : $sid\n";
}

That will produce the same list that this statement would:

SELECT Class.cid, Class.cname, Reg.sid
FROM Class, Reg
WHERE Class.cid = Reg.cid


In reply to Re: Re: Re: Re: DBD::CSV and SQL::Statement by jZed
in thread DBD::CSV and SQL::Statement by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.