| 1 | <?php |
||
| 17 | abstract class Connector |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * The PDO connection options. |
||
| 21 | * |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | protected $options = array( |
||
| 25 | \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, |
||
| 26 | \PDO::ATTR_ORACLE_NULLS => \PDO::NULL_NATURAL, |
||
| 27 | \PDO::ATTR_STRINGIFY_FETCHES => false, |
||
| 28 | \PDO::ATTR_EMULATE_PREPARES => false, |
||
| 29 | ); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Establish a PDO database connection. |
||
| 33 | * |
||
| 34 | * @param array $config |
||
| 35 | * |
||
| 36 | * @return \PDO |
||
| 37 | */ |
||
| 38 | abstract public function connect(array $config); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the PDO connection options for the configuration. |
||
| 42 | * Developer specified options will override the default connection options. |
||
| 43 | * |
||
| 44 | * @param array $config |
||
| 45 | * |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | protected function options($config) |
||
| 54 | } |
||
| 55 |