1 | <?php |
||
32 | trait ClauseTrait |
||
33 | { |
||
34 | use QuoteTrait; |
||
35 | |||
36 | /** |
||
37 | * storage for clauses |
||
38 | * |
||
39 | * @var array |
||
40 | * @access protected |
||
41 | */ |
||
42 | protected $clause = []; |
||
43 | |||
44 | /** |
||
45 | * Is $str a raw sql string ? |
||
46 | * |
||
47 | * @param mixed $str |
||
48 | * @param bool $rawMode |
||
49 | * @access protected |
||
50 | */ |
||
51 | protected function isRaw($str, /*# bool */ $rawMode)/*# : bool */ |
||
63 | |||
64 | /** |
||
65 | * Quote an alias if not an int |
||
66 | * |
||
67 | * @param int|string $alias |
||
68 | * @param array $settings |
||
69 | * @return string |
||
70 | * @access protected |
||
71 | */ |
||
72 | protected function quoteAlias($alias, array $settings)/*# : string */ |
||
82 | |||
83 | /** |
||
84 | * Quote an item if it is a field/column |
||
85 | * |
||
86 | * @param string|StatementInterface $item |
||
87 | * @param array $settings |
||
88 | * @param bool $rawMode |
||
89 | * @access protected |
||
90 | */ |
||
91 | protected function quoteItem( |
||
106 | |||
107 | /** |
||
108 | * Quote object |
||
109 | * |
||
110 | * @param object $object |
||
111 | * @param array $settings |
||
112 | * @return string |
||
113 | * @access protected |
||
114 | */ |
||
115 | protected function quoteObject($object, $settings)/*# : string */ |
||
132 | |||
133 | /** |
||
134 | * Return specific clause part |
||
135 | * |
||
136 | * @param string $clauseName |
||
137 | * @param array |
||
138 | * @access protected |
||
139 | */ |
||
140 | protected function &getClause(/*# string */ $clauseName)/*# : array */ |
||
151 | |||
152 | /** |
||
153 | * Quote string even with space inside |
||
154 | * |
||
155 | * @param string $str |
||
156 | * @param string $prefix |
||
157 | * @param string $suffix |
||
158 | * @return string |
||
159 | * @access protected |
||
160 | */ |
||
161 | protected function quoteSpace( |
||
168 | |||
169 | /** |
||
170 | * Process value part in the clause |
||
171 | * |
||
172 | * @param mixed $value |
||
173 | * @param array $settings |
||
174 | * @return string |
||
175 | * @access protected |
||
176 | */ |
||
177 | protected function processValue( |
||
192 | |||
193 | /** |
||
194 | * Process value array |
||
195 | * |
||
196 | * @param array $value |
||
197 | * @param array $settings |
||
198 | * @return string |
||
199 | * @access protected |
||
200 | */ |
||
201 | protected function processValueArray( |
||
218 | |||
219 | /** |
||
220 | * Join a clause with prefix and its parts |
||
221 | * |
||
222 | * @param string $prefix |
||
223 | * @param string $seperator |
||
224 | * @param array $clause |
||
225 | * @param array $settings |
||
226 | * @return string |
||
227 | * @access protected |
||
228 | */ |
||
229 | protected function joinClause( |
||
243 | |||
244 | /** |
||
245 | * Build a generic clause |
||
246 | * |
||
247 | * @param string $clauseName |
||
248 | * @param string $clausePrefix |
||
249 | * @param array $settings |
||
250 | * @param array $clauseParts |
||
251 | * @return string |
||
252 | * @access protected |
||
253 | */ |
||
254 | protected function buildClause( |
||
270 | |||
271 | /** |
||
272 | * Return the builder |
||
273 | * |
||
274 | * @return BuilderInterface |
||
275 | * @access public |
||
276 | */ |
||
277 | abstract public function getBuilder()/*# : BuilderInterface */; |
||
278 | } |
||
279 |