O wise brothers,
I have came across a couple of problems using Ado with Perl under Win32 connecting to a Ms SqlServer 7.0 database.
I have no problems when executing a single Sql query but in a case I have to compute variables in the same query being sento to the database engine, like
declare @VAR int;
set @VAR = (select max(id) from table);
select * from table2 where id = @VAR
If I do this, the resulting recordset object shows strange behaviours, like
- it does not test positive as empty (i.e. when both $rs->Bof and $rs->Eof true) so that my code tries to loop on it; nevertheless, the loop is infinite because $rs->Eof is never true even if $rs->MoveNext reports no errors and gets executed some thousand times before the Ctrl-C
- I read somewhere that it is possible to access the different outcomes from each Sql statement separately but I do not know how to do it (in fact I'd like to access only the result from the third statement, as the first two are not supposed to return anything, and I wonder if that's the problem with the point above)
- I casually noticed that loading the Data::Dumper module seems to break the ability for the Ado connection to open a recordset (it just freezes)
Of course the query I'm using is by far more complex than the one I'm reporting here so replacing variables with subqueries is not a viable option.
Anybody got an idea on how to overcome this result? I cannot use DBI because it would mean a major rewrite of existing code. Thank you.
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.