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.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.