Strange behavior of DBI/DBD::Informix

Strange behavior of DBI/DBD::Informix

Post by iiug-l.. » Tue, 08 Jul 2003 19:33:26



Thank you for the reply.

Sorry,  I  wrote  late in the evening and forgot to post my
configuration:
Perl 5.6.1
AIX  4.2.1  (I  know  it's  old but this should not be relevant to the
problem)
DBI 1.32
DBD-Informix-1.04.PC1
IDS 7.30.UC8
ESQL/C 9.30.UC1
SDK 2.40.UC1

All software is located on the same server.

I  could not test this with the newer version or on the other platform
right now...

Recently I sent just a scenario.
Here  is  the  working  example  (change  appropriately  environment,
database name and column name):

~~~~~~~  cut here  ~~~~~~~~~~~
#!/usr/local/bin/perl -w

$ENV{INFORMIXDIR}='/home/informix';
$ENV{INFORMIXSERVER}='informixservername';
$ENV{ONCONFIG}='onconfig';

$database="test";

use locale;
use DBI qw(:sql_types);
use DBD::Informix qw(:ix_types);

$dbh = DBI->connect("dbi:Informix:$database", '', '',
                        { PrintError => 1, RaiseError => 1});

$sql = qq{ INSERT INTO testcol VALUES ( ? ) };
$sth = $dbh->prepare( $sql )  or die "Failed to prepare '$sql'\n";

$dbh->disconnect;

$sth->bind_param( 1, 'q' );
$ret = $sth->execute;


    warn "Database error: $DBI::errstr\n";

Quote:}

if ( $ret!=1 )
{ print "ret=$ret\n";
if ( defined $DBI::errstr ) { print "DBI err: $DBI::errstr\n"; }
 else { print "IFX err: $sth->{ix_sqlcode}:$sth->{ix_sqlerrm}\n"; }
 exit;
Quote:}

~~~~~~~~~~~~~~~~~~~~~~~  cut here  ~~~~~~~~~~~~~~~~~~~~~~~

Quote:>> Consider the following scenario:
>> 1)$dbh = DBI->connect("dbi:Informix:$database", '', '',
>>                         { PrintError => 1, RaiseError => 1});
>> 2)$sql = qq{ INSERT INTO sometable VALUES ( somevalues ) };
>> 3)$sth = $dbh->prepare( $sql )  or die "Failed to prepare '$sql'\n";
>> 4)$dbh->disconnect;
>> 5)N statements of the form
>> $sth->bind_param( K, somevalue );
>> (K=1..N)
>> 6)$ret = $sth->execute;

>> After doing 4) I still can execute 5) and 6) without any obvious error
>> message. Of course no insert occurs but it is not clear why (supposing
>> we do not know about 4).

JL> I could live with 5 not causing problems - not happy, but I could live
JL> with it.  Step 6 should unequivocally fail.

>> Even more, while testing the return code $ret We still can not
>> understand what is the problem. $ret is equal to '0E0' that can mean
>> 1) "statement does not affect any rows"
>> 2) "cursor is opened successfully"

>> All of

>> $DBI::errstr
>> sqlcode
>> sqlerrm
>> show nothing in this situation.

>> Should I check something else?
>> Is it bug ("feature")?

JL> At first glance, it is a bug - in DBD::Informix.

Quote:>> Your comments are very welcome.

>> Alexandre Krasnov.
>> (TERN Group - Russia)
>> sending to informix-list

JL> Please - always - send the version information of:
JL>         Platform (o/s in particular, sometimes h/w)
JL>         Perl
JL>         DBI
JL>         DBD::Informix
JL>         ESQL/C or CSDK
JL>         Database server
JL> Or use the bug reporting mechanisms provided with DBD::Informix.

JL> And please send a simple, self-contained reproduction of the problem.

JL> using DBD::Informix::TestHarness;
my $dbh = DBI->>connect({RaiseError => 1, Printerror => 1});
$dbh->>do(q{CREATE TEMP TABLE SomeTable(col01 integer not null)});
JL> my $sql = "INSERT INTO SomeTable VALUES(?)";
my $sth = $dbh->>prepare($sql);
$dbh->>disconnect;
$sth->>bind_param(1, 1);
$sth->>execute;

JL> This should produce an error, definitely on the execute, and very
JL> arguably on the bind_param.  I thought there was a test to validate
JL> this stuff - but either that test is broken or it is AWOL.

Best regards,
Alexandre Krasnov.

sending to informix-list

 
 
 

1. Strange behavior of DBD/DBI Informix

I  am  not sure if this list is the best one to post to regarding this
problem. If not please point me to the better one.

Consider the following scenario:
1)$dbh = DBI->connect("dbi:Informix:$database", '', '',
                        { PrintError => 1, RaiseError => 1});
2)$sql = qq{ INSERT INTO sometable VALUES ( somevalues ) };
3)$sth = $dbh->prepare( $sql )  or die "Failed to prepare '$sql'\n";
4)$dbh->disconnect;
5)N statements of the form
$sth->bind_param( K, somevalue );
(K=1..N)
6)$ret = $sth->execute;

After doing 4) I still can execute 5) and 6) without any obvious error
message. Of course no insert occurs but it is not clear why (supposing
we do not know about 4).
Even more, while testing the return code $ret We still can not
understand what is the problem. $ret is equal to '0E0' that can mean
1) "statement does not affect any rows"
2) "cursor is opened successfully"


$DBI::errstr
sqlcode
sqlerrm
show nothing in this situation.

Should I check something else?
Is it bug ("feature")?

Your comments are very welcome.

Alexandre Krasnov.
(TERN Group - Russia)
sending to informix-list

2. median

3. Indexes via DBI driver in Perl (DBD::Informix)

4. In search of a Full Text DataBase Toolkit

5. DBI and DBD::Informix installation problems

6. small project from newbie

7. DBI / DBD Informix -- Spaces in data

8. Phenominal opportunity! For senior developer

9. DBI/DBD for INFORMIX-SE 7.24.UC5 for Linux Redhat

10. DBD-Informix and DBI

11. DBI/DBD-informix, value of a new serial after insert

12. Informix & DBD::DBI

13. Perl DBI-0.93 DBD-Informix-0.58 on SCO