Re: Stored procedures with ODBC

From: Date: Sun, 18 Feb 2001 15:07:23 +0000
Subject: Re: Stored procedures with ODBC
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-1373@lists.php.net to get a copy of this message
Brian Lalor wrote: > > Hey all. I'm delving into PEAR's database abstraction library for the > first time. I'm trying to get a handle on the overall use of the > packages. > > ODBC is causing me some problems with regard to stored procedures, and I > think this could carry over to Oracle stored procedures as well, but I'm > not sure. Anyway, when I execute a stored procedure with ODBC, I'm just > doing it like > $db->query("spStored_Proc 'arg1', 'arg2', 'etc.', > 'ad', 'nauseum'") > fetch() does a preg_match() on the query string, and if it doesn't contain > SELECT, it returns DB_OK instead of the result set. > > What's the best way to decide whether or not a query is supposed to return > data? Hi, With stored procedures called like this, there is actually no way we can detect just by looking at the query whether it will be data manipulation or return data. Thus we need to ask the database. If this cannot be done, we need to reverse the logic in DB::isManip so "returning data" at least will be the default assumption. It's been a while since I last messed with the Oracle API, does anyone else know if there is a way of finding out what type of query you have? (After Oracle has parsed the query it'll know, the question is whether the API lets you find out.) And sorry for the late answer. :-) - Stig

« previous php.pear (#1373) next »