execute() failing with: Not an error!

2008-04-02 Thread Mark Lawrence
After hours of googling and testing I'm down to you guys as my last
resort. I have an issue that results in execute() failing with the
error:

  not an error(21) at dbdimp.c line 376

The test script below brings out the problem, everywhere except my
development environment. I get the same problem if I
use prepare() instead of prepare_cached().

Would really appreciate it if someone can duplicate this, especially
against a target other than DBD::SQLite (that's all I'm able to try at
the moment). Any ideas before I start submitting bugs to RT?

Cheers,
Mark.


1. Debian GNU/Linux (i686), DBI v1.53, Perl v5.8.8, DBD::SQLite v1.14
=

1..3
ok 1 - insert id 1
DBD::SQLite::st execute failed: PRIMARY KEY must be unique(19) at dbdimp.c line 
403 at x.pl line 32.
ok 2 - insert duplicate id 1
ok 3 - insert id 2
closing dbh with active statement handles at x.pl line 46.


2. Windows XP, DBI v1.601, Perl v5.10.0 (Strawberry), DBD::SQLite v1.14
===
1..3
ok 1 - insert id 1
DBD::SQLite::st execute failed: PRIMARY KEY must be unique(19) at dbdimp.c line 
403 at x.pl line 32.
ok 2 - insert duplicate id 1
DBD::SQLite::st execute failed: not an error(21) at dbdimp.c line 376 at x.pl 
line 40.
not ok 3 - insert id 2
#   Failed test 'insert id 2'
#   at x.pl line 41.
# Looks like you failed 1 test of 3.


3. The Test Case


#!/usr/bin/perl
BEGIN {$ENV{DBI_TRACE} = 0;}
use strict;
use warnings;
use Test::More tests = 3;
use DBI;

my $dbh;
my $sth;
my $res;

unlink('test.db');
$dbh = DBI-connect('dbi:SQLite:test.db');
$dbh-{RaiseError} = 0;

