Unix Technical Forum

Strange behavior of DBD/DBI Informix

This is a discussion on Strange behavior of DBD/DBI Informix within the Informix forums, part of the Database Server Software category; --> I am not sure if this list is the best one to post to regarding this problem. If not ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 07:04 PM
iiug-list@tern.ru
 
Posts: n/a
Default 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"

All of
$@
$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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 07:05 PM
Jonathan Leffler
 
Posts: n/a
Default Re: Strange behavior of DBI/DBD::Informix

iiug-list@tern.ru wrote:
> 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.


The alternative is dbi-users@perl.org - both work, both are OK.

> 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).


I could live with 5 not causing problems - not happy, but I could live
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")?


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

> Your comments are very welcome.
>
>
> Alexandre Krasnov.
> (TERN Group - Russia)
> sending to informix-list


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

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

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

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



--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:04 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com