1 | <?php |
||
31 | trait ClauseTrait |
||
32 | { |
||
33 | use QuoteTrait; |
||
34 | |||
35 | /** |
||
36 | * storage for clauses |
||
37 | * |
||
38 | * @var array |
||
39 | * @access protected |
||
40 | */ |
||
41 | protected $clause = []; |
||
42 | |||
43 | /** |
||
44 | * Is $str a raw sql string ? |
||
45 | * |
||
46 | * @param mixed $str |
||
47 | * @param bool $rawMode |
||
48 | * @access protected |
||
49 | */ |
||
50 | protected function isRaw($str, /*# bool */ $rawMode)/*# : bool */ |
||
62 | |||
63 | /** |
||
64 | * Quote an alias if not an int |
||
65 | * |
||
66 | * @param int|string $alias |
||
67 | * @param array $settings |
||
68 | * @return string |
||
69 | * @access protected |
||
70 | */ |
||
71 | protected function quoteAlias($alias, array $settings)/*# : string */ |
||
81 | |||
82 | /** |
||
83 | * Quote an item if it is a field/column |
||
84 | * |
||
85 | * @param string|StatementInterface $item |
||
86 | * @param array $settings |
||
87 | * @param bool $rawMode |
||
88 | * @access protected |
||
89 | */ |
||
90 | protected function quoteItem( |
||
103 | |||
104 | /** |
||
105 | * Quote object |
||
106 | * |
||
107 | * @param object $object |
||
108 | * @param array $settings |
||
109 | * @return string |
||
110 | * @access protected |
||
111 | */ |
||
112 | protected function quoteObject($object, $settings)/*# : string */ |
||
122 | |||
123 | /** |
||
124 | * Return specific clause part |
||
125 | * |
||
126 | * @param string $clauseName |
||
127 | * @param array |
||
128 | * @access protected |
||
129 | */ |
||
130 | protected function &getClause(/*# string */ $clauseName)/*# : array */ |
||
141 | |||
142 | /** |
||
143 | * Quote string even with space inside |
||
144 | * |
||
145 | * @param string $str |
||
146 | * @param string $prefix |
||
147 | * @param string $suffix |
||
148 | * @return string |
||
149 | * @access protected |
||
150 | */ |
||
151 | protected function quoteSpace( |
||
158 | |||
159 | /** |
||
160 | * Process value part in the clause |
||
161 | * |
||
162 | * @param mixed $value |
||
163 | * @param array $settings |
||
164 | * @return string |
||
165 | * @access protected |
||
166 | */ |
||
167 | protected function processValue( |
||
180 | |||
181 | /** |
||
182 | * Process value array |
||
183 | * |
||
184 | * @param array $value |
||
185 | * @param array $settings |
||
186 | * @return string |
||
187 | * @access protected |
||
188 | */ |
||
189 | protected function processValueArray( |
||
206 | |||
207 | /** |
||
208 | * Process scalar value |
||
209 | * |
||
210 | * @param mixed $value |
||
211 | * @return string |
||
212 | * @access protected |
||
213 | */ |
||
214 | protected function processValueScalar($value)/*# : string */ |
||
226 | |||
227 | /** |
||
228 | * Join a clause with prefix and its parts |
||
229 | * |
||
230 | * @param string $prefix |
||
231 | * @param string $seperator |
||
232 | * @param array $clause |
||
233 | * @param array $settings |
||
234 | * @return string |
||
235 | * @access protected |
||
236 | */ |
||
237 | protected function joinClause( |
||
251 | |||
252 | /** |
||
253 | * Build a generic clause |
||
254 | * |
||
255 | * @param string $clauseName |
||
256 | * @param string $clausePrefix |
||
257 | * @param array $settings |
||
258 | * @param array $clauseParts |
||
259 | * @return string |
||
260 | * @access protected |
||
261 | */ |
||
262 | protected function buildClause( |
||
278 | |||
279 | /** |
||
280 | * Reset settings to print flat |
||
281 | * |
||
282 | * @param array $settings |
||
283 | * @return array |
||
284 | * @access protected |
||
285 | */ |
||
286 | protected function flatSettings(array $settings)/*# : array */ |
||
293 | |||
294 | /** |
||
295 | * Return the builder |
||
296 | * |
||
297 | * @return BuilderInterface |
||
298 | * @access public |
||
299 | */ |
||
300 | abstract public function getBuilder()/*# : BuilderInterface */; |
||
301 | } |
||
302 |