I don't see any metion of it in the docs. but I recall that DBD::mysql
only makes statement handle attributes like NAME available while
the statement handle is still Active.
fetchall_arrayref() will fetch all the data and so leave the statement
handle in-Active.
Just get the NAME array ref before calling fetchall_arrayref().
Tim.
On Wed, Aug 04, 2004 at 09:29:37PM -0700, [EMAIL PROTECTED] wrote:
>
> SENARIO:
>
> I have downloaded a CSV file for the past 8 months with about 50k lines of
> data. The data does change a little each day, just some fields. I have
> uploaded all the files to a MySQL database. I have been able to compare one
> row of data at a time. Easy!. But I want to compare a whole bunch like 1k
> lines. When I use fetchall_arrayref I cannot get the name of the field that
> contains the data. The DBI gives me the error message that it is used for
> the subject of this email. Any suggestions I will enclosed of the code that
> I use and my system software and libraries.
>
> Thanks
>
>
> -Max
>
>
> CODE:
>
>
> $q2 = $dbh->prepare("SELECT * FROM $table WHERE LicNumber
> BETWEEN \"$gL1\" AND \"$gL2\"");
> $q2->execute or die "ERROR: $q2->errstr \n";
> $rowRef2 = $q2->fetchall_arrayref;
> # print "ROW2: $rowRef2->[0]->[0]\n";
>
> $q3 = $dbh->prepare("SELECT @columns from $table2 WHERE
> LicNumber BETWEEN \"$gL1\" AND \"$gL2\"");
> $q3->execute or die "ERROR: $q3->errstr \n";
> $rowRef3 = $q3->fetchall_arrayref;
>
> ########## some more looping ############
>
> for ($i = 1; $i <= $q2->{NUM_OF_FIELDS}; $i++) {
> if ($rowRef2->[$j]->[$i-1] ne $rowRef3->[$j]->[$i-1]) {
> print "$rowRef2->[$j]->[$i-1] \t <->
> $rowRef3->[$j]->[$i-1]\n";
> push(@fields,"$q3->{NAME}->[$i-1],");
> push(@records,"\"$rowRef2->[$j]->[$i-1]\",");
>
> push(@NewRecords,"$q3->{NAME}->[$i-1]=\"$rowRef2->[$j]->[$i-1]\",");
> }
>
> }
> }
>
>
> SYSTEM:
>
> SDL_perl-1.20.0-350
> apache2-mod_perl-1.99_12_20040302-33
> perl-5.8.3-32
> perl-Archive-Zip-1.09-27
> perl-Compress-Zlib-1.33-30
> perl-Config-Crontab-1.03-46
> perl-DBD-mysql-2.9003-22
> perl-DBI-1.41-28
> perl-Data-ShowTable-3.3-569
> perl-Digest-SHA1-2.07-30
> perl-HTML-Mason-1.05-251
> perl-HTML-Parser-3.35-31
> perl-HTML-Tagset-3.03-550
> perl-HTML-Template-2.6-135
> perl-MLDBM-2.01-236
> perl-PDA-Pilot-0.11.8-120
> perl-Params-Validate-0.14-276
> perl-Template-Toolkit-2.13-25
> perl-TermReadKey-2.21-292
> perl-Tie-IxHash-1.21-584
> perl-URI-1.30-29
> perl-XML-Parser-2.34-28
> perl-gettext-1.01-576
> perl-libwww-perl-5.76-30
> yast2-perl-bindings-2.9.25-8
>
> thinkpad:/mnt/net1/data/RE/individuals # rpm -qa | sort | grep mysql
> apache2-mod_auth_mysql-20030510-204
> mysql-shared-4.0.18-32
> perl-DBD-mysql-2.9003-22