| 1 | <?php |
||
| 30 | class PDOStorage extends SQLStorage |
||
| 31 | { |
||
| 32 | /** |
||
| 33 | * return the name of the storage type |
||
| 34 | * |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | public function getName() |
||
| 38 | { |
||
| 39 | return "pdo"; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Connects to the DB. |
||
| 44 | * |
||
| 45 | * @param array|string $config |
||
| 46 | * @throws Klarna_DatabaseException |
||
| 47 | * |
||
| 48 | * @return void |
||
| 49 | */ |
||
| 50 | public function connect($config) |
||
| 51 | { |
||
| 52 | if(is_array($config) && $config['pdo'] instanceof PDO) { |
||
| 53 | $this->pdo = $config['pdo']; |
||
| 54 | $this->dbTable = $config['table']; |
||
| 55 | } else { |
||
| 56 | throw new Klarna_DatabaseException('URI is invalid! Missing field or invalid characters used!'); |
||
| 57 | } |
||
| 58 | } |
||
| 59 | } |
||
| 60 |