$dbh-do('
CREATE TABLE artists (
id INTEGER,
name VARCHAR(32),
PRIMARY KEY(id)
)
');


$sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
$res = $sth-execute(1,'one');
ok($res, 'insert id 1');
$sth-finish;

$dbh-begin_work;
$sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
$res = $sth-execute(1,'one');
ok(!$res, 'insert duplicate id 1');
$dbh-commit if($res);
$dbh-rollback if(!$res);
$sth-finish;

$dbh-begin_work;
$sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
$res = $sth-execute(2, 'two'); # = This fails: not an error
ok($res, 'insert id 2');
$dbh-commit if($res);
$dbh-rollback if(!$res);
$sth-finish;

$dbh-disconnect;
exit;


-- 
Mark Lawrence


Re: execute() failing with: Not an error!

2008-04-02 Thread Mark Lawrence
On Wed Apr 02, 2008 at 11:55:53AM +0200, Mark Lawrence wrote:

 $dbh-begin_work;
 $sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
 $res = $sth-execute(1,'one');
 ok(!$res, 'insert duplicate id 1');
 $dbh-commit if($res);
 $dbh-rollback if(!$res);
 $sth-finish;

Yes, I also know that the transaction stuff is not necessary here, but I
was using transactions in my code and just duplicated here. The failure
also occurs with autocommit...

Mark.
-- 
Mark Lawrence


Re: execute() failing with: Not an error!

2008-04-02 Thread Tim Bunce
On Wed, Apr 02, 2008 at 11:55:53AM +0200, Mark Lawrence wrote:
 After hours of googling and testing I'm down to you guys as my last
 resort. I have an issue that results in execute() failing with the
 error:
 
   not an error(21) at dbdimp.c line 376

 The test script below brings out the problem, everywhere except my
 development environment. I get the same problem if I
 use prepare() instead of prepare_cached().
 
 Would really appreciate it if someone can duplicate this, especially
 against a target other than DBD::SQLite (that's all I'm able to try at
 the moment). Any ideas before I start submitting bugs to RT?

I believe it's an error from DBD::SQLite

Google http://www.google.com/search?q=sqlite+error+%2B21 suggests
http://www.sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

Tim.

 Cheers,
 Mark.
 
 
 1. Debian GNU/Linux (i686), DBI v1.53, Perl v5.8.8, DBD::SQLite v1.14
 =
 
 1..3
 ok 1 - insert id 1
 DBD::SQLite::st execute failed: PRIMARY KEY must be unique(19) at dbdimp.c 
 line 403 at x.pl line 32.
 ok 2 - insert duplicate id 1
 ok 3 - insert id 2
 closing dbh with active statement handles at x.pl line 46.
 
 
 2. Windows XP, DBI v1.601, Perl v5.10.0 (Strawberry), DBD::SQLite v1.14
 ===
 1..3
 ok 1 - insert id 1
 DBD::SQLite::st execute failed: PRIMARY KEY must be unique(19) at dbdimp.c 
 line 403 at x.pl line 32.
 ok 2 - insert duplicate id 1
 DBD::SQLite::st execute failed: not an error(21) at dbdimp.c line 376 at x.pl 
 line 40.
 not ok 3 - insert id 2
 #   Failed test 'insert id 2'
 #   at x.pl line 41.
 # Looks like you failed 1 test of 3.
 
 
 3. The Test Case
 
 
 #!/usr/bin/perl
 BEGIN {$ENV{DBI_TRACE} = 0;}
 use strict;
 use warnings;
 use Test::More tests = 3;
 use DBI;
 
 my $dbh;
 my $sth;
 my $res;
 
 unlink('test.db');
 $dbh = DBI-connect('dbi:SQLite:test.db');
 $dbh-{RaiseError} = 0;
 
 $dbh-do('
 CREATE TABLE artists (
 id INTEGER,
 name VARCHAR(32),
 PRIMARY KEY(id)
 )
 ');
 
 
 $sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
 $res = $sth-execute(1,'one');
 ok($res, 'insert id 1');
 $sth-finish;
 
 $dbh-begin_work;
 $sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
 $res = $sth-execute(1,'one');
 ok(!$res, 'insert duplicate id 1');
 $dbh-commit if($res);
 $dbh-rollback if(!$res);
 $sth-finish;
 
 $dbh-begin_work;
 $sth = $dbh-prepare_cached('INSERT INTO artists(id,name) VALUES(?,?)');
 $res = $sth-execute(2, 'two'); # = This fails: not an error
 ok($res, 'insert id 2');
 $dbh-commit if($res);
 $dbh-rollback if(!$res);
 $sth-finish;
 
 $dbh-disconnect;
 exit;
 
 
 -- 
 Mark Lawrence


Re: execute() failing with: Not an error!

2008-04-02 Thread Mark Lawrence
On Wed Apr 02, 2008 at 04:53:36PM +0100, Tim Bunce wrote:
 On Wed, Apr 02, 2008 at 11:55:53AM +0200, Mark Lawrence wrote:
  After hours of googling and testing I'm down to you guys as my last
  resort. I have an issue that results in execute() failing with the
  error:
  
not an error(21) at dbdimp.c line 376
 
  The test script below brings out the problem, everywhere except my
  development environment. I get the same problem if I
  use prepare() instead of prepare_cached().
  
  Would really appreciate it if someone can duplicate this, especially
  against a target other than DBD::SQLite (that's all I'm able to try at
  the moment). Any ideas before I start submitting bugs to RT?
 
 I believe it's an error from DBD::SQLite
 
 Google http://www.google.com/search?q=sqlite+error+%2B21 suggests
 http://www.sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

And/or maybe http://rt.cpan.org/Ticket/Display.html?id=9792 and
http://rt.cpan.org/Ticket/Display.html?id=30558.

With the one-line patch to DBD::SQLite that's in ticket 30558 things
work again for me. I guess Debian had patched this long ago so I didn't
see the failure until the CPAN testers started sending in reports. What
an extremely useful service to module authors...

Although until Matt releases a new version I'm kinda stuck. Can't go
round patching everybodys machines.

Mark.
-- 
Mark Lawrence


FW: error during DBI installation.

2008-04-02 Thread Sasidharan, Radhakrishnan
Hi,
 
We are trying to run the DBD installation on a unix server. We are able to do 
the Makefile.PL but it failed on the subsequent make. Attached is the output of 
the two commands. Kindly help us to resolve this issue.
 
Thanks  Regards
 
Radhakrishnan
 
 
sudo /opt/ActivePerl-5.8/bin/perl Makefile.PL
Using DBI 1.48 (for perl 5.008007 on sun4-solaris-thread-multi) installed in 
/opt/ActivePerl-5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/auto/DBI/

 Configuring DBD::Oracle ...

 Remember to actually *READ* the README file!
Especially if you have any problems.

Using Oracle in /export/home/oracle/product/9Iclient
DEFINE _SQLPLUS_RELEASE = 902000100 (CHAR)
Oracle version 9.2.0.1 (9.2)
Found /export/home/oracle/product/9Iclient/precomp/demo/proc/demo_proc.mk
Using /export/home/oracle/product/9Iclient/precomp/demo/proc/demo_proc.mk
Reading /export/home/oracle/product/9Iclient/precomp/demo/proc/demo_proc.mk
Reading /export/home/oracle/product/9Iclient/precomp/lib/env_precomp.mk

Attempting to discover Oracle OCI build rules
gcc -c  -I. -I/export/home/oracle/product/9Iclient/precomp/public 
-I/export/home/oracle/product/9Iclient/rdbms/public 
-I/export/home/oracle/product/9Iclient/rdbms/demo 
-I/export/home/oracle/product/9Iclient/plsql/public 
-I/export/home/oracle/product/9Iclient/network/public 
-I/export/home/oracle/product/9Iclient/rdbms/demo 
-I/export/home/oracle/product/9Iclient/rdbms/demo 
-I/opt/ActivePerl-5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/auto/DBI/  
-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DUSE_SITECUSTOMIZE -DNO_HASH_SEED 
-DBUILT_BY_ACTIVESTATE -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -O-DVERSION=\1.16\  -DXS_VERSION=\1.16\ -fPIC 
-I/opt/ActivePerl-5.8/lib/5.8.7/sun4-solaris-thread-multi/CORE  -Wall 
-Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT -DORA_OCI_VERSION=\9.2.0.1\ 
DBD_ORA_OBJ.c
by executing: [make -f 
/export/home/oracle/product/9Iclient/precomp/demo/proc/demo_proc.mk build 
ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= 
EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
Oracle oci build command:
[true -o DBD_ORA_EXE DBD_ORA_OBJ.o 
-L/export/home/oracle/product/9Iclient/lib/ -lclntsh `cat 
/export/home/oracle/product/9Iclient/lib/ldflags`   `cat 
/export/home/oracle/product/9Iclient/lib/sysliblist` 
-R/export/home/oracle/product/9Iclient/lib -laio  -lposix4  -lm  -lthread]

Found header files in rdbms/demo.


*
I can't find the header files I need in your Oracle installation.
You probably need to install some more Oracle components.
I'll keep going, but the compile will probably fail.
See README.clients for more information.
*


Checking for functioning wait.ph


System: perl5.008007 sunos sparky 5.6 generic_105181-35 sun4u sparc 
sunw,ultra-5_10 
Compiler:   gcc -O -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DUSE_SITECUSTOMIZE 
-DNO_HASH_SEED -DBUILT_BY_ACTIVESTATE -fno-strict-aliasing -pipe 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker: /usr/ccs/bin/ld
Sysliblist: -lnsl -lsocket -lgen -ldl -lsched 
Oracle makefiles would have used these definitions but we override them:
  CC:   cc

  CFLAGS:   $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\
$(SHARED_CFLAG) $(USRFLAGS)
   [$(GFLAG) -xO3 $(CDEBUG) $(NOKPIC_CCFLAGS) -K PIC -DPRECOMP -I. 
-I/export/home/oracle/product/9Iclient/precomp/public 
-I/export/home/oracle/product/9Iclient/rdbms/public 
-I/export/home/oracle/product/9Iclient/rdbms/demo 
-I/export/home/oracle/product/9Iclient/plsql/public 
-I/export/home/oracle/product/9Iclient/network/public -DSLMXMX_ENABLE 
-DSLTS_ENABLE -D_SVID_GETTOD -D_REENTRANT $(LPFLAGS) $(USRFLAGS)]

  LDFLAGS:  -o $@ $(LDPATHFLAG)$(PRODLIBHOME) $(LDPATHFLAG)$(LIBHOME)
   [-o $@ -L/export/home/oracle/product/9Iclient/precomp/lib/ 
-L$(LIBHOME)]


Linking with OTHERLDFLAGS =   -L/export/home/oracle/product/9Iclient/lib/ 
-lclntsh `cat /export/home/oracle/product/9Iclient/lib/ldflags`   `cat 
/export/home/oracle/product/9Iclient/lib/sysliblist` 
-R/export/home/oracle/product/9Iclient/lib -laio  -lposix4  -lm  -lthread [from 
'build' rule]


LD_RUN_PATH=/export/home/oracle/product/9Iclient/lib:/export/home/oracle/product/9Iclient/rdbms/lib
Using DBD::Oracle 1.16.
Using DBD::Oracle 1.16.
Using DBI 1.48 (for perl 5.008007 on sun4-solaris-thread-multi) installed in 
/opt/ActivePerl-5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/auto/DBI/
Writing Makefile for DBD::Oracle

***  If you have problems...
 read all the log printed above, and the README and README.help files.
 (Of course, you have read README by now anyway, haven't you?)

[EMAIL PROTECTED]:21make
Skip blib/lib/DBD/Oracle.pm (unchanged)
Skip blib/lib/oraperl.ph (unchanged)
Skip blib/arch/auto/DBD/Oracle/dbdimp.h (unchanged)
Skip blib/arch/auto/DBD/Oracle/ocitrace.h (unchanged)
Skip blib/lib/Oraperl.pm 

Re: error during DBD::Oracle installation (was: error during DBI installation)

2008-04-02 Thread Jonathan Leffler
Looks like time to get the development stuff you need installed.  The log
file says:

Reading /export/home/oracle/product/9Iclient/precomp/lib/env_precomp.mk

Attempting to discover Oracle OCI build rules
gcc -c  -I. -I/export/home/oracle/product/9Iclient/precomp/public
-I/export/home/oracle/product/9Iclient/rdbms/public
-I/export/home/oracle/product/9Iclient/rdbms/demo
-I/export/home/oracle/product/9Iclient/plsql/public
-I/export/home/oracle/product/9Iclient/network/public
-I/export/home/oracle/product/9Iclient/rdbms/demo
-I/export/home/oracle/product/9Iclient/rdbms/demo
-I/opt/ActivePerl-5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/auto/DBI/
 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DUSE_SITECUSTOMIZE
-DNO_HASH_SEED -DBUILT_BY_ACTIVESTATE -fno-strict-aliasing -pipe
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O-DVERSION=\1.16\
-DXS_VERSION=\1.16\ -fPIC
-I/opt/ActivePerl-5.8/lib/5.8.7/sun4-solaris-thread-multi/CORE
-Wall -Wno-comment -DUTF8_SUPPORT -DNEW_OCI_INIT
-DORA_OCI_VERSION=\9.2.0.1\ DBD_ORA_OBJ.c
by executing: [make -f
/export/home/oracle/product/9Iclient/precomp/demo/proc/demo_proc.mk
build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true
OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
Oracle oci build command:
[true -o DBD_ORA_EXE DBD_ORA_OBJ.o
-L/export/home/oracle/product/9Iclient/lib/ -lclntsh `cat
/export/home/oracle/product/9Iclient/lib/ldflags`   `cat
/export/home/oracle/product/9Iclient/lib/sysliblist`
-R/export/home/oracle/product/9Iclient/lib -laio  -lposix4  -lm
-lthread]

Found header files in rdbms/demo.


*
I can't find the header files I need in your Oracle installation.
You probably need to install some more Oracle components.
I'll keep going, but the compile will probably fail.
See README.clients for more information.
*


It also says:

***  If you have problems...
 read all the log printed above, and the README and README.help files.
 (Of course, you have read README by now anyway, haven't you?)


So, which part of that is too hard to understand?  You're running on ancient
Solaris (2.6 - not supported), and you have a fairly old version of Oracle
client -- did you check whether it is supported.

And DBD does not mean DBD::Oracle - there are lots of DBD::DBMS drivers.


On Wed, Apr 2, 2008 at 1:08 PM, Sasidharan, Radhakrishnan 
[EMAIL PROTECTED] wrote:

 We are trying to run the DBD installation on a unix server. We are able to
 do the Makefile.PL but it failed on the subsequent make. Attached is the
 output of the two commands. Kindly help us to resolve this issue.




-- 
Jonathan Leffler [EMAIL PROTECTED] #include disclaimer.h
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
Blessed are we who can laugh at ourselves, for we shall never cease to be
amused.