I have to say that even though this is a FAQ, it is a good question, because DBI is unreliable on this one. I have had DBI return rows one time and then return -1 on the exact same query if it was run without disconnecting and reconnecting. I wish I knew enough about the module to help fix this, but apparently it has been like this for a long time. People have reported the issue, it just isn't going to get fixed I suppose :-(
# I am on Win32- Perl 5.8 - DBI -1.37 DBD::ODBC -1.06
Here is another one to watch out for
my $sql = qq(
use customers
select * from customers
);
If you embed a "USE" inside a complex query and then prepare and execute it via ODBC... you will get zip back and usually an accompanied "Invalid Cursor" message from ODBC. The work-around is to NOT insert a USE statement or to extract the "USE STATMENT" and prepare and execute it SEPERATELY from the rest of the SQL... uggh! You can do this on other platfroms as written, just not via DBI. :-(
Cheers,
JamesNC
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.