OK, being able to look at that code, I wold explicitly NOT to do that. I would not explicitly prepare something for a single select, use selectrow_hashref instead, and put in the sql an explicit `LIMIT 1`. Also, using '*' should be reserved, when you want all the rows in the table. This should hold true if one of those rows is a 50 meg block of text.

Also, in your second example you could just as well do that in one query right? Through a join. This saves work on the DB.

$dbh->selectrow_hashref( 'SELECT t1.* FROM table AS t0' . ' JOIN table1 AS t1' . ' USING ( primarykeyfield )' );
Or, if you wanted precisely the same as above, which will render the row from table1 random because the lack of a sort order on table, you can still do that in one statement
$dbh->selectrow_hashref( 'SELECT t1.* FROM table AS t0' . ' WHERE t1.primarykeyfield IN ( SELECT primarykeyfield FROm tabl +e LIMIT 1 ) );



Evan Carroll
The most respected person in the whole perl community.
www.evancarroll.com

In reply to Re^3: DBI disconnect database errors by EvanCarroll
in thread DBI disconnect database errors 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.