1 | <?php |
||
18 | class PdoWriter implements Writer, FlushableWriter |
||
19 | { |
||
20 | /** |
||
21 | * @var \PDO |
||
22 | */ |
||
23 | protected $pdo; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $tableName; |
||
29 | |||
30 | /** |
||
31 | * @var \PDOStatement |
||
32 | */ |
||
33 | protected $statement; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $stack; |
||
39 | |||
40 | /** |
||
41 | * Note if your table name is a reserved word for your target DB you should quote it in the appropriate way e.g. |
||
42 | * for MySQL enclose the name in `backticks`. |
||
43 | * |
||
44 | * @param \PDO $pdo |
||
45 | * @param string $tableName |
||
46 | */ |
||
47 | 6 | public function __construct(\PDO $pdo, $tableName) |
|
56 | |||
57 | 4 | public function prepare() |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 4 | public function writeItem(array $item) |
|
83 | |||
84 | 2 | public function finish() |
|
90 | |||
91 | 2 | public function flush() |
|
106 | } |
||
107 |