Re: [PHP-PEAR] Stored procedures with ODBC

[email protected] ("Stig S. Bakken")
Newsgroups php.pear
Organization Fast Search & Transfer
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.