les09 cregen query tm





Creating a Generic Query Function










The interactions in this eCourse require Javascript to be enabled.



 

Creating a Generic Query Function


previous|next





The hr_db.inc file contains a db_do_query() function that performs the following steps (with OCI8 library calls shown) to execute a query, optionally with bind variables:




Parse the query string with oci_parse().



Assign PHP variable values to query bind variables with oci_bind_by_name().



Execute the query with oci_execute().



Fetch the result set with oci_fetch_all(). Take care using this OCI function with large result sets.



The db_do_query() function provides the following parameters:




$conn for the connection identifier



$statement containing the query string



$resulttype specifying how the result set is return, either as an array of rows each containing an array of columns (the default OCI_FETCHSTATEMENT_BY_ROW), or as an array of columns each containing an array of the row values in that column (OCI_FETCHSTATEMENT_BY_COLUMN)



$bindvars: an optional array containing one or more bind variable arrays. Each bind variable array may contain the name of the bind variable in the query, the value to be associated with the bind variable, and a length of the value.
For IN bind variables, which provide input values to a query, the length can be set to -1. In this case, the OCI8 layer dynamically determines the length of the value. For OUT bind variables, for values returned by a query, the length must be set to a suitable value for the expected result.



The db_do_query() function returns the result set as an array or rows or columns, depending on the value of the $resulttype parameter. The function returns a false value if an error occurs.

 









Wyszukiwarka

Podobne podstrony:
les09 page handling tm
les09 cre ui tm
les09 disp?pt tm
les09 create? logic tm
les09 crectl logic tm
les09 credb connect tm
les09 get?pt tm
les09 login page tm
les09 logout page tm
les09 get emp tm
les09 disp emp tm
les09 create? conn prop tm
les09 getstart tm
TM 08 termin I
les09 styles css
Fanuc 11M [TM] CQ07 16 2
TM UART
Ulotka Pytania dotyczące TS, ETPCz, TM

więcej podobnych podstron