Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8432

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>pdo_dbh_t definition</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.pdo.packaging.html">Packaging and distribution</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.pdo.pdo-stmt-t.html">pdo_stmt_t definition</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.pdo-dbh-t" class="sect1">
 <h2 class="title">pdo_dbh_t definition</h2>
 <p class="para">
  All fields should be treated as read-only by the driver, unless explicitly
  stated otherwise.
 </p>
 <div class="figure">
  <h1 class="title">pdo_dbh_t</h1>
  <div class="example-contents"><div class="ccode"><pre class="ccode">/* represents a connection to a database */
struct _pdo_dbh_t {
    /* driver specific methods */
    struct pdo_dbh_methods *methods;</pre>
</div><a name="internals2.pdo.dbh.co.methods" id="internals2.pdo.dbh.co.methods">*</a><div class="ccode"><pre class="ccode">/* driver specific data */
    void *driver_data;</pre>
</div><a name="internals2.pdo.dbh.co.driver-data" id="internals2.pdo.dbh.co.driver-data">**</a><div class="ccode"><pre class="ccode">/* credentials */
    char *username, *password;</pre>
</div><a name="internals2.pdo.dbh.co.credentials" id="internals2.pdo.dbh.co.credentials">***</a><div class="ccode"><pre class="ccode">/* if true, then data stored and pointed at by this handle must all be
     * persistently allocated */
    unsigned is_persistent:1;</pre>
</div><a name="internals2.pdo.dbh.co.is-persist" id="internals2.pdo.dbh.co.is-persist">****</a><div class="ccode"><pre class="ccode">/* if true, driver should act as though a COMMIT were executed between
     * each executed statement; otherwise, COMMIT must be carried out manually
     * */
    unsigned auto_commit:1;</pre>
</div><a name="internals2.pdo.dbh.co.auto-commit" id="internals2.pdo.dbh.co.auto-commit">*****</a><div class="ccode"><pre class="ccode">/* if true, the driver requires that memory be allocated explicitly for
     * the columns that are returned */
    unsigned alloc_own_columns:1;</pre>
</div><a name="internals2.pdo.dbh.co.alloc-own" id="internals2.pdo.dbh.co.alloc-own">******</a><div class="ccode"><pre class="ccode">/* if true, commit or rollBack is allowed to be called */
    unsigned in_txn:1;                  

    /* max length a single character can become after correct quoting */
    unsigned max_escaped_char_length:3;</pre>
</div><a name="internals2.pdo.dbh.co.max-esc" id="internals2.pdo.dbh.co.max-esc">*******</a><div class="ccode"><pre class="ccode">/* data source string used to open this handle */
    const char *data_source;</pre>
</div><a name="internals2.pdo.dbh.co.dsn" id="internals2.pdo.dbh.co.dsn">********</a><div class="ccode"><pre class="ccode">unsigned long data_source_len;

