internals2.pdo.implementing.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 1,696 行 · 第 1/4 页

HTML
1,696
字号
        <span class="term">PDO_PARAM_EVT_ALLOC</span>        <dd>         <p class="para">Called when PDO allocates the binding.  Occurs as part of         <a href="pdostatement.bindparam.html" class="function">PDOStatement::bindParam()</a>,         <a href="pdostatement.bindvalue.html" class="function">PDOStatement::bindValue()</a> or as part of an implicit bind         when calling <a href="pdostatement.execute.html" class="function">PDOStatement::execute()</a>.  This is your         opportunity to take some action at this point; drivers that implement         native prepared statements will typically want to query the parameter         information, reconcile the type with that requested by the script,         allocate an appropriately sized buffer and then bind the parameter to         that buffer.  You should not rely on the type or value of the zval at         <i>param-&gt;parameter</i> at this point in time.         </p>        </dd>       </dt>       <dt>        <span class="term">PDO_PARAM_EVT_FREE</span>        <dd>         <p class="para">Called once per parameter as part of cleanup.  You should         release any resources associated with that parameter now.</p>        </dd>       </dt>       <dt>        <span class="term">PDO_PARAM_EXEC_PRE</span>        <dd>         <p class="para">Called once for each parameter immediately before calling         SKEL_stmt_execute; take this opportunity to make any final adjustments         ready for execution.  In particular, you should note that variables         bound via <a href="pdostatement.bindparam.html" class="function">PDOStatement::bindParam()</a> are only legal         to touch now, and not any sooner.         </p>        </dd>       </dt>       <dt>        <span class="term">PDO_PARAM_EXEC_POST</span>        <dd>         <p class="para">Called once for each parameter immediately after calling         SKEL_stmt_execute; take this opportunity to make any post-execution         actions that might be required by your driver.</p>        </dd>       </dt>       <dt>        <span class="term">PDO_PARAM_FETCH_PRE</span>        <dd>         <p class="para">Called once for each parameter immediately prior to calling         SKEL_stmt_fetch.</p>        </dd>       </dt>       <dt>        <span class="term">PDO_PARAM_FETCH_POST</span>        <dd>         <p class="para">Called once for each parameter immediately after calling          SKEL_stmt_fetch.</p>        </dd>       </dt>       </dl>     </dd>    </dt>   </dl>   <p class="para">    This hook will be called for each bound parameter and bound column in the    statement. For ALLOC and FREE events, a single call will be made for each    parameter or column. The param structure contains a driver_data field that    the driver can use to store implementation specific information about each    of the parameters.   </p>   <p class="para">    For all other events, PDO may call you multiple times as the script issues    <a href="pdostatement.execute.html" class="function">PDOStatement::execute()</a> and    <a href="pdostatement.fetch.html" class="function">PDOStatement::fetch()</a> calls.   </p>   <p class="para">    If this is a bound parameter, the is_param flag in the param structure is    set, otherwise the param structure refers to a bound column.   </p>   <p class="para">    This function returns 1 for success or 0 in the event of failure.   </p>  </div>  <div id="internals2.pdo.implementing.statement.desc-col" class="sect3">   <h4 class="title">SKEL_stmt_describe_col</h4>   <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_describe_col(pdo_stmt_t *stmt, int colno TSRMLS_DC)</pre></div></pre>   <p class="para">    This function will be called by PDO to query information about a particular    column.   </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">colno</span>     <dd>      <p class="para">The column number to be queried.</p>     </dd>    </dt>   </dl>   <p class="para">    The driver should populate the pdo_stmt_t member columns(colno) with the    appropriate information. This function returns 1 for success or 0 in the    event of failure.   </p>  </div>  <div id="internals2.pdo.implementing.statement.get-col-data" class="sect3">   <h4 class="title">SKEL_stmt_get_col_data</h4>   <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_get_col_data(pdo_stmt_t *stmt, int colno,  char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC)</pre></div></pre>   <p class="para">    This function will be called by PDO to retrieve data from the specified column.   </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">colno</span>     <dd>      <p class="para">The column number to be queried.</p>     </dd>    </dt>    <dt>     <span class="term">ptr</span>     <dd>      <p class="para">Pointer to the retrieved data.</p>     </dd>    </dt>    <dt>     <span class="term">len</span>     <dd>      <p class="para">The length of the data pointed to by ptr.</p>     </dd>    </dt>    <dt>     <span class="term">caller_frees</span>     <dd>      <p class="para">If set, ptr should point to emalloc&#039;d memory and the main PDO driver will free it as soon as it is done with it. Otherwise, it will be the responsibility of the driver to free any allocated memory as a result of this call.</p>     </dd>    </dt>   </dl>   <p class="para">    The driver should return the resultant data and length of that data in the    ptr and len variables respectively. It should be noted that the main PDO    driver expects the driver to manage the lifetime of the data. This function    returns 1 for success or 0 in the event of failure.   </p>  </div>  <div id="internals2.pdo.implementing.statement.set-attr" class="sect3">  <h4 class="title">SKEL_stmt_set_attr</h4>  <pre class="synopsis">static int SKEL_stmt_set_attr(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC)</pre>  <p class="para">   This function will be called by PDO to allow the setting of driver specific   attributes for a 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">attr</span>    <dd>     <p class="para">      <span class="type long">long</span> value of one of the PDO_ATTR_xxxx types.  See <a href="internals2.pdo.constants.html" class="xref">Constants</a> for valid attributes.     </p>    </dd>   </dt>   <dt>    <span class="term">val</span>    <dd>     <p class="para">The new value for the attribute.</p>    </dd>   </dt>  </dl>  <p class="para">   This function is driver dependent and allows the driver the capability to   set database specific attributes for a statement. This function returns 1   for success or 0 in the event of failure. This is an optional function. If   the driver does not support additional settable attributes, it can be   NULLed in the method table. The PDO driver does not handle any settable   attributes on the database driver&#039;s behalf.  </p>  </div>  <div id="internals2.pdo.implementing.statement.get-attr" class="sect3">   <h4 class="title">SKEL_stmt_get_attr</h4>   <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_get_attr(pdo_stmt_t *stmt, long attr, zval   *return_value TSRMLS_DC)</pre></div></pre>   <p class="para">    This function will be called by PDO to allow the retrieval of driver    specific attributes for a 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">attr</span>     <dd>      <p class="para">       <span class="type long">long</span> value of one of the PDO_ATTR_xxxx types.  See <a href="internals2.pdo.constants.html" class="xref">Constants</a> for valid attributes.      </p>     </dd>    </dt>    <dt>     <span class="term">return_value</span>     <dd>      <p class="para">The returned value for the attribute.</p>     </dd>    </dt>   </dl>   <p class="para">    This function is driver dependent and allows the driver the capability to    retrieve a previously set database specific attribute for a statement. This    function returns 1 for success or 0 in the event of failure. This is an    optional function. If the driver does not support additional gettable    attributes, it can be NULLed in the method table. The PDO driver does not    handle any settable attributes on the database driver&#039;s behalf.   </p>  </div>  <div id="internals2.pdo.implementing.statement.get-col-meta" class="sect3">   <h4 class="title">SKEL_stmt_get_col_meta</h4>   <pre class="synopsis"><div class="cdata"><pre>static int SKEL_stmt_get_col_meta(pdo_stmt_t *stmt, int colno,   zval *return_value TSRMLS_DC)</pre></div></pre>   <div class="warning"><b class="warning">Warning</b>    <p class="para">     This function is not well defined and is subject to change.    </p>   </div>   <p class="para">    This function will be called by PDO to retrieve meta data from the    specified column.   </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">colno</span>     <dd>      <p class="para">The column number for which data is to be retrieved.</p>     </dd>    </dt>    <dt>     <span class="term">return_value</span>     <dd>      <p class="para">Holds the returned meta data.</p>     </dd>    </dt>   </dl>   <p class="para">    The driver author should consult the documentation for this function that can be    found in the php_pdo_driver.h header as this will be the most current. This    function returns 1 for success or 0 in the event of failure. The database    driver does not need to provide this function.   </p>  </div>  <div id="internals2.pdo.implementing.statement.method-table" class="sect3">   <h4 class="title">Statement handling method table</h4>   <p class="para">    A static structure of type pdo_stmt_methods named SKEL_stmt_methods should    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></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.pdo.preparation.html">Preparation and Housekeeping</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.pdo.building.html">Building</a></div> <div class="up"><a href="internals2.pdo.html">PDO Driver How-To</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?