pdo_dbh_t definition
All fields should be treated as read-only by the driver, unless explicitly stated otherwise.
pdo_dbh_t
/* represents a connection to a database */ struct _pdo_dbh_t { /* driver specific methods */ struct pdo_dbh_methods *methods;
/* driver specific data */ void *driver_data;
/* credentials */ char *username, *password;
/* if true, then data stored and pointed at by this handle must all be * persistently allocated */ unsigned is_persistent:1;
/* 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;
/* if true, the driver requires that memory be allocated explicitly for * the columns that are returned */ unsigned alloc_own_columns:1;
/* 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;
/* data source string used to open this handle */ const char *data_source;
unsigned long data_source_len; /* the global error code. */ pdo_error_type error_code;
enum pdo_case_conversion native_case
, desired_case; };
* |
The driver must set this during SKEL_handle_factory(). |
** |
This item is for use by the driver; the intended usage is to store a pointer (during SKEL_handle_factory()) to whatever instance data is required to maintain a connection to the database. |
*** |
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. |
**** |
If this is set to 1, then any data that is referenced by the dbh, including whatever structure your driver allocates, MUST be allocated persistently. This is easy to achieve; rather than using the usual emalloc() simply use pemalloc() 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. If, for whatever reason, your driver is not suitable to run persistently, you MUST check this flag in your SKEL_handle_factory() and raise an appropriate error. |
***** |
You should check this value in your SKEL_handle_doer() and SKEL_stmt_execute() 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. |
****** |
If your database client library API operates by fetching data into a caller-supplied buffer, you should set this flag to 1 during your SKEL_handle_factory(). When set, PDO will call your SKEL_stmt_describer() earlier than it would otherwise. This early call allows you to determine those buffer sizes and issue appropriate calls to the database client library. 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. |
******* |
If your driver doesn't support native prepared statements
( |
******** |
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
SKEL_handle_factory(). Modifying this member should
be avoided. If you do change it, you must ensure that
|
********* |
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 SKEL_handle_error() when an error is detected, and have it set the error code. |
********** |
Your driver should set this during
SKEL_handle_factory(); 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
|
Vertaling niet beschikbaar
De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.
Als je de moed voelt, kun je je vertaling aanbieden ;-)
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-internals2.pdo.pdo-dbh-t.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.