Re: DBI + DBD::ODBC + unixODBC + FreeTDS + SQL Server error



I found out some more information but I still need some advice. The
problem I am getting is occuring because occasionally "finish" is not
called on a statement handle before another SQL statement is called on
the same database handler. Here is a typical situtation of my problem:

my $stmt = $dbh->prepare( $sql );
$stmt->execute();
while( my $row = $stmt->fetchrow_hashref() ) {
....call some functions...
}

Now in the center of this loop I call various functions based on the
data retrieved on some of these function can possibly also make SQL
requests on the same database handler (although they create their own
statement handlers). When they make their calls I get my error
messages. So what I have to do is have two loops. One is where I loop
through the rows and retrieve the data. The other is where I loop
through the array of data that was retrieved and carry out the actions
necessary. But this is obviously a pain and there seems that there must
be some better way to do this. I am guessing that I simply have some
funky option or paremeter wrong which is causing me to only be able to
execute one SQL query at a time per database handle. What is the best
way around this?

Eric

.



Relevant Pages

  • Re: Newbie: VB-ADO help
    ... I Do have some SQL knowledge and because the calculations are a bit ... the first loop ... are too numerous for memory storage. ... I do not want to deal with SQL and the like. ...
    (microsoft.public.vb.general.discussion)
  • Re: Straight SQL always put perform PL/SQL?
    ... If you cannot do it in a single SQL Statement, ... end loop; ... analyze table test1 compute statistics; ...
    (comp.databases.oracle.server)
  • Re: Hourglass wont display while code executes
    ... It doesn't wait for the subform to retrieve the records. ... to assigning SQL to the RecordSource, then create a loop that will run until ... Dim dteLoop As Date, intWait As Integer ... criteria generated by passing other values in controls through specialized ...
    (microsoft.public.access.forms)
  • Invalid cursor state on second $sth->execute
    ... I have written that a script that opens a cursor on a table in a DB2 database then processes each record in the result set inside a loop. ... In the course of the loop I prepare and execute another SQL statement to get a maximum value from the same table for a given condition. ... I then decided that to speed up the script I would prepare this lookup SQL outside the loop using placeholders, so I can just re-execute the same SQL with the different values plugged in each time. ...
    (perl.beginners)
  • Re: DTS Transform Loop
    ... the data from the RS to the array, then manipulate the array (display data, ... because it keeps the trips to the SQL Server down. ... > Loop over the files and insert 1 at a time. ... >> Then this goes into the Active-X loop and the ExcelLink is loaded into ...
    (microsoft.public.sqlserver.dts)