• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

tests/H16-Nov-2021-5,4114,794

CREDITSH A D16-Nov-2021101 32

Makefile.fragH A D16-Nov-20211.2 KiB3629

Makefile.frag.w32H A D16-Nov-2021169 43

READMEH A D16-Nov-20211.9 KiB5336

config.m4H A D16-Nov-20211.4 KiB5441

config.w32H A D16-Nov-2021398 118

pdo.cH A D16-Nov-20219.2 KiB404269

pdo.phpH A D16-Nov-20211.2 KiB6343

pdo_dbh.cH A D16-Nov-202147.4 KiB1,6121,227

pdo_sql_parser.cH A D16-Nov-202114.8 KiB720604

pdo_sql_parser.reH A D16-Nov-202111.1 KiB426365

pdo_sqlstate.cH A D16-Nov-202113.3 KiB334304

pdo_stmt.cH A D16-Nov-202174 KiB2,7282,114

php_pdo.hH A D16-Nov-20212.6 KiB8644

php_pdo_driver.hH A D16-Nov-202124.4 KiB707343

php_pdo_error.hH A D16-Nov-20211.9 KiB4615

php_pdo_int.hH A D16-Nov-20213 KiB7230

README

1PHP Data Objects
2================
3
4Concept: Data Access Abstraction
5
6Goals:
7
81/  Be light-weight
92/  Provide common API for common database operations
103/  Be performant
114/  Keep majority of PHP specific stuff in the PDO core (such as persistent
12    resource management); drivers should only have to worry about getting the
13    data and not about PHP internals.
14
15
16Transactions and autocommit
17===========================
18
19When you create a database handle, you *should* specify the autocommit
20behaviour that you require.  PDO will default to autocommit on.
21
22$dbh = new PDO("...", $user, $pass, array(PDO_ATTR_AUTOCOMMIT => true));
23
24When auto-commit is on, the driver will implicitly commit each query as it is
25executed.  This works fine for most simple tasks but can be significantly
26slower when you are making a large number of udpates.
27
28$dbh = new PDO("...", $user, $pass, array(PDO_ATTR_AUTOCOMMIT => false));
29
30When auto-commit is off, you must then use $dbh->beginTransaction() to
31initiate a transaction.  When your work is done, you then call $dbh->commit()
32or $dbh->rollBack() to persist or abort your changes respectively.  Not all
33databases support transactions.
34
35You can change the auto-commit mode at run-time:
36
37$dbh->setAttribute(PDO_ATTR_AUTOCOMMIT, false);
38
39Regardless of the error handling mode set on the database handle, if the
40autocommit mode cannot be changed, an exception will be thrown.
41
42Some drivers will allow you to temporarily disable autocommit if you call
43$dbh->beginTransaction().  When you commit() or rollBack() such a transaction,
44the handle will switch back to autocommit mode again.  If the mode could not
45be changed, an exception will be raised, as noted above.
46
47When the database handle is closed or destroyed (or at request end for
48persistent handles), the driver will implicitly rollBack().  It is your
49responsibility to call commit() when you are done making changes and
50autocommit is turned off.
51
52vim:tw=78:et
53