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: "Avis, Ed" <avised at kbcfp dot com>
Subject: RE: No error raised for bad SQL in prepare() or fetchall_arrayref()
Date: May 6 2004 4:34PM

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

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

At the moment it looks like preparing the query doesn't happen on
prepare() but is deferred until the first call of execute(), is that
correct?  I expect this is to reduce round trips to the DB.

If the first bit of error checking (not letting you fetch from an
unexecuted statement) were implemented then there would be less need
for immediate error checking on prepare().

-- 
Ed Avis