internals2.pdo.implementing.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 1,696 行 · 第 1/4 页
HTML
1,696 行
<p class="para"> This function returns 1 on success or 0 on failure. </p> </div> <div id="internals2.pdo.implementing.driver.last-id" class="sect3"> <h4 class="title">SKEL_handle_last_id</h4> <pre class="synopsis"><div class="cdata"><pre>static char * SKEL_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int len TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO to retrieve the ID of the last inserted row. </p> <dl> <dt> <span class="term">dbh</span> <dd> <p class="para">Pointer to the database handle initialized by the handle factory</p> </dd> </dt> <dt> <span class="term">name</span> <dd> <p class="para"> string representing a table or sequence name. </p> </dd> </dt> <dt> <span class="term">len</span> <dd> <p class="para">the length of the <i><tt class="parameter">name</tt></i> parameter.</p> </dd> </dt> </dl> <p class="para"> This function returns a character string containing the id of the last inserted row on success or NULL on failure. This is an optional function. </p> </div> <div id="internals2.pdo.implementing.driver.check-live" class="sect3"> <h4 class="title">SKEL_check_liveness</h4> <pre class="synopsis"><div class="cdata"><pre>static int SKEL_check_liveness(pdo_dbh_t *dbh TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO to test whether or not a persistent connection to a database is alive and ready for use. </p> <dl> <dt> <span class="term">dbh</span> <dd> <p class="para">Pointer to the database handle initialized by the handle factory</p> </dd> </dt> </dl> <p class="para"> This function returns 1 if the database connection is alive and ready for use, otherwise it should return 0 to indicate failure or lack of support. </p> <blockquote><p><b class="note">Note</b>: This is an optional function. <br /> </p></blockquote> </div> <div id="internals2.pdo.implementing.driver.get-methods" class="sect3"> <h4 class="title">SKEL_get_driver_methods</h4> <pre class="synopsis"><div class="cdata"><pre>static function_entry *SKEL_get_driver_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO in response to a call to any method that is not a part of either the <a href="class.pdo.html" class="classname">PDO</a> or <a href="class.pdostatement.html" class="classname">PDOStatement</a> classes. It's purpose is to allow the driver to provide additional driver specific methods to those classes. </p> <dl> <dt> <span class="term">dbh</span> <dd> <p class="para">Pointer to the database handle initialized by the handle factory</p> </dd> </dt> <dt> <span class="term">kind</span> <dd> <p class="para">One of the following:</p> <dl> <dt> <span class="term">PDO_DBH_DRIVER_METHOD_KIND_DBH</span> <dd> <p class="para"> Set when the method call was attempted on an instance of the <a href="class.pdo.html" class="classname">PDO</a> class. The driver should return a pointer a function_entry table for any methods it wants to add to that class, or NULL if there are none. </p> </dd> </dt> <dt> <span class="term">PDO_DBH_DRIVER_METHOD_KIND_STMT</span> <dd> <p class="para"> Set when the method call was attempted on an instance of the <a href="class.pdostatement.html" class="classname">PDOStatement</a> class. The driver should return a pointer to a function_entry table for any methods it wants to add to that class, or NULL if there are none. </p> </dd> </dt> </dl> </dd> </dt> </dl> <p class="para"> This function returns a pointer to the function_entry table requested, or NULL there are no driver specific methods. </p> </div> <div id="internals2.pdo.implementing.driver.handle-factory" class="sect3"> <h4 class="title">SKEL_handle_factory</h4> <pre class="synopsis"><div class="cdata"><pre>static int SKEL_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO to create a database handle. For most databases this involves establishing a connection to the database. In some cases, a persistent connection may be requested, in other cases connection pooling may be requested. All of these are database/driver dependent. </p> <dl> <dt> <span class="term">dbh</span> <dd> <p class="para">Pointer to the database handle initialized by the handle factory</p> </dd> </dt> <dt> <span class="term">driver_options</span> <dd> <p class="para"> An array of driver options, keyed by integer option number. See <a href="internals2.pdo.constants.html" class="xref">Constants</a> for a list of possible attributes. </p> </dd> </dt> </dl> <p class="para"> This function should fill in the passed database handle structure with its driver specific information on success and return 1, otherwise it should return 0 to indicate failure. </p> <p class="para"> PDO processes the AUTOCOMMIT and PERSISTENT driver options before calling the handle_factory. It is the handle factory's responsibility to process other options. </p> </div> <div id="internals2.pdo.implementing.driver.method-table" class="sect3"> <h4 class="title">Driver method table</h4> <p class="para"> A static structure of type pdo_dbh_methods named SKEL_methods must be declared and initialized to the function pointers for each defined function. If a function is not supported or not implemented the value for that function pointer should be set to NULL. </p> </div> <div id="internals2.pdo.implementing.driver.skeldriver" class="sect3"> <h4 class="title">pdo_SKEL_driver</h4> <p class="para"> A structure of type pdo_driver_t named pdo_SKEL_driver should be declared. The PDO_DRIVER_HEADER(SKEL) macro should be used to declare the header and the function pointer to the handle factory function should set. </p> </div> </div> <div id="internals2.pdo.implementing.statement" class="sect2"> <h3 class="title">SKEL_statement.c: Statement implementation</h3> <p class="para"> This unit implements all of the database statement handling methods that support the PDO statement object. </p> <div id="internals2.pdo.implementing.statement.dtor" class="sect3"> <h4 class="title">SKEL_stmt_dtor</h4> <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO to destroy a previously constructed statement object. </p> <dl> <dt> <span class="term">stmt</span> <dd> <p class="para">Pointer to the statement structure initialized by SKEL_handle_preparer.</p> </dd> </dt> </dl> <p class="para"> This should do whatever is necessary to free up any driver specific storage allocated for the statement. The return value from this function is ignored. </p> </div> <div id="internals2.pdo.implementing.statement.exec" class="sect3"> <h4 class="title">SKEL_stmt_execute</h4> <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO to execute the prepared SQL statement in the passed statement object. </p> <dl> <dt> <span class="term">stmt</span> <dd> <p class="para">Pointer to the statement structure initialized by SKEL_handle_preparer.</p> </dd> </dt> </dl> <p class="para"> This function returns 1 for success or 0 in the event of failure. </p> </div> <div id="internals2.pdo.implementing.statement.fetch" class="sect3"> <h4 class="title">SKEL_stmt_fetch</h4> <pre class="synopsis">static int SKEL_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, long offset TSRMLS_DC)</pre> <p class="para"> This function will be called by PDO to fetch a row from a previously executed statement object. </p> <dl> <dt> <span class="term">stmt</span> <dd> <p class="para">Pointer to the statement structure initialized by SKEL_handle_preparer.</p> </dd> </dt> <dt> <span class="term">ori</span> <dd> <p class="para">One of PDO_FETCH_ORI_xxx which will determine which row will be fetched.</p> </dd> </dt> <dt> <span class="term">offset</span> <dd> <p class="para"> If ori is set to PDO_FETCH_ORI_ABS or PDO_FETCH_ORI_REL, offset represents the row desired or the row relative to the current position, respectively. Otherwise, this value is ignored. </p> </dd> </dt> </dl> <p class="para"> The results of this fetch are driver dependent and the data is usually stored in the driver_data member of the pdo_stmt_t object. The ori and offset parameters are only meaningful if the statement represents a scrollable cursor. This function returns 1 for success or 0 in the event of failure. </p> </div> <div id="internals2.pdo.implementing.statement.param-hook" class="sect3"> <h4 class="title">SKEL_stmt_param_hook</h4> <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC)</pre></div></pre> <p class="para"> This function will be called by PDO for handling of both bound parameters and bound columns. </p> <dl> <dt> <span class="term">stmt</span> <dd> <p class="para">Pointer to the statement structure initialized by SKEL_handle_preparer.</p> </dd> </dt> <dt> <span class="term">param</span> <dd> <p class="para"> The structure describing either a statement parameter or a bound column. </p> </dd> </dt> <dt> <span class="term">event_type</span> <dd> <p class="para">The type of event to occur for this parameter, one of the following:</p> <dl> <dt>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?