1 | <?php |
||
7 | abstract class AbstractSchemaSource implements SchemaSourceInterface |
||
8 | { |
||
9 | /** |
||
10 | * Default schema name |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $schema; |
||
14 | |||
15 | |||
16 | /** |
||
17 | * Schema signature |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $schemaSignature; |
||
21 | |||
22 | |||
23 | /** |
||
24 | * @var AdapterInterface |
||
25 | */ |
||
26 | protected $adapter; |
||
27 | |||
28 | /** |
||
29 | * Constructor |
||
30 | * |
||
31 | * @param AdapterInterface $adapter |
||
32 | * @param string|null $schema default schema, taken from adapter if not given |
||
33 | * @throws Exception\InvalidArgumentException for invalid connection |
||
34 | * @throws Exception\InvalidUsageException thrown if no schema can be found. |
||
35 | */ |
||
36 | 23 | public function __construct(AdapterInterface $adapter, $schema = null) |
|
49 | |||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | 1 | public function getColumns($table) |
|
58 | |||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | 1 | public function getTableInformation($table) |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 1 | public function getTables() |
|
76 | |||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 1 | public function hasTable($table) |
|
86 | |||
87 | /** |
||
88 | * Check whether a table parameter is valid and exists |
||
89 | * |
||
90 | * @throws Exception\InvalidArgumentException |
||
91 | * @throws Exception\ErrorException |
||
92 | * @throws Exception\ExceptionInterface |
||
93 | * @throws Exception\TableNotFoundException |
||
94 | * |
||
95 | * @param string $table |
||
96 | * @return AbstractSource |
||
97 | */ |
||
98 | protected function validateTable($table) |
||
106 | |||
107 | |||
108 | /** |
||
109 | * Check whether a schema parameter is valid |
||
110 | * |
||
111 | * @throws Exception\InvalidArgumentException |
||
112 | |||
113 | * @param string $schema |
||
114 | * @return AbstractSource |
||
115 | */ |
||
116 | 23 | protected function validateSchema($schema) |
|
123 | |||
124 | /** |
||
125 | * Set default schema |
||
126 | * |
||
127 | * @throws Exception\InvalidArgumentException |
||
128 | * @param string $schema |
||
129 | * @return AbstractSource |
||
130 | */ |
||
131 | 23 | protected function setDefaultSchema($schema) |
|
137 | |||
138 | /** |
||
139 | * |
||
140 | * @param string $table |
||
141 | * @throws Exception\InvalidArgumentException |
||
142 | */ |
||
143 | 16 | protected function checkTableArgument($table = null) |
|
151 | |||
152 | /** |
||
153 | * Return current schema signature for caching |
||
154 | * |
||
155 | * @return void |
||
156 | */ |
||
157 | 23 | protected function setSchemaSignature() |
|
163 | } |
||
164 |