Re: ANSI Embedded SQL in PHP
| From: | John Lim | Date: | Thu, 11 Apr 2002 11:23:54 +0000 |
| Subject: | Re: ANSI Embedded SQL in PHP | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82569@lists.php.net to get a copy of this message | ||
This is very Oracle Pro*C specific and not portable. After coding
in Pro*C in a previous incarnation, I don't really want think I want
to do it this way again for every database.
====================
"Fabwash" <fabwash@hotmail.com> wrote in message
news:DAV132RtDQGiKAe2hXS00001c94@hotmail.com...
Hi all,
I was wondering if this was discussed before. Having embedded sql in php
source. The idea would be to have something like this:
<?php
$d = 1;
EXEC SQL
SELECT a,b,c INTO :vara, :varb, :varc FROM table WHERE d = :d;
printf ("Found vara = %s, varb = %s, varc = %s", $vara, $varb, $varc");
// another example with a cursor:
EXEC SQL
DECLARE mycursor FOR SELECT a,b,c FROM table WHERE d IS NULL;
...
EXEC SQL OPEN mycursor;
EXEC SQL FETCH mycursor INTO :vara, :varb, :varc;
if ($vara == "foo") {
more php code
}
etc..
The EXEC SQL statements would generate API calls that could be used by
drivers for the different databases like mysql, oracle, or whatever. An EXEC
SQL statement would have to be invented to select the type of database you
want to communicate with, give login information, etc..
Was that discussed before?
Fab.