PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: No error raised for bad SQL in prepare() or fetchall_arrayref()
Date: May 6 2004 4:49PM

On Thu, 2004-05-06 at 18:34, Avis, Ed wrote:
> >>     my $sth = $dbh->prepare('malformed junk');
> >>     $sth->fetchall_arrayref();
> >
> >Err - no $sth->execute().
> >
> >Typo?
> 
> Mistake.
> 
> However, I still think the error handling could be improved:
> 
> - Should give error when you try to fetch from a statement handle that
>   has not been execute()d.

Agreed - I'll look into that.

> - Arguably, prepare() should be the call that goes to the database and
>   compiles the query.  Then it can check the query is syntactically
>   valid and matches the schema.

Actually the actual execution is deferred so that you can call execute()
multiple times on the same static SQL and get the behavior that DBI
expects. A prepare() with placeholders will flag the error earlier.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html