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.