RE: [PHP4BETA] ODBC, Stored Procedures and OUT parameters
| From: | (Lars Thomas Denstad) | Date: | Tue, 02 Nov 1999 23:18:36 +0000 |
| Subject: | RE: [PHP4BETA] ODBC, Stored Procedures and OUT parameters | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-5844@lists.php.net to get a copy of this message | ||
Hey, thanks for the quick reply. The connect statement looks like this:
$db_handle = odbc_connect("foo", "bar", "pass", SQL_CUR_USE_ODBC);
I don't think the cursor affects the way that PHP breaks.
The database is an Oracle 8 database running on Win NT. Stored procedures
using Direct Exec and Prepare and Execute both work using only
in-parameters. The breaking of PHP only occurs when the execute-statement
tries to write something back to the array (or so it seems to me, I haven't
really looked at the code yet.)
I have tried the code using both Oracles ODBC-drivers and Microsoft's.
The Oracle ODBC-drivers does the memory overwrite in PHP, the Microsoft
one's cannot match the parameter with the ones I pass in the array and gives
a warning:
Warning: SQL error: [Microsoft][ODBC driver for Oracle]Invalid parameter
type, SQL state S1105 in SQLExecute in C:\dev\php3\test.php3 on line 14
(I try to get this to work with PHP3 as I have PHP4 installed as
ISAPI-filter and when it breaks I have to reboot. The symptoms are the same,
tho.)
The procedure in question is supposed to return data with the datatype
VARCHAR2.
Again, any input greatly appreciated.
LT.
> -----Original Message-----
> From: Avrum Goodblatt [mailto:goodblat@sprynet.com]
> Sent: Tuesday, November 02, 1999 2:24 PM
> To: Lars Thomas Denstad
> Subject: Re: [PHP4BETA] ODBC, Stored Procedures and OUT parameters
>
>
> On 2 Nov 99, at 14:16, Lars Thomas Denstad wrote:
>
> I'd like to play around with this and see what I can find.
> First of all, what is your odbc_connect statement? Are you
> setting the fourth
> parameter for the odbc cursor?
> What sort of database engine are you using?
> Has CALL worked at all, or just not in this instance?
>
>
> > I'm currently working on moving a piece of code from C++ to
> PHP3/4, but I'm
> > stranded on calling stored procedures using OUT parameters;
> procedures that
> > return data through their parameters.
> >
> > I'm developing on Win NT 4.0, versions I'm running are PHP
> version 3.0.11
> > and the PHP 4.0 PreBeta3.
> >
> > From the examples I would think the code should look like this:
> >
> > $params = array ("Inparam", "", "");
> > $i_ret = odbc_prepare($db_handle, "{call in_out_proc ( ?, ?, ? )}");
> > $j_ret = odbc_execute($i_ret, &$params);
> >
> > The in_out_proc takes is supposed to take the in parameter from
> [0] in the
> > array and store data in positions [1] and [2], and I was hoping
> to be able
> > to access the result with params[1] and params[2].
> >
> > Using PHP3 as a CGI, however, ends up with a memory protection failure.
> > Running PHP4PreBeta3 just hangs the download, and I most of the
> time have to
> > reboot the machine to get IIS up and running correctly again.
> >
> > I've also played around with passing larger strings with just
> spaces in the
> > array and also passing references to other strings, but while
> it prevents
> > the application from crashing, it doesn't seem to make the data
> available
> > for me.
> >
> > I would have a look at the source, but I haven't been able to
> build it using
> > MSVC++5.0 (do I need 6.0?).
> >
> > Any pointers would be greatly appreciated. Also, information on
> how to call
> > stored functions would with the same setup, would be helpful.
> >
> > Thanks,
> >
> > LT.
> >
> >
> > --
> > PHP 4.0 Beta Mailing List
> > <http://www.php.net/version4/>
> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> > For additional commands, e-mail: php4beta-help@lists.php.net
> > To contact the list administrators, e-mail: php4beta-admin@lists.php.net
> >
>
>
> --------------------------------------------------
> Avrum Goodblatt goodblat@sprynet.com (415) 9451368
> http://home.sprynet.com/~goodblat
>