PHP Doku:: Is used to execute the given SQL sentence. - function.cubrid-execute.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenCubridCubrid Funktionencubrid_execute

Ein Service von Reinhard Neidl - Webprogrammierung.

Cubrid Funktionen

<<cubrid_error

cubrid_fetch_array>>

cubrid_execute

(PECL CUBRID >= 8.3.0)

cubrid_executeIs used to execute the given SQL sentence.

Beschreibung

resource cubrid_execute ( resource $conn_identifier , string $SQL [, int $option ] )
int cubrid_execute ( resource $request_identifier [, int $option ] )

The cubrid_execute() function is used to execute the given SQL sentence. It executes the query by using conn_identifier and SQL, and then returns the request identifier created. It is used for simple execution of query, where the parameter binding is not needed. In addition, the cubrid_execute() function is used to execute the prepared statement by means of cubrid_prepare() and cubrid_bind(). At this time, you need to specify arguments of request_identifier and option.

You can use the option argument to tell whether to receive oid of the row after the execution, and, whether to execute the query in asynchronous mode. You can use it by setting the CUBRID_INCLUDE_OID and CUBRID_ASYNC using bitwise or operator. If the both variables are not explicitly given, they are not selected by default.

If the first argument is request_identifier to execute the cubrid_prepare() function, you can specify an option, CUBRID_ASYNC only.

Parameter-Liste

conn_identifier

Connection identifier.

SQL

SQL to be executed.

option

Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC.

request_identifier

cubrid_prepare() identifier.

Rückgabewerte

Request identifier, when process is successful and first param is conn_identifier; TRUE, when process is successful and first argument is request_identifier.

FALSE, when process is unsuccessful.

Beispiele

Beispiel #1 cubrid_execute() example

<?php
$con 
cubrid_connect ("dbsvr.cubrid.com"33000"demodb"); 
if (
$con) {
 
                echo 
"connected successfully"
                
$req cubrid_execute ($con"select * from members"CUBRID_INCLUDE_OID CUBRID_ASYNC);
 
                if (
$req) {
                                while (list (
$id$name) = cubrid_fetch ($req)) {
                                                echo 
$id;
                                                echo 
$name;
                                }
                                
cubrid_close_request ($req);
                }

                
cubrid_disconnect ($con);
}

            
$con cubrid_connect ("dbsvr.cubrid.com"33000"demodb"); 
if (
$con) {
 
                echo 
"connected successfully"
                
$sql "insert into tbl values (?, ?, ?)";
 
                
$req cubrid_prepare($con$sqlCUBRID_INCLUDE_OID); 

                
$i 0;
                while ( 
$i ) {
                                
$res cubrid_bind($req1"1""NUMBER");
                                
$res cubrid_bind($req2"2");
                                
$res cubrid_bind($req3"04:22:34 PM 08/07/2007");
                                
$res cubrid_execute($req);
                                
$i $i 1;
                }
}
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)