MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
msql.class
Ir para a documentação deste ficheiro.
1<?php
2
7class MSQL
8{
12 var $db;
13
18
23
28
32 var $where;
33
38
43
48
52 var $join;
53
58
63
67 var $range;
68
72 var $bind;
73
78 public $limit;
79
84 public $offsetSQL;
85
91 private $newJoins = array();
92
94
109 function __construct($columns = '', $tables = '', $where = '', $orderBy = '', $groupBy = '', $having = '')
110 {
111 $this->clear();
112 $this->setColumns($columns);
113 $this->setTables($tables);
114 $this->setWhere($where);
115 $this->setGroupBy($groupBy);
116 $this->setHaving($having);
117 $this->setOrderBy($orderBy);
118 $this->join = null;
119 $this->parameters = null;
120 $this->range = null;
121 $this->db = null;
122 $this->bind = false;
123 $this->stmt = NULL;
124 }
125
136 private function getTokens1($string, &$array)
137 {
138 $tok = strtok($string, ",");
139
140 while ($tok)
141 {
142 $tok = trim($tok);
143 $array[$tok] = $tok;
144 $tok = strtok(",");
145 }
146 }
147
158 private function getTokens($string, &$array)
159 {
160 if ($string == '')
161 return;
162
163 // clear() seta todos os atributos como uma string vazia. Com isso, ao
164 // tentar utilizar a variável como um array, um warning é gerado.
165 // Em vez de corrigir o clear(), e provavelmente quebrar alguma coisa,
166 // achei melhor só garatir o tipo aqui.
167 if (!$array)
168 {
169 $array = array();
170 }
171
172 // Suporte a passagem de parametros como array no setColumns() e outros
173 if ( is_array($string) )
174 {
175 $string = implode(',', $string);
176 }
177
178 $source = str_split($string . ',');
179 $tok = '';
180 $l = count($source);
181 $can = 0;
182
183 for ($i = 0; $i < $l; $i++)
184 {
185 $c = $source[$i];
186
187 if (!$can)
188 {
189 if ($c == ',')
190 {
191 $tok = trim($tok);
192 $array[$tok] = $tok;
193 $tok = '';
194 }
195 else
196 {
197 $tok .= $c;
198 }
199 }
200 else
201 {
202 $tok .= $c;
203 }
204
205 if ($c == '(')
206 $can++;
207
208 if ($c == ')')
209 $can--;
210 }
211 }
212
220 private function getJoin()
221 {
222 global $MIOLO;
223 $MIOLO->Uses('database/' . $this->db->system . '/msqljoin.class');
224 $className = "{$this->db->system}SqlJoin";
225 $join = new $className();
226 $join->_sqlJoin($this);
227 }
228
238 function setDb($db)
239 {
240 $this->db = $db;
241
242 return $this;
243 }
244
255 function setColumns($string, $distinct = false)
256 {
257 $this->getTokens($string, $this->columns);
258 $this->distinct = $distinct;
259
260 return $this;
261 }
262
268 public function setColumnsOverride(array $columns)
269 {
270 return $this->clearColumns()->setColumns($columns);
271 }
272
273 public function clearColumns()
274 {
275 $this->columns = null;
276
277 return $this;
278 }
279
284 public function getColumns()
285 {
286 return $this->columns;
287 }
288
298 function setTables($string)
299 {
300 $this->getTokens($string, $this->tables);
301
302 $subSelect = strstr(strtoupper($string), 'SELECT ');
303 if ( $this->considerarTabelasSubSelects && $subSelect && empty($this->tables) ) {
304 $this->tables[$string] = $string;
305 }
306
307 return $this;
308 }
309
310 public function clearTables()
311 {
312 $this->tables = null;
313
314 return $this;
315 }
316
326 function setGroupBy($string)
327 {
328 $this->getTokens($string, $this->groupBy);
329
330 return $this;
331 }
332
333 public function clearGroupBy()
334 {
335 $this->groupBy = null;
336
337 return $this;
338 }
339
349 function setOrderBy($string)
350 {
351 $this->getTokens($string, $this->orderBy);
352
353 return $this;
354 }
355
356 public function getOrderBy()
357 {
358 return $this->orderBy;
359 }
360
361 public function clearOrderBy()
362 {
363 $this->orderBy = null;
364
365 return $this;
366 }
367
374 public function addEqualCondition($column, $value)
375 {
376 $this->setWhere($column . ' = ?', array($value));
377
378 return $this;
379 }
380
381 public function addNotEqualCondition($column, $value)
382 {
383 $this->setWhere($column . ' <> ?', array($value));
384
385 return $this;
386 }
387
388 public function addBetweenCondition($column, $value1, $value2)
389 {
390 $this->setWhere($column . ' BETWEEN ? AND ?', array($value1, $value2));
391
392 return $this;
393 }
394
395 public function addGreaterCondition($column, $value)
396 {
397 $this->setWhere($column . ' > ?', array($value));
398
399 return $this;
400 }
401
402 public function addGreaterEqualCondition($column, $value)
403 {
404 $this->setWhere($column . ' >= ?', array($value));
405
406 return $this;
407 }
408
409 public function addSmallerCondition($column, $value)
410 {
411 $this->setWhere($column . ' < ?', array($value));
412
413 return $this;
414 }
415
416 public function addSmallerEqualCondition($column, $value)
417 {
418 $this->setWhere($column . ' <= ?', array($value));
419
420 return $this;
421 }
422
423 public function addNotIlikeCondition($column, $value)
424 {
425 $this->setWhere($column . ' NOT ILIKE ?', array($value));
426
427 return $this;
428 }
429
430 public function addNotLikeCondition($column, $value)
431 {
432 $this->setWhere($column . ' NOT LIKE ?', array($value));
433
434 return $this;
435 }
436
437 public function addLikeCondition($column, $value)
438 {
439 $this->setWhere($column . ' LIKE ?', array($value));
440
441 return $this;
442 }
443
444 public function addLikeConditionUnaccent($column, $value)
445 {
446 $this->setWhere('UNACCENT(' . $column . ') LIKE UNACCENT(?)', array($value));
447
448 return $this;
449 }
450
451 public function addIlikeCondition($column, $value)
452 {
453 $this->setWhere($column . ' ILIKE ?', array($value));
454
455 return $this;
456 }
457
458 public function addIlikeConditionUnaccent($column, $value)
459 {
460 $this->setWhere('UNACCENT(' . $column . ') ILIKE UNACCENT(?)', array($value));
461
462 return $this;
463 }
464
465 public function addWhereIn($column, array $values)
466 {
467 $this->setWhere($column . ' IN ' . $this->convertArrayToIn($values));
468
469 return $this;
470 }
471
472 public function addWhereNotIn($column, array $values)
473 {
474 $this->setWhere($column . ' NOT IN ' . $this->convertArrayToIn($values));
475
476 return $this;
477 }
478
489 public function setWhere($string, array $parameters = null)
490 {
491 $this->where .= (($this->where != '') && ($string != '') ? " and " : "") . $string;
492
493 foreach ( (array) $parameters as $pValue )
494 {
495 $this->addParameter($pValue);
496 }
497
498 return $this;
499 }
500
505 public function getWhere()
506 {
507 return $this->where;
508 }
509
520 function setWhereAnd($string, array $parameters = null)
521 {
522 $this->where .= (($this->where != '') && ($string != '') ? " and " : "") . $string;
523
524 if ( $parameters )
525 {
526 foreach ( $parameters as $pValue )
527 {
528 $this->addParameter($pValue);
529 }
530 }
531
532 return $this;
533 }
534
545 function setWhereOr($string, array $parameters = null)
546 {
547 $this->where .= (($this->where != '') && ($string != '') ? " or " : "") . $string;
548
549 foreach ( $parameters as $pValue )
550 {
551 $this->addParameter($pValue);
552 }
553
554 return $this;
555 }
556
557 public function getLimit()
558 {
559 return $this->limit;
560 }
561
562 public function setLimit($limit)
563 {
564 if ( is_numeric($limit) || strlen($limit) == 0 )
565 {
566 $this->limit = $limit;
567 }
568
569 return $this;
570 }
571
572 public function clearLimit()
573 {
574 $this->limit = null;
575
576 return $this;
577 }
578
579 public function getOffsetSQL()
580 {
581 return $this->offsetSQL;
582 }
583
584 public function setOffsetSQL($offsetSQL)
585 {
586 if ( is_numeric($offsetSQL) || strlen($offsetSQL) == 0 )
587 {
588 $this->offsetSQL = $offsetSQL;
589 }
590
591 return $this;
592 }
593
594 public function clearOffsetSQL()
595 {
596 $this->offsetSQL = null;
597
598 return $this;
599 }
600
610 function setHaving($string)
611 {
612 $this->having .= (($this->having != '') && ($string != '') ? " and " : "") . $string;
613
614 return $this;
615 }
616
626 function setHavingAnd($string)
627 {
628 $this->having .= (($this->having != '') && ($string != '') ? " and " : "") . $string;
629
630 return $this;
631 }
632
642 function setHavingOr($string)
643 {
644 $this->having .= (($this->having != '') && ($string != '') ? " or " : "") . $string;
645
646 return $this;
647 }
648
661 function setJoin($table1, $table2, $cond, $type = 'INNER')
662 {
663 $this->join[] = array
664 (
665 $table1,
666 $table2,
667 $cond,
668 $type
669 );
670
671 return $this;
672 }
673
685 function setLeftJoin($table1, $table2, $cond)
686 {
687 $this->SetJoin($table1, $table2, $cond, 'LEFT');
688
689 return $this;
690 }
691
703 function setRightJoin($table1, $table2, $cond)
704 {
705 $this->SetJoin($table1, $table2, $cond, 'RIGHT');
706
707 return $this;
708 }
709
719 function bind($parameters = null)
720 {
721 $this->bind = true;
722 $this->SetParameters($parameters);
723 }
724
734 function prepare($parameters = null)
735 {
736 global $MIOLO;
737
738 if ($this->bind)
739 return;
740
741 if (!$parameters)
742 return;
743
744 if (!is_array($parameters))
745 {
746 $parameters = array($parameters);
747 }
748
749 $prepared = '';
750 $sqlText = $this->command;
751 $i = 0;
752
753 while (true)
754 {
755 $pos = strpos($sqlText, '?');
756
757 if ($pos == false)
758 {
759 $prepared .= $sqlText;
760 break;
761 }
762 else
763 {
764 if ($pos > 0)
765 {
766 $prepared .= substr($sqlText, 0, $pos);
767 }
768
769 $value = $parameters[ $i++ ];
770
771 if ( substr($value, 0, 1) == ':' )
772 {
773 $prepared .= substr($value, 1);
774 }
775 else if ( $value instanceof MSQLExpr )
776 {
777 $prepared .= $value->getValue();
778 }
779 else if ( is_array($value) )
780 {
781 $prepared .= $this->convertArrayToIn($value);
782 }
783 else
784 {
789 $prepared .= is_null( $p = $value ) ? 'NULL' : "'" . str_replace('\\', '\\\\', str_replace("'", "''", $p)) . "'";
790 //$prepared .= "'" . addslashes($parameters[$i++]) . "'";
791 }
792
793 $sqlText = substr($sqlText, $pos + 1);
794 }
795 }
796
797 $MIOLO->Assert($i == count($parameters), "SQL PREPARE: Parâmetros inconsistentes! SQL: $sqlText");
798 $this->command = $prepared;
799 return $prepared;
800 }
801
810 public static function deleteTable($tableName, array $where)
811 {
812 $msql = new MSQL();
813 $msql->setTables($tableName);
814
815 foreach ( $where as $column => $value )
816 {
817 $msql->addEqualCondition($column, $value);
818 }
819
820 return $msql->delete();
821 }
822
831 public static function insertTable($tableName, array $values)
832 {
833 $msql = new MSQL();
834 $msql->setColumns( array_keys($values) );
835 $msql->setParameters( array_values($values) );
836 $msql->setTables($tableName);
837
838 return $msql->insert();
839 }
840
850 public static function updateTable($tableName, array $values, array $where)
851 {
852 $msql = new MSQL();
853 $msql->setColumns( array_keys($values) );
854 $msql->setParameters( array_values($values) );
855 $msql->setTables($tableName);
856
857 foreach ( $where as $key => $val )
858 {
859 $msql->addEqualCondition($key, $val);
860 }
861
862 return $msql->update();
863 }
864
877 public function insert($parameters = null)
878 {
879 $sqlText = 'INSERT INTO ' . implode($this->tables, ',') . ' ( ' . implode($this->columns, ',') . ' ) VALUES ( ';
880
881 for ($i = 0; $i < count($this->columns); $i++)
882 $par[] = '?';
883
884 $sqlText .= implode($par, ',') . ' )';
885 $this->command = $sqlText;
886
887 if (isset($parameters))
888 $this->setParameters($parameters);
889
890 $this->prepare($this->parameters);
891 return $this->command;
892 }
893
903 function insertFrom($sql)
904 {
905 $sqlText = 'INSERT INTO ' . implode($this->tables, ',') . ' ( ' . implode($this->columns, ',') . ' ) ';
906 $sqlText .= $sql;
907 $this->command = $sqlText;
908 return $this->command;
909 }
910
920 public function delete($parameters = null)
921 {
922 global $MIOLO;
923 $sqlText = 'DELETE FROM ' . implode($this->tables, ',');
924 $MIOLO->Assert($this->where != '', "SQL DELETE: Condição não informada!");
925 $sqlText .= ' WHERE ' . $this->where;
926 $this->command = $sqlText;
927
928 if (isset($parameters))
929 $this->SetParameters($parameters);
930
931 $this->Prepare($this->parameters);
932 return $this->command;
933 }
934
946 public function update($parameters = null, array $values = null)
947 {
948 global $MIOLO;
949 $sqlText = 'UPDATE ' . implode($this->tables, ',') . ' SET ';
950
951 foreach ($this->columns as $c)
952 $par[] = $c . '= ?';
953
954 $sqlText .= implode($par, ',');
955 $MIOLO->Assert($this->where != '', "SQL UPDATE: Condição não informada!");
956 $sqlText .= ' WHERE ' . $this->where;
957 $this->command = $sqlText;
958
959 if (isset($parameters))
960 $this->SetParameters($parameters);
961
962 $this->Prepare($this->parameters);
963 return $this->command;
964 }
965
975 function select($parameters = null)
976 {
977 if ($this->join != NULL)
978 $this->getJoin();
979
980 //$this->join != null ? die(var_export( $this->join )) : 'batata';
981 $sqlText = 'SELECT ' . ($this->distinct ? 'DISTINCT ' : '') . implode($this->columns, ',');
982
983 if ($this->tables != '')
984 {
985 $sqlText .= ' FROM ' . implode($this->tables, ',') . ' ' . $this->getNewJoinsSQL();
986 }
987
988 if ($this->where != '')
989 {
990 $sqlText .= ' WHERE ' . $this->where;
991 }
992
993 if ($this->groupBy != '')
994 {
995 $sqlText .= ' GROUP BY ' . implode($this->groupBy, ',');
996 }
997
998 if ($this->having != '')
999 {
1000 $sqlText .= ' HAVING ' . $this->having;
1001 }
1002
1003 if ($this->orderBy != '')
1004 {
1005 $sqlText .= ' ORDER BY ' . implode($this->orderBy, ',');
1006 }
1007
1008 if ($this->limit != '')
1009 {
1010 $sqlText .= ' LIMIT ' . $this->limit;
1011 }
1012
1013 if ($this->offsetSQL != '')
1014 {
1015 $sqlText .= ' OFFSET ' . $this->offsetSQL;
1016 }
1017
1018 $this->command = $sqlText;
1019
1020 if (isset($parameters))
1021 $this->SetParameters($parameters);
1022
1023 $this->Prepare($this->parameters);
1024 return $this->command;
1025 }
1026
1030 public function selectCount()
1031 {
1032 $new = clone($this);
1033 $new instanceof MSQL;
1034 $new->clearColumns()
1035 ->clearGroupBy()
1036 ->clearOrderBy()
1037 ->clearLimit()
1038 ->clearOffsetSQL()
1039 ->setColumns('COUNT(*)');
1040
1041 return $new->select();
1042 }
1043
1051 function clear()
1052 {
1053 $this->columns = '';
1054 $this->tables = '';
1055 $this->where = '';
1056 $this->groupBy = '';
1057 $this->having = '';
1058 $this->orderBy = '';
1059 $this->parameters = null;
1060 $this->command = '';
1061 }
1062
1070 public function setParameters()
1071 {
1072 $numargs = func_num_args();
1073
1074 if ($numargs == 1)
1075 {
1076 if (!is_array($parameters = func_get_arg(0)))
1077 {
1078 if ($parameters == null)
1079 return;
1080
1081 $parameters = array($parameters);
1082 }
1083 }
1084 else
1085 {
1086 $parameters = func_get_args();
1087 }
1088
1089 foreach ( (array) $parameters as $parameter )
1090 {
1091 $this->addParameter($parameter);
1092 }
1093
1094 return $this;
1095 }
1096
1097
1098
1108 public function addParameter($value)
1109 {
1110 $this->parameters[] = $value;
1111 }
1112
1120 function setRange()
1121 {
1122 $numargs = func_num_args();
1123
1124 if ($numargs == 1)
1125 {
1126 $this->range = func_get_arg(0);
1127 }
1128 elseif ($numargs == 2)
1129 {
1130 $page = func_get_arg(0);
1131 $rows = func_get_arg(1);
1132 $this->range = new QueryRange($page, $rows);
1133 }
1134
1135 return $this;
1136 }
1137
1145 function setOffset($offset, $rows)
1146 {
1147 if (!$this->range)
1148 {
1149 $this->range = new MQueryRange(0,0);
1150 }
1151 $this->range->offset = $offset;
1152 $this->range->rows = $rows;
1153
1154 return $this;
1155 }
1156
1167 function findStr($target, $source)
1168 {
1169 $fim = false;
1170 $pos = 0;
1171
1172 $split = preg_split('/(\‍(|\‍))/i', $source, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
1173 $parenteses = 0;
1174 foreach ($split as $key=>$s)
1175 {
1176 if ( $s == '(' ) //Identifica se há parenteses para que não pesquise em subconsultas
1177 {
1178 $parenteses++;
1179 }
1180
1181 if ($parenteses == 0 ) //significa que está na raiz e não dentro de parenteses
1182 {
1183 if ( preg_match('/' . preg_quote($target) . '/', $s) )
1184 {
1185 $pos += mb_strpos($s, $target);
1186
1187 $fim = true;
1188 break; //quando encontra o target na raiz para o laço e retorna a posição do target
1189 }
1190 }
1191
1192 if ( $s == ')' ) //Identifica o fechamento do parenteses para que volte a pesquisar na raiz
1193 {
1194 $parenteses--;
1195 }
1196
1197 $pos += mb_strlen($s); //Mantem a posição atualizada
1198 }
1199
1200 return ($fim ? $pos : -1);
1201 }
1202
1214 function parseSqlCommand(&$cmd, $clause, $delimiters)
1215 {
1216 if (mb_substr($cmd, 0, mb_strlen($clause)) != $clause)
1217 return false;
1218
1219 $cmd = mb_substr($cmd, mb_strlen($clause));
1220 $n = count($delimiters);
1221 $i = 0;
1222 $pos = -1;
1223
1224 while (($pos < 0) && ($i < $n))
1225 $pos = $this->FindStr($delimiters[$i++], $cmd);
1226
1227 if ($pos > 0)
1228 {
1229 $r = mb_substr($cmd, 0, $pos);
1230 $cmd = mb_substr($cmd, $pos);
1231 }
1232
1233 return $r;
1234 }
1235
1245 function createFrom($sqltext, $params=array())
1246 {
1247 $this->command = $sqltext;
1248 $this->setParameters($params);
1249 $sqltext = trim($sqltext) . " #";
1250 $sqltext = preg_replace("/(?i)select /", "select ", $sqltext);
1251 $sqltext = preg_replace("/(?i) from /", " from ", $sqltext);
1252 $sqltext = preg_replace("/(?i) where /", " where ", $sqltext);
1253 $sqltext = preg_replace("/(?i) order by /", " order by ", $sqltext);
1254 $sqltext = preg_replace("/(?i) group by /", " group by ", $sqltext);
1255 $sqltext = preg_replace("/(?i) having /", " having ", $sqltext);
1256 $this->SetColumns($this->ParseSqlCommand($sqltext, "select", array("from")));
1257
1258 if ($this->FindStr('JOIN', $sqltext) < 0)
1259 {
1260 $this->SetTables($this->ParseSqlCommand($sqltext, "from", array("where", "group by", "order by", "#")));
1261 }
1262 else
1263 {
1264 $this->join = $this->ParseSqlCommand($sqltext, "from", array("where", "group by", "order by", "#"));
1265 }
1266
1267 $this->SetWhere($this->ParseSqlCommand($sqltext, "where", array("group by", "order by", "#")));
1268 $this->SetGroupBy($this->ParseSqlCommand($sqltext, "group by", array("having", "order by", "#")));
1269 $this->SetHaving($this->ParseSqlCommand($sqltext, "having", array("order by", "#")));
1270 $this->SetOrderBy($this->ParseSqlCommand($sqltext, "order by", array("#")));
1271
1272 return $this;
1273 }
1274
1281 public function addInnerJoin($table, $cond)
1282 {
1283 $join = new MSQLNewJoin();
1284 $join->setTable($table)->setType(MSQLNewJoin::TYPE_INNER)->setCondition($cond);
1285 $this->addNewJoin($join);
1286
1287 return $this;
1288 }
1289
1296 public function addLeftJoin($table, $cond)
1297 {
1298 $join = new MSQLNewJoin();
1299 $join->setTable($table)->setType(MSQLNewJoin::TYPE_LEFT)->setCondition($cond);
1300 $this->addNewJoin($join);
1301
1302 return $this;
1303 }
1304
1309 public function getNewJoins()
1310 {
1311 return $this->newJoins;
1312 }
1313
1314 private function setNewJoins(array $newJoins)
1315 {
1316 $this->newJoins = $newJoins;
1317 }
1318
1319 private function addNewJoin(MSQLNewJoin $join)
1320 {
1321 $this->newJoins[] = $join;
1322 }
1323
1327 private function getNewJoinsSQL()
1328 {
1329 $out = '';
1330
1331 foreach ( $this->getNewJoins() as $join )
1332 {
1333 $join instanceof MSQLNewJoin;
1334
1335 $out .= ' ' . $join->generateSQL();
1336 }
1337
1338 return $out;
1339 }
1340
1344 public function convertArrayToIn(array $values = null)
1345 {
1346 $out = array();
1347
1348 foreach ( $values as $value )
1349 {
1350 if ( $value instanceof MSQLExpr )
1351 {
1352 $out[] = $value;
1353 }
1354 else
1355 {
1356 $out[] = "'" . str_replace("'", "''", $value) . "'";
1357 }
1358 }
1359
1360 return '(' . implode(', ', $out) . ')';
1361 }
1362}
1363
1368{
1369 private $value;
1370
1371 public function __construct($value)
1372 {
1373 $this->value = $value;
1374 }
1375
1376 public function getValue()
1377 {
1378 return $this->value;
1379 }
1380
1381 public function setValue($value)
1382 {
1383 $this->value = $value;
1384 }
1385}
1386
1388{
1389 const TYPE_INNER = 'INNER';
1390 const TYPE_LEFT = 'LEFT';
1391
1392 private $table;
1393
1394 private $type;
1395
1396 private $condition;
1397
1398 public function getTable()
1399 {
1400 return $this->table;
1401 }
1402
1403 public function setTable($table)
1404 {
1405 $this->table = $table;
1406
1407 return $this;
1408 }
1409
1410 public function getType()
1411 {
1412 return $this->type;
1413 }
1414
1415 public function setType($type)
1416 {
1417 $this->type = $type;
1418
1419 return $this;
1420 }
1421
1422 public function getCondition()
1423 {
1424 return $this->condition;
1425 }
1426
1427 public function setCondition($condition)
1428 {
1429 $this->condition = $condition;
1430
1431 return $this;
1432 }
1433
1438 public function generateSQL()
1439 {
1440 return $this->getType() . ' JOIN ' . $this->getTable() . ' ON ' . $this->getCondition();
1441 }
1442}
1443?>
setValue($value)
Definição msql.class:1381
__construct($value)
Definição msql.class:1371
getValue()
Definição msql.class:1376
const TYPE_INNER
Definição msql.class:1389
getCondition()
Definição msql.class:1422
setCondition($condition)
Definição msql.class:1427
setTable($table)
Definição msql.class:1403
const TYPE_LEFT
Definição msql.class:1390
setType($type)
Definição msql.class:1415
Definição msql.class:8
setParameters()
Definição msql.class:1070
setWhereAnd($string, array $parameters=null)
Definição msql.class:520
clearTables()
Definição msql.class:310
addIlikeCondition($column, $value)
Definição msql.class:451
setOffsetSQL($offsetSQL)
Definição msql.class:584
prepare($parameters=null)
Definição msql.class:734
$columns
Definição msql.class:22
setColumnsOverride(array $columns)
Definição msql.class:268
$db
Definição msql.class:12
bind($parameters=null)
Definição msql.class:719
$having
Definição msql.class:42
setOrderBy($string)
Definição msql.class:349
addSmallerCondition($column, $value)
Definição msql.class:409
setWhere($string, array $parameters=null)
Definição msql.class:489
setLeftJoin($table1, $table2, $cond)
Definição msql.class:685
addInnerJoin($table, $cond)
Definição msql.class:1281
createFrom($sqltext, $params=array())
Definição msql.class:1245
$orderBy
Definição msql.class:47
addEqualCondition($column, $value)
Definição msql.class:374
addNotIlikeCondition($column, $value)
Definição msql.class:423
$tables
Definição msql.class:27
addNotLikeCondition($column, $value)
Definição msql.class:430
addSmallerEqualCondition($column, $value)
Definição msql.class:416
update($parameters=null, array $values=null)
Definição msql.class:946
addGreaterEqualCondition($column, $value)
Definição msql.class:402
static deleteTable($tableName, array $where)
Definição msql.class:810
getOffsetSQL()
Definição msql.class:579
$join
Definição msql.class:52
addWhereIn($column, array $values)
Definição msql.class:465
getColumns()
Definição msql.class:284
addLikeConditionUnaccent($column, $value)
Definição msql.class:444
setRange()
Definição msql.class:1120
getNewJoins()
Definição msql.class:1309
getOrderBy()
Definição msql.class:356
insert($parameters=null)
Definição msql.class:877
setTables($string)
Definição msql.class:298
clearOrderBy()
Definição msql.class:361
setRightJoin($table1, $table2, $cond)
Definição msql.class:703
__construct($columns='', $tables='', $where='', $orderBy='', $groupBy='', $having='')
Definição msql.class:109
addParameter($value)
Definição msql.class:1108
static insertTable($tableName, array $values)
Definição msql.class:831
setDb($db)
Definição msql.class:238
addIlikeConditionUnaccent($column, $value)
Definição msql.class:458
$command
Definição msql.class:62
$offsetSQL
Definição msql.class:84
setJoin($table1, $table2, $cond, $type='INNER')
Definição msql.class:661
static updateTable($tableName, array $values, array $where)
Definição msql.class:850
select($parameters=null)
Definição msql.class:975
clear()
Definição msql.class:1051
setOffset($offset, $rows)
Definição msql.class:1145
$bind
Definição msql.class:72
setHaving($string)
Definição msql.class:610
$considerarTabelasSubSelects
Definição msql.class:93
convertArrayToIn(array $values=null)
Definição msql.class:1344
$parameters
Definição msql.class:57
clearOffsetSQL()
Definição msql.class:594
setWhereOr($string, array $parameters=null)
Definição msql.class:545
setColumns($string, $distinct=false)
Definição msql.class:255
addWhereNotIn($column, array $values)
Definição msql.class:472
addGreaterCondition($column, $value)
Definição msql.class:395
$range
Definição msql.class:67
setGroupBy($string)
Definição msql.class:326
setHavingAnd($string)
Definição msql.class:626
clearGroupBy()
Definição msql.class:333
findStr($target, $source)
Definição msql.class:1167
clearLimit()
Definição msql.class:572
$distinct
Definição msql.class:17
addBetweenCondition($column, $value1, $value2)
Definição msql.class:388
selectCount()
Definição msql.class:1030
parseSqlCommand(&$cmd, $clause, $delimiters)
Definição msql.class:1214
$where
Definição msql.class:32
getWhere()
Definição msql.class:505
addLeftJoin($table, $cond)
Definição msql.class:1296
clearColumns()
Definição msql.class:273
insertFrom($sql)
Definição msql.class:903
getLimit()
Definição msql.class:557
setHavingOr($string)
Definição msql.class:642
$limit
Definição msql.class:78
addLikeCondition($column, $value)
Definição msql.class:437
setLimit($limit)
Definição msql.class:562
addNotEqualCondition($column, $value)
Definição msql.class:381
$groupBy
Definição msql.class:37