⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 internals2.pdo.preparation.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Preparation and Housekeeping</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.pdo.html">PDO Driver How-To</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.pdo.implementing.html">Fleshing out your skeleton</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><hr /><div id="internals2.pdo.preparation" class="sect1"> <h2 class="title">Preparation and Housekeeping</h2> <div id="internals2.pdo.preparation.layout" class="sect2">  <h3 class="title">Source directory layout</h3>  <p class="para">   The source directory for a typical PDO driver is laid out as follows, where   <i>SKEL</i> represents a shortened form of the name of the   database that the driver is going to connect to.  Even though SKEL is   presented here in uppercase (for clarity), the convention is to use   lowercase characters.  </p>  <div class="example-contents"><pre><div class="cdata"><pre>pdo_SKEL/            config.m4                  # unix build script  config.w32                 # win32 build script  CREDITS  package.xml                # meta information about the package  pdo_SKEL.c                 # standard PHP extension glue  php_pdo_SKEL.h  php_pdo_SKEL_int.h         # driver private header  SKEL_dbh.c                 # contains the implementation of the PDO driver interface  SKEL_stmt.c                # contains the implementation of the PDO statement interface  tests/</pre></div>  </pre></div>  <p class="para">The contents of these files are defined later in this document.</p> </div> <div id="internals2.pdo.preparation.create-skel" class="sect2">  <h3 class="title">Creating a skeleton</h3>  <p class="para">   The easiest way to get started is to use the <strong class="command">ext_skel</strong>   shell script found in the PHP build tree in the <var class="filename">ext</var>   directory. This will build a skeleton directory containing a lot of the   files listed above. It can be build by executing the following command from   within the <var class="filename">ext</var> directory:  </p>  <div class="example-contents"><pre><div class="cdata"><pre>./ext_skel --extname=pdo_SKEL</pre></div>  </pre></div>  <p class="para">   This will generate a directory called pdo_SKEL containing the   skeleton files that you can then modify. This directory should then be   moved out of the php extension directory . PDO is a PECL extension and   should not be included in the standard extension directory. As long as you   have PHP and PDO installed, you should be able to build from any directory.  </p> </div> <div id="internals2.pdo.preparation.std-includes" class="sect2">  <h3 class="title">Standard Includes</h3>  <div id="internals2.pdo.preparation.std-includes.build-specific" class="sect3">   <h4 class="title">Build Specific Headers</h4>   <p class="para">    The header file config.h is generated by the configure process for the    platform for the which the driver is being built. If this header is    present, the HAVE_CONFIG_H compiler variable is set. This variable should    be tested for and if set, the file config.h should be included in the    compilation unit.   </p>  </div>  <div id="internals2.pdo.preparation.std-includes.php" class="sect3">   <h4 class="title">PHP Headers</h4>   <p class="para">    The following standard public php headers should be included in each    source module:   </p>   <ol class="orderedlist">    <li class="listitem">     <p class="para">php.h</p>    </li>    <li class="listitem">     <p class="para">php_ini.h</p>    </li>    <li class="listitem">     <p class="para">ext/standard/info.h</p>    </li>   </ol>  </div>  <div id="internals2.pdo.preparation.std-includes.pdo" class="sect3">   <h4 class="title">PDO Interface Headers</h4>   <p class="para">    The following standard public PDO header files are also included in each    source module:   </p>   <dl>    <dt>     <span class="term">pdo/php_pdo.h</span>     <dd>      <p class="para">       This header file contains definitions of the initialization and shutdown       functions in the main driver as well as definitions of global PDO       variables.      </p>     </dd>    </dt>    <dt>     <span class="term">pdo/php_pdo_driver.h</span>     <dd>      <p class="para">       This header contains the types and API contracts that are used to write       a PDO driver. It also contains method signature for calling back into       the PDO layer and registering/unregistering your driver with        PDO. Most importantly, this header file contains the type       definitions for PDO database handles and statements. The two main       structures a driver has to deal with, pdo_dbh_t and pdo_stmt_t, are       described in more detail in Appendix A and B.      </p>     </dd>    </dt>   </dl>  </div>  <div id="internals2.pdo.preparation.std-headers.driver-spec" class="sect3">   <h4 class="title">Driver Specific Headers</h4>   <p class="para">    The typical PDO driver has two header files that are specific to the    database implementation. This does not preclude the use of more depending    on the implementation. The following two headers are, by convention,    standard:   </p>   <dl>    <dt>     <span class="term">php_pdo_SKEL.h</span>     <dd>      <p class="para">       This header file is virtually an exact duplicate in functionality       and content of the previously defined pdo/php_pdo.h that has been       specifically tailored for your database. If your driver requires       the use of global variables they should be defined using the       ZEND_BEGIN_MODULE_GLOBALS and ZEND_END_MODULE_GLOBALS macros.       Macros are then used to access these variables. This macro is       usually named PDO_SKEL_G(v) where v is global variable to be       accessed. Consult the Zend programmer documentation for more       information.      </p>     </dd>    </dt>    <dt>     <span class="term">php_pdo_SKEL_int.h</span>     <dd>      <p class="para">       This header file typically contains type definitions and function       declarations specific to the driver implementation. It also should       contain the db specific definitions of a pdo_SKEL_handle and       pdo_SKEL_stmt structures. These are the names of the private       data structures that are then referenced by the driver_data members       of the handle and statement structures.      </p>     </dd>    </dt>   </dl>  </div>  <div id="internals2.pdo.preparation.std-headers.optional" class="sect3">   <h4 class="title">Optional Headers</h4>   <p class="para">    Depending on the implementation details for a particular driver it may be    necessary to include the following header:   </p>   <div class="example-contents"><div class="cdata"><pre>#include &lt;zend_exceptions.h&gt;</pre></div>   </div>  </div> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.pdo.html">PDO Driver How-To</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.pdo.implementing.html">Fleshing out your skeleton</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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -