@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | $type = strtoupper(trim($type)); |
55 | 55 | $nolengthtypes = ['DATE', 'TINYBLOB', 'TINYTEXT', 'BLOB', 'TEXT', 'MEDIUMBLOB', |
56 | - 'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID']; |
|
56 | + 'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID']; |
|
57 | 57 | |
58 | 58 | $field[] = (is_int($length) || is_string($length) && count(explode(',', $length)) === 2) && !in_array($type, $nolengthtypes) |
59 | 59 | ? $type.'('. $length . ')' |
@@ -64,7 +64,7 @@ |
||
64 | 64 | 'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID']; |
65 | 65 | |
66 | 66 | $field[] = (is_int($length) || is_string($length) && count(explode(',', $length)) === 2) && !in_array($type, $nolengthtypes) |
67 | - ? $type.'('. $length . ')' |
|
67 | + ? $type.'('.$length.')' |
|
68 | 68 | : $type; |
69 | 69 | |
70 | 70 | if($attribute){ |
@@ -16,6 +16,9 @@ |
||
16 | 16 | */ |
17 | 17 | interface DeleteInterface extends StatementInterface{ |
18 | 18 | |
19 | + /** |
|
20 | + * @return void |
|
21 | + */ |
|
19 | 22 | public function from(); |
20 | 23 | public function where($val1, $val2, $operator = '=', $bind = true, $join = 'AND'):DeleteInterface; |
21 | 24 |
@@ -18,6 +18,10 @@ |
||
18 | 18 | |
19 | 19 | public function sql():string; |
20 | 20 | public function bindValues():array; |
21 | + |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
21 | 25 | public function execute(); |
22 | 26 | public function quote(string $str):string; |
23 | 27 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $from = $table; |
91 | 91 | |
92 | 92 | if($ref){ |
93 | - $from = sprintf('%s AS %s', $table, $ref);// @todo: index hint |
|
93 | + $from = sprintf('%s AS %s', $table, $ref); // @todo: index hint |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->from[$ref ?? $table] = $from; |
@@ -24,6 +24,10 @@ |
||
24 | 24 | protected $groupby = []; |
25 | 25 | |
26 | 26 | // -> *WhereTrait |
27 | + |
|
28 | + /** |
|
29 | + * @param string $operator |
|
30 | + */ |
|
27 | 31 | abstract protected function _addWhere($val1, $val2 = null, $operator = null, $bind = true, $join = 'AND'); |
28 | 32 | abstract protected function _openBracket($join = null); |
29 | 33 | abstract protected function _closeBracket(); |
@@ -29,8 +29,8 @@ |
||
29 | 29 | |
30 | 30 | $sql = 'SELECT '; |
31 | 31 | $sql .= $this->distinct ? 'DISTINCT ' : ''; |
32 | - $sql .= implode($glue , $this->cols).PHP_EOL; |
|
33 | - $sql .= !empty($this->from) ? 'FROM '.implode($glue , $this->from) : ''; |
|
32 | + $sql .= implode($glue, $this->cols).PHP_EOL; |
|
33 | + $sql .= !empty($this->from) ? 'FROM '.implode($glue, $this->from) : ''; |
|
34 | 34 | $sql .= $this->_getWhere(); |
35 | 35 | $sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : ''; |
36 | 36 | $sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : ''; |
@@ -25,6 +25,10 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | // -> *WhereTrait |
28 | + |
|
29 | + /** |
|
30 | + * @param string $operator |
|
31 | + */ |
|
28 | 32 | abstract protected function _addWhere($val1, $val2 = null, $operator = null, $bind = true, $join = 'AND'); |
29 | 33 | abstract protected function _openBracket($join = null); |
30 | 34 | abstract protected function _closeBracket(); |
@@ -16,8 +16,19 @@ |
||
16 | 16 | */ |
17 | 17 | interface UpdateInterface extends StatementInterface{ |
18 | 18 | |
19 | + /** |
|
20 | + * @return void |
|
21 | + */ |
|
19 | 22 | public function table(); |
23 | + |
|
24 | + /** |
|
25 | + * @return void |
|
26 | + */ |
|
20 | 27 | public function set(); |
28 | + |
|
29 | + /** |
|
30 | + * @return UpdateInterface |
|
31 | + */ |
|
21 | 32 | public function where($val1, $val2, $operator = '=', $bind = true, $join = 'AND'); |
22 | 33 | |
23 | 34 | } |
@@ -16,8 +16,15 @@ |
||
16 | 16 | */ |
17 | 17 | interface QueryTestInterface{ |
18 | 18 | |
19 | + /** |
|
20 | + * @return void |
|
21 | + */ |
|
19 | 22 | public function testInstance(); |
20 | 23 | public function testCreateDatabase(); |
24 | + |
|
25 | + /** |
|
26 | + * @return void |
|
27 | + */ |
|
21 | 28 | public function testCreateDatabaseNoName(); |
22 | 29 | |
23 | 30 | } |
@@ -35,8 +35,8 @@ |
||
35 | 35 | $sql = 'SELECT '; |
36 | 36 | $sql .= $this->limit ? 'FIRST ? SKIP ?' : ''; |
37 | 37 | $sql .= $this->distinct ? 'DISTINCT ' : ''; |
38 | - $sql .= implode($glue , $this->cols).PHP_EOL; |
|
39 | - $sql .= !empty($this->from) ? 'FROM '.implode($glue , $this->from) : ''; |
|
38 | + $sql .= implode($glue, $this->cols).PHP_EOL; |
|
39 | + $sql .= !empty($this->from) ? 'FROM '.implode($glue, $this->from) : ''; |
|
40 | 40 | $sql .= $this->_getWhere(); |
41 | 41 | $sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : ''; |
42 | 42 | $sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : ''; |