Subject: | prepare problem |
Date: | Wed, 7 Apr 2010 07:32:22 +0200 |
To: | bug-DBD-Oracle [...] rt.cpan.org |
From: | Zdenek Loucka <loucka [...] uikt.mendelu.cz> |
Hello,
I have never reported any bug so I hope I do it well. And at the first time
I am sorry for my English.
Perl version: 5.8.8 built for x86_64-linux-thread-multi
System: Linux 2.6.18-128.el5 #1 SMP x86_64
DBD::Oracle version: 1.22
Oracle version: 10.1.0.4.0
In some cases prepare method returns statement handler even if statement is
incorect. I thought that it should return undef. Try to run next example:
##########################################################################
#! /usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('dbi:Oracle:xxx','xxx','xxx',{RaiseError => 0,PrintError => 0}) or die "Can't connect to DB.";
my @queries;
push @queries,'select 1',
'select ab',
'select 1 from dual',
'select ab from dual',
'insert into a_kolyk_temp values (sysdate)',
'update a_kolyk_temp set a=sysdate-1',
'delete from a_kolyk_temp',
'selecta 1 from dual',
'inserta into a_kolyk_temp values (sysdate)',
'updatea a_kolyk_temp set a=sysdate-1',
'deletea from a_kolyk_temp';
foreach (@queries) {
my $sth = $dbh->prepare($_);
print "$_\n\tprepare ";
if ($sth) {
print "OK\n\texecute ";
if ($sth->execute) {
print "OK\n";
} else {
print "ERR\n";
}
} else {
print "ERR\n";
}
}
##########################################################################
Sorry for your time if this issue has been resolved or if mistake is on my side.
Thanks.
Zdenek Loucka