    /* the global error code. */
    pdo_error_type error_code;</pre>
</div><a name="internals2.pdo.dbh.co.error-code" id="internals2.pdo.dbh.co.error-code">*********</a><div class="ccode"><pre class="ccode">enum pdo_case_conversion native_case</pre>
</div><a name="internals2.pdo.dbh.co-ncase" id="internals2.pdo.dbh.co-ncase">**********</a><div class="ccode"><pre class="ccode">, desired_case;
};</pre>
</div></div>

 </div>
 <table>
  <tr><td><a href="#internals2.pdo.dbh.co.methods">*</a></td><td>
   <p class="para">
    The driver <em class="emphasis">must</em> set this during
     <span class="function"><strong>SKEL_handle_factory()</strong></span>.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.driver-data">**</a></td><td>
   <p class="para">
    This item is for use by the driver; the intended usage is to store a
    pointer (during  <span class="function"><strong>SKEL_handle_factory()</strong></span>) 
    to whatever instance data is required to maintain a connection to
    the database.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.credentials">***</a></td><td>
   <p class="para">
    The username and password that were passed into the PDO constructor.
    The driver should use these values when it initiates a connection to the
    database.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.is-persist">****</a></td><td>
   <p class="para">
    If this is set to 1, then any data that is referenced by the
    dbh, including whatever structure your driver allocates,
    <em class="emphasis">MUST</em> be allocated persistently.  This is easy to
    achieve; rather than using the usual  <span class="function"><strong>emalloc()</strong></span> simply
    use  <span class="function"><strong>pemalloc()</strong></span> and pass the value of this flag as the
    last parameter.  Failure to use the appropriate kind of memory can lead
    to serious memory faults, resulting (in the best case) a hard crash, and
    in the worst case, an exploitable memory problem.
   </p>
   <p class="para">
    If, for whatever reason, your driver is not suitable to run persistently,
    you <em class="emphasis">MUST</em> check this flag in your
     <span class="function"><strong>SKEL_handle_factory()</strong></span> and raise an appropriate error.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.auto-commit">*****</a></td><td>
   <p class="para">
    You should check this value in your  <span class="function"><strong>SKEL_handle_doer()</strong></span>
    and  <span class="function"><strong>SKEL_stmt_execute()</strong></span> functions; if it evaluates to
    true, you must attempt to commit the query now.  Most database
    implementations offer an auto-commit mode that handles this automatically.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.alloc-own">******</a></td><td>
   <p class="para">
    If your database client library API operates by fetching data into a
    caller-supplied buffer, you should set this flag to 1 during your
     <span class="function"><strong>SKEL_handle_factory()</strong></span>.  When set, PDO will call your
     <span class="function"><strong>SKEL_stmt_describer()</strong></span> earlier than it would
    otherwise.  This early call allows you to determine those buffer sizes
    and issue appropriate calls to the database client library.
   </p>
   <p class="para">
    If your database client library API simply returns pointers to its own
    internal buffers for you to copy after each fetch call, you should leave
    this value set to 0.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.max-esc">*******</a></td><td>
   <p class="para">
    If your driver doesn&#039;t support native prepared statements
    (<em><code class="parameter">supports_placeholders</code></em> is set to
    <strong><code>PDO_PLACEHOLDER_NONE</code></strong>), you must set
    this value to the maximum length that can be taken up by a single
    character when it is quoted by your
     <span class="function"><strong>SKEL_handle_quoter()</strong></span> function.  This value is used to
    calculate the amount of buffer space required when PDO executes the
    statement.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.dsn">********</a></td><td>
   <p class="para">
    This holds the value of the DSN that was passed into the PDO
    constructor.  If your driver implementation needed to modify the DSN for
    whatever reason, it should update this member during
     <span class="function"><strong>SKEL_handle_factory()</strong></span>.  Modifying this member should
    be avoided.  If you do change it, you must ensure that
    <em><code class="parameter">data_source_len</code></em> is also correct.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co.error-code">*********</a></td><td>
   <p class="para">
    Whenever an error occurs during a call to one of your driver methods,
    you should set this member to the SQLSTATE code that best describes the
    error and return an error.  In this HOW-TO, the suggested practice is to
    call  <span class="function"><strong>SKEL_handle_error()</strong></span> when an error is detected,
    and have it set the error code.
   </p>
  </td></tr>

  <tr><td><a href="#internals2.pdo.dbh.co-ncase">**********</a></td><td>
   <p class="para">
    Your driver should set this during
     <span class="function"><strong>SKEL_handle_factory()</strong></span>; the value should reflect how
    the database returns the names of the columns in result sets.  If the
    name matches the case that was used in the query, set it to
    <strong><code>PDO_CASE_NATURAL</code></strong> (this is actually the default).
    If the column names are always returned in upper case, set it to
    <strong><code>PDO_CASE_UPPER</code></strong>.  If the column names are always
    returned in lower case, set it to <strong><code>PDO_CASE_LOWER</code></strong>.
    The value you set is used to determine if PDO should perform case
    folding when the user sets the <strong><code>PDO_ATTR_CASE</code></strong>
    attribute.
   </p>
  </td></tr>

 </table>
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.pdo.packaging.html">Packaging and distribution</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.pdo.pdo-stmt-t.html">pdo_stmt_t definition</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>