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.
 
 

Reply via email to