Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 56341
Status: rejected
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: loucka [...] uikt.mendelu.cz
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
Download (untitled) / with headers
text/plain 1.5k
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
Download (untitled) / with headers
text/plain 953b
What you are seeing is normal behaviour for DBD::Oracle the queries 'select 1', 'select ab' will not 'prepare' because they are invalid SQL and cannot be parsed 'select ab from dual', Is valid SQL and will fail on execute as it cannot resolve 'ad' Show quoted text
> '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';
All of the above are DML type queries which return no records so they are 'prepared' differently than 'Select' type queries. The Prepare for DML queries sets them up for binding operations only while a 'select' query will be set up for binding and return operations. Two separate execution paths. Hope this clears things up.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.