Hello

Okay,  I have done this and gotten interesting results.
I littered the test scripts with print's so I could profile it.

First output with print "$_->Description, "\n" for Win32::OLE::in( $err );"
commented out.
Note: a memory spike ( 300 meg ) happened in the Execute call (300 Meg )
and was released right afterward.

Ourput 1,  First output with print "$_->Description, "\n" for
Win32::OLE::in( $err );"  commented out.
1 Thu Jan 22 14:21:51 2004
2 Thu Jan 22 14:21:51 2004
3 Thu Jan 22 14:21:51 2004
4 Thu Jan 22 14:22:44 2004
5 Thu Jan 22 14:22:44 2004
Error cnt: 32767
6 Thu Jan 22 14:22:44 2004
7 Thu Jan 22 14:22:44 2004
Too many errors!
9 Thu Jan 22 14:23:27 2004
A Thu Jan 22 14:23:27 2004
B Thu Jan 22 14:23:27 2004
C Thu Jan 22 14:23:27 2004

Output 2,  $_->Description not commented out

1 Thu Jan 22 14:33:03 2004
2 Thu Jan 22 14:33:03 2004
3 Thu Jan 22 14:33:04 2004
4 Thu Jan 22 14:33:58 2004
5 Thu Jan 22 14:33:58 2004
Error cnt: 32767
[Reuters][Open Access][Reuters DB]I41255: No rows returned because there
are no rows in the results set

***** 32767 Blank lines *******

6 Thu Jan 22 14:36:58 2004
7 Thu Jan 22 14:36:58 2004
Too many errors!
9 Thu Jan 22 14:37:42 2004
A Thu Jan 22 14:37:42 2004
B Thu Jan 22 14:37:42 2004
C Thu Jan 22 14:37:42 2004

Perl Script:
use Win32::OLE();

print STDERR '1 ' . localtime() . "\n";
my $cxn = Win32::OLE->new('ADODB.Connection');

print STDERR '2 ' . localtime() . "\n";
$cxn->Open('PowerPlus Pro');  # Your DSN string (w/o 'dbi:ADO:')

print STDERR '3 ' . localtime() . "\n";
my $rs = $cxn->Execute("SELECT TI_ID FROM DEBT_BY_PSEUDO_ID WHERE
PSEUDO_ID ='0001037'");  # Your SQL

print STDERR '4 ' . localtime() . "\n";
my $err = $cxn->Errors;
print STDERR '5 ' . localtime() . "\n";
print STDERR "Error cnt: $err->{Count}\n";
##  print STDERR $_->Description, "\n" for Win32::OLE::in( $err );

print STDERR '6 ' . localtime() . "\n";
if( $err->{Count} > 2 ) {
   print STDERR '7 ' . localtime() . "\n";
   $err->Clear;
   print STDERR "Too many errors!\n";
} else {
   print STDERR '8 ' . localtime() . "\n";
   print STDERR $_->Description, "\n" for Win32::OLE::in( $err );
}
print STDERR '9 ' . localtime() . "\n";
while ( !$rs->{EOF} ) {
    print STDERR $_->Value, ":" for Win32::OLE::in( $rs->Fields );
    print STDERR "\n";
    $rs->MoveNext;
}
print STDERR 'A ' . localtime() . "\n";
$rs->Close;
print STDERR 'B ' . localtime() . "\n";
$cxn->Close;
print STDERR 'C ' . localtime() . "\n";

Thanks,
   Peter


>
> Better use my test script
>
>   <http://www.xray.mpe.mpg.de/mailing-lists/dbi/2004-01/msg00322.html>
>
> first and replace
>
>   print $_->Description, "\n" for Win32::OLE::in( $err );
>
> with my code snippet. This will not loop at all (for > $MAX_ERRORS).
> To leave the loop after $MAX_ERRORS steps would be better. But in
> this case I cannot use Win32::OLE::in, something like
>
>   while ( my $err = $Errors->Next ) {
>     last if ...
>
> instead. I have to test this ...
>
>
> Steffen
>

Reply via email to