1 | <?php |
||
21 | class PDO extends \Aimeos\MW\DB\Connection\Base implements \Aimeos\MW\DB\Connection\Iface |
||
22 | { |
||
23 | private $connection; |
||
24 | private $txnumber = 0; |
||
25 | private $stmts = array(); |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Initializes the PDO connection object. |
||
30 | * |
||
31 | * @param array $params Associative list of connection parameters |
||
32 | * @param string[] $stmts List of SQL statements to execute after connecting |
||
33 | */ |
||
34 | public function __construct( array $params, array $stmts ) |
||
41 | |||
42 | |||
43 | /** |
||
44 | * Connects (or reconnects) to the database server |
||
45 | * |
||
46 | * @return \Aimeos\MW\DB\Connection\Iface Connection instance for method chaining |
||
47 | */ |
||
48 | public function connect() |
||
65 | |||
66 | |||
67 | /** |
||
68 | * Creates a \PDO database statement. |
||
69 | * |
||
70 | * @param string $sql SQL statement, maybe with place holders |
||
71 | * @param integer $type Simple or prepared statement type constant from abstract class |
||
72 | * @return \Aimeos\MW\DB\Statement\Iface \PDO statement object |
||
73 | * @throws \Aimeos\MW\DB\Exception if type is invalid or the \PDO object throws an exception |
||
74 | */ |
||
75 | public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
||
91 | |||
92 | |||
93 | /** |
||
94 | * Returns the underlying connection object |
||
95 | * |
||
96 | * @return \PDO Underlying connection object |
||
97 | */ |
||
98 | public function getRawObject() |
||
102 | |||
103 | |||
104 | /** |
||
105 | * Checks if a transaction is currently running |
||
106 | * |
||
107 | * @return boolean True if transaction is currently running, false if not |
||
108 | */ |
||
109 | public function inTransaction() |
||
117 | |||
118 | |||
119 | /** |
||
120 | * Starts a transaction for this connection. |
||
121 | * Transactions can't be nested and a new transaction can only be started |
||
122 | * if the previous transaction was committed or rolled back before. |
||
123 | */ |
||
124 | public function begin() |
||
133 | |||
134 | |||
135 | /** |
||
136 | * Commits the changes done inside of the transaction to the storage. |
||
137 | */ |
||
138 | public function commit() |
||
147 | |||
148 | |||
149 | /** |
||
150 | * Discards the changes done inside of the transaction. |
||
151 | */ |
||
152 | public function rollback() |
||
168 | } |
||
169 |