Menu

#10 PEAR::DB Sqlite3 driver does not work for non-SELECT queries

open
nobody
None
5
2008-04-17
2008-04-17
Anonymous
No

The PEAR::DB sqlite3 driver does not behave properly when using anything apart from a SELECT query (ie, UPDATE/INSERT/DELETE all fail).

I am using autoExecute to build and run a query - and I have tracted the problem to #simpleQuery(). When it is called with this SQL:

UPDATE equipment SET dns_name = 'bell.owl.ys',ip_addr = '10.0.16.67',equipment_type_id = 2 WHERE equipment_id = 2

PEAR comes back with the following error:

DB_Error Object ( [mode] => 1 [level] => 1024 [code] => -1 [message] => DB Error: not an error [userinfo] => [DB Error: unknown error] . . . )

I don't understand why, but #simpleQuery detects whether or not you are running a SELECT query, and only if it finds this will it call sqlite3_query(). Otherwise, sqlite3_exec() is used, which only returns true/false (afaict). I believe it is appropriate to always call sqlite3_query().

Attached is a patch to make it behave that way.

Regards,
Nick Evans
<owlmanatt@gmail.com>

Discussion

  • Nobody/Anonymous

     
  • Nobody/Anonymous

    Logged In: NO

    Nix this. It doesn't generate an error, but it's not successfully running the UPDATE statement, either.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.