On Mon, 18 Nov 2002 12:44:44 -0500 (EST), Paul Boutros wrote:
>Now, that sub function, process($$$) checks the input parameters and
>chooses the correct statement-handle based on that. For instance:
>
>if ($_[0] == 532) {
> if ($_[1] eq 'A') {
> $sth = $sth_crosstab_all;
> }
> else {
> $sth = $sth_crosstab;
> }
> }
>
>The sub then goes ahead and does gets the data from $sth.
Just an aside: you could use a hash containing the statement handles.
For example:
$sth{532}{A} = $sth_crosstab_all;
Since you seem to want a fallback, you could do:
$sth{532}{'*'} = $sth_crosstab;
Thus:
my $sth = $sth{0+$_[0]}{$_[1]} || $sth{0+$_[0]}{'*'};
>I should mention here that the queries being run are all crosstab queries
>(MS-Access queries that aggregate data by two variables, much like a pivot
>table in Excel).
>
>The strange part is this:
>- all queries work individually
>- if I set the program running, it works for one full loop and then dies
>midway through the second loop
>The error message is:
>DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver]
>Operation is not supported for this type of object. (SQL-S1000)(DBD:
>st_execute/SQLExecute err=-1) at get_all_mm_data.pl line 204.
>And to further add to my confusion, lines 204-206 are:
>if ($_[1] eq 'T') {
> $sth->execute($_[2], 0);
> }
Could it be that Access doesn't like two such queries running at the
same time? Thus, perhaps you should do
$sth->finish;
at the end of your loop.
--
Bart.