1 | <?php |
||
31 | abstract class StatementAbstract extends ObjectAbstract implements StatementInterface |
||
32 | { |
||
33 | use SettingsTrait, BuilderAwareTrait, PreviousTrait; |
||
34 | |||
35 | /** |
||
36 | * value bindings |
||
37 | * |
||
38 | * @var array |
||
39 | * @access protected |
||
40 | */ |
||
41 | protected $bindings; |
||
42 | |||
43 | /** |
||
44 | * Statement type, 'SELECT' etc. |
||
45 | * |
||
46 | * @var string |
||
47 | * @access protected |
||
48 | */ |
||
49 | protected $type = ''; |
||
50 | |||
51 | /** |
||
52 | * clause configs,[name => prefix] |
||
53 | * |
||
54 | * @var array |
||
55 | * @access protected |
||
56 | */ |
||
57 | protected $configs = []; |
||
58 | |||
59 | /** |
||
60 | * Constructor |
||
61 | * |
||
62 | * @param BuilderInterface $builder |
||
63 | * @access public |
||
64 | */ |
||
65 | public function __construct(BuilderInterface $builder) |
||
69 | |||
70 | /** |
||
71 | * {@inheritDoc} |
||
72 | */ |
||
73 | public function getStatement(array $settings = [])/*# : string */ |
||
92 | |||
93 | /** |
||
94 | * {@inheritDoc} |
||
95 | */ |
||
96 | public function getBindings()/*# : array */ |
||
100 | |||
101 | /** |
||
102 | * {@inheritDoc} |
||
103 | */ |
||
104 | public function __toString()/*# : string */ |
||
111 | |||
112 | /** |
||
113 | * Combine builder/statement and provided settings |
||
114 | * |
||
115 | * @param array $settings statement specific settings |
||
116 | * @return array |
||
117 | * @access protected |
||
118 | */ |
||
119 | protected function combineSettings(array $settings)/*# : array */ |
||
128 | |||
129 | /** |
||
130 | * Build SQL statement clauses |
||
131 | * |
||
132 | * @param array $settings |
||
133 | * @param string |
||
134 | * @access protected |
||
135 | */ |
||
136 | protected function buildSql(array $settings)/*# : string */ |
||
146 | |||
147 | /** |
||
148 | * Replace placeholders in the sql with '?', ':named' or real value |
||
149 | * |
||
150 | * @param string $sql |
||
151 | * @param array $settings |
||
152 | * @return string |
||
153 | * @access protected |
||
154 | */ |
||
155 | protected function bindValues(/*# string */ $sql, array $settings) |
||
164 | |||
165 | /** |
||
166 | * Set previous statement |
||
167 | * |
||
168 | * @param StatementInterface $stmt |
||
169 | * @return $this |
||
170 | * @access protected |
||
171 | */ |
||
172 | protected function setPrevous(StatementInterface $stmt) |
||
177 | } |
||
178 |