Manuál PHP | ||
---|---|---|
PÅ™edcházejÃcà | Dalšà |
db2_execute
Popis
bool db2_execute ( resource stmt [, array parameters] )db2_execute() executes an SQL statement that was prepared by db2_prepare().
If the SQL statement returns a result set, for example, a SELECT statement or a CALL to a stored procedure that returns one or more result sets, you can retrieve a row as an array from the stmt resource using db2_fetch_assoc(), db2_fetch_both(), or db2_fetch_array(). Alternatively, you can use db2_fetch_row() to move the result set pointer to the next row and fetch a column at a time from that row with db2_result().
Refer to db2_prepare() for a brief discussion of the advantages of using db2_prepare() and db2_execute() rather than db2_exec().
Seznam parametrů
stmt
A prepared statement returned from db2_prepare().
parameters
An array of input parameters matching any parameter markers contained in the prepared statement.
PÅ™Ãklady
PÅ™Ãklad 2. Calling a stored procedure with an OUT parameter The following example prepares a CALL statement that accepts one parameter marker representing an OUT parameter, binds the PHP variable $my_pets to the parameter using db2_bind_param(), then issues db2_execute() to execute the CALL statement. After the CALL to the stored procedure has been made, the value of $num_pets changes to reflect the value returned by the stored procedure for that OUT parameter.
Výše uvedený pÅ™Ãklad vypÃÅ¡e:
|
PÅ™Ãklad 3. Returning XML data as a SQL ResultSet The following example demonstrates how to work with documents stored in a XML column using the SAMPLE database. Using some pretty simple SQL/XML, this example returns some of the nodes in a XML document in a SQL ResultSet format that most users are familiar with.
Výše uvedený pÅ™Ãklad vypÃÅ¡e:
|
PÅ™Ãklad 4. Performing a "JOIN" with XML data The following example works with documents stored in 2 different XML columns in the SAMPLE database. It creates 2 temporary tables from the XML documents from 2 different columns and returns a SQL ResultSet with information regarding shipping status for the customer.
Výše uvedený pÅ™Ãklad vypÃÅ¡e:
|
PÅ™Ãklad 5. Returning SQL data as part of a larger XML document The following example works with a portion of the PRODUCT.DESCRIPTION documents in the SAMPLE database. It creates a XML document containing product description (XML data) and pricing info (SQL data).
Výše uvedený pÅ™Ãklad vypÃÅ¡e:
|
Viz také
db2_exec() |
db2_fetch_array() |
db2_fetch_assoc() |
db2_fetch_both() |
db2_fetch_row() |
db2_prepare() |
db2_result() |
PÅ™edcházejÃcà | Domů | Dalšà |
db2_exec | Nahoru | <