@@ -194,7 +194,7 @@ |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | - * @param PartitionDefinition|PartitionDefinition[] $component the component to be built |
|
| 197 | + * @param PartitionDefinition[] $component the component to be built |
|
| 198 | 198 | * @param array $options parameters for building |
| 199 | 199 | * |
| 200 | 200 | * @return string |
@@ -202,18 +202,18 @@ |
||
| 202 | 202 | public static function build($component, array $options = array()) |
| 203 | 203 | { |
| 204 | 204 | if (is_array($component)) { |
| 205 | - return "(\n".implode(",\n", $component)."\n)"; |
|
| 205 | + return "(\n" . implode(",\n", $component) . "\n)"; |
|
| 206 | 206 | } else { |
| 207 | 207 | if ($component->isSubpartition) { |
| 208 | - return trim('SUBPARTITION '.$component->name.' '.$component->options); |
|
| 208 | + return trim('SUBPARTITION ' . $component->name . ' ' . $component->options); |
|
| 209 | 209 | } else { |
| 210 | 210 | $subpartitions = empty($component->subpartitions) |
| 211 | - ? '' : ' '.self::build($component->subpartitions); |
|
| 211 | + ? '' : ' ' . self::build($component->subpartitions); |
|
| 212 | 212 | |
| 213 | 213 | return trim( |
| 214 | - 'PARTITION '.$component->name |
|
| 215 | - .(empty($component->type) ? '' : ' VALUES '.$component->type.' '.$component->expr.' ') |
|
| 216 | - .$component->options.$subpartitions |
|
| 214 | + 'PARTITION ' . $component->name |
|
| 215 | + .(empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ') |
|
| 216 | + .$component->options . $subpartitions |
|
| 217 | 217 | ); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -52,15 +52,15 @@ |
||
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | 54 | public static $CLAUSES = array( |
| 55 | - 'UPDATE' => array('UPDATE', 2), |
|
| 55 | + 'UPDATE' => array('UPDATE', 2), |
|
| 56 | 56 | // Used for options. |
| 57 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 57 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 58 | 58 | // Used for updated tables. |
| 59 | - '_UPDATE' => array('UPDATE', 1), |
|
| 60 | - 'SET' => array('SET', 3), |
|
| 61 | - 'WHERE' => array('WHERE', 3), |
|
| 62 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 63 | - 'LIMIT' => array('LIMIT', 3), |
|
| 59 | + '_UPDATE' => array('UPDATE', 1), |
|
| 60 | + 'SET' => array('SET', 3), |
|
| 61 | + 'WHERE' => array('WHERE', 3), |
|
| 62 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 63 | + 'LIMIT' => array('LIMIT', 3), |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -143,8 +143,8 @@ |
||
| 143 | 143 | $tmp[] = $altered::build($altered); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - return 'ALTER '.OptionsArray::build($this->options) |
|
| 147 | - .' '.Expression::build($this->table) |
|
| 148 | - .' '.implode(', ', $tmp); |
|
| 146 | + return 'ALTER ' . OptionsArray::build($this->options) |
|
| 147 | + .' ' . Expression::build($this->table) |
|
| 148 | + .' ' . implode(', ', $tmp); |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -87,15 +87,15 @@ |
||
| 87 | 87 | */ |
| 88 | 88 | public function build() |
| 89 | 89 | { |
| 90 | - $ret = 'REPLACE '.$this->options |
|
| 91 | - .' INTO '.$this->into; |
|
| 90 | + $ret = 'REPLACE ' . $this->options |
|
| 91 | + .' INTO ' . $this->into; |
|
| 92 | 92 | |
| 93 | 93 | if ($this->values != null && count($this->values) > 0) { |
| 94 | - $ret .= ' VALUES '.Array2d::build($this->values); |
|
| 94 | + $ret .= ' VALUES ' . Array2d::build($this->values); |
|
| 95 | 95 | } elseif ($this->set != null && count($this->set) > 0) { |
| 96 | - $ret .= ' SET '.SetOperation::build($this->set); |
|
| 96 | + $ret .= ' SET ' . SetOperation::build($this->set); |
|
| 97 | 97 | } elseif ($this->select != null && strlen($this->select) > 0) { |
| 98 | - $ret .= ' '.$this->select->build(); |
|
| 98 | + $ret .= ' ' . $this->select->build(); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $ret; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function build() |
| 36 | 36 | { |
| 37 | 37 | // Building the parsed part of the query (if any). |
| 38 | - $query = parent::build().' '; |
|
| 38 | + $query = parent::build() . ' '; |
|
| 39 | 39 | |
| 40 | 40 | // Rebuilding the unknown part from tokens. |
| 41 | 41 | foreach ($this->unknown as $token) { |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | * @var array |
| 68 | 68 | */ |
| 69 | 69 | public static $CLAUSES = array( |
| 70 | - 'DELETE' => array('DELETE', 2), |
|
| 70 | + 'DELETE' => array('DELETE', 2), |
|
| 71 | 71 | // Used for options. |
| 72 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 73 | - 'FROM' => array('FROM', 3), |
|
| 74 | - 'PARTITION' => array('PARTITION', 3), |
|
| 75 | - 'USING' => array('USING', 3), |
|
| 76 | - 'WHERE' => array('WHERE', 3), |
|
| 77 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 78 | - 'LIMIT' => array('LIMIT', 3), |
|
| 72 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 73 | + 'FROM' => array('FROM', 3), |
|
| 74 | + 'PARTITION' => array('PARTITION', 3), |
|
| 75 | + 'USING' => array('USING', 3), |
|
| 76 | + 'WHERE' => array('WHERE', 3), |
|
| 77 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 78 | + 'LIMIT' => array('LIMIT', 3), |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -132,25 +132,25 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function build() |
| 134 | 134 | { |
| 135 | - $ret = 'DELETE '.OptionsArray::build($this->options); |
|
| 135 | + $ret = 'DELETE ' . OptionsArray::build($this->options); |
|
| 136 | 136 | |
| 137 | 137 | if ($this->columns != null && count($this->columns) > 0) { |
| 138 | - $ret .= ' '.ExpressionArray::build($this->columns); |
|
| 138 | + $ret .= ' ' . ExpressionArray::build($this->columns); |
|
| 139 | 139 | } |
| 140 | 140 | if ($this->from != null && count($this->from) > 0) { |
| 141 | - $ret .= ' FROM '.ExpressionArray::build($this->from); |
|
| 141 | + $ret .= ' FROM ' . ExpressionArray::build($this->from); |
|
| 142 | 142 | } |
| 143 | 143 | if ($this->using != null && count($this->using) > 0) { |
| 144 | - $ret .= ' USING '.ExpressionArray::build($this->using); |
|
| 144 | + $ret .= ' USING ' . ExpressionArray::build($this->using); |
|
| 145 | 145 | } |
| 146 | 146 | if ($this->where != null && count($this->where) > 0) { |
| 147 | - $ret .= ' WHERE '.Condition::build($this->where); |
|
| 147 | + $ret .= ' WHERE ' . Condition::build($this->where); |
|
| 148 | 148 | } |
| 149 | 149 | if ($this->order != null && count($this->order) > 0) { |
| 150 | - $ret .= ' ORDER BY '.ExpressionArray::build($this->order); |
|
| 150 | + $ret .= ' ORDER BY ' . ExpressionArray::build($this->order); |
|
| 151 | 151 | } |
| 152 | 152 | if ($this->limit != null && strlen($this->limit) > 0) { |
| 153 | - $ret .= ' LIMIT '.Limit::build($this->limit); |
|
| 153 | + $ret .= ' LIMIT ' . Limit::build($this->limit); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $ret; |
@@ -49,12 +49,12 @@ |
||
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | 51 | public static $CLAUSES = array( |
| 52 | - 'DROP' => array('DROP', 2), |
|
| 52 | + 'DROP' => array('DROP', 2), |
|
| 53 | 53 | // Used for options. |
| 54 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 54 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 55 | 55 | // Used for select expressions. |
| 56 | - 'DROP_' => array('DROP', 1), |
|
| 57 | - 'ON' => array('ON', 3), |
|
| 56 | + 'DROP_' => array('DROP', 1), |
|
| 57 | + 'ON' => array('ON', 3), |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -83,36 +83,36 @@ |
||
| 83 | 83 | * @var array |
| 84 | 84 | */ |
| 85 | 85 | public static $CLAUSES = array( |
| 86 | - 'SELECT' => array('SELECT', 2), |
|
| 86 | + 'SELECT' => array('SELECT', 2), |
|
| 87 | 87 | // Used for options. |
| 88 | - '_OPTIONS' => array('_OPTIONS', 1), |
|
| 88 | + '_OPTIONS' => array('_OPTIONS', 1), |
|
| 89 | 89 | // Used for selected expressions. |
| 90 | - '_SELECT' => array('SELECT', 1), |
|
| 91 | - 'INTO' => array('INTO', 3), |
|
| 92 | - 'FROM' => array('FROM', 3), |
|
| 93 | - 'PARTITION' => array('PARTITION', 3), |
|
| 94 | - |
|
| 95 | - 'JOIN' => array('JOIN', 1), |
|
| 96 | - 'FULL JOIN' => array('FULL JOIN', 1), |
|
| 97 | - 'INNER JOIN' => array('INNER JOIN', 1), |
|
| 98 | - 'LEFT JOIN' => array('LEFT JOIN', 1), |
|
| 99 | - 'LEFT OUTER JOIN' => array('LEFT OUTER JOIN', 1), |
|
| 100 | - 'RIGHT JOIN' => array('RIGHT JOIN', 1), |
|
| 101 | - 'RIGHT OUTER JOIN' => array('RIGHT OUTER JOIN', 1), |
|
| 102 | - 'NATURAL JOIN' => array('NATURAL JOIN', 1), |
|
| 103 | - 'NATURAL LEFT JOIN' => array('NATURAL LEFT JOIN', 1), |
|
| 104 | - 'NATURAL RIGHT JOIN' => array('NATURAL RIGHT JOIN', 1), |
|
| 90 | + '_SELECT' => array('SELECT', 1), |
|
| 91 | + 'INTO' => array('INTO', 3), |
|
| 92 | + 'FROM' => array('FROM', 3), |
|
| 93 | + 'PARTITION' => array('PARTITION', 3), |
|
| 94 | + |
|
| 95 | + 'JOIN' => array('JOIN', 1), |
|
| 96 | + 'FULL JOIN' => array('FULL JOIN', 1), |
|
| 97 | + 'INNER JOIN' => array('INNER JOIN', 1), |
|
| 98 | + 'LEFT JOIN' => array('LEFT JOIN', 1), |
|
| 99 | + 'LEFT OUTER JOIN' => array('LEFT OUTER JOIN', 1), |
|
| 100 | + 'RIGHT JOIN' => array('RIGHT JOIN', 1), |
|
| 101 | + 'RIGHT OUTER JOIN' => array('RIGHT OUTER JOIN', 1), |
|
| 102 | + 'NATURAL JOIN' => array('NATURAL JOIN', 1), |
|
| 103 | + 'NATURAL LEFT JOIN' => array('NATURAL LEFT JOIN', 1), |
|
| 104 | + 'NATURAL RIGHT JOIN' => array('NATURAL RIGHT JOIN', 1), |
|
| 105 | 105 | 'NATURAL LEFT OUTER JOIN' => array('NATURAL LEFT OUTER JOIN', 1), |
| 106 | - 'NATURAL RIGHT OUTER JOIN' => array('NATURAL RIGHT JOIN', 1), |
|
| 107 | - |
|
| 108 | - 'WHERE' => array('WHERE', 3), |
|
| 109 | - 'GROUP BY' => array('GROUP BY', 3), |
|
| 110 | - 'HAVING' => array('HAVING', 3), |
|
| 111 | - 'ORDER BY' => array('ORDER BY', 3), |
|
| 112 | - 'LIMIT' => array('LIMIT', 3), |
|
| 113 | - 'PROCEDURE' => array('PROCEDURE', 3), |
|
| 114 | - 'UNION' => array('UNION', 1), |
|
| 115 | - '_END_OPTIONS' => array('_END_OPTIONS', 1), |
|
| 106 | + 'NATURAL RIGHT OUTER JOIN' => array('NATURAL RIGHT JOIN', 1), |
|
| 107 | + |
|
| 108 | + 'WHERE' => array('WHERE', 3), |
|
| 109 | + 'GROUP BY' => array('GROUP BY', 3), |
|
| 110 | + 'HAVING' => array('HAVING', 3), |
|
| 111 | + 'ORDER BY' => array('ORDER BY', 3), |
|
| 112 | + 'LIMIT' => array('LIMIT', 3), |
|
| 113 | + 'PROCEDURE' => array('PROCEDURE', 3), |
|
| 114 | + 'UNION' => array('UNION', 1), |
|
| 115 | + '_END_OPTIONS' => array('_END_OPTIONS', 1), |
|
| 116 | 116 | // These are available only when `UNION` is present. |
| 117 | 117 | // 'ORDER BY' => array('ORDER BY', 3), |
| 118 | 118 | // 'LIMIT' => array('LIMIT', 3), |
@@ -109,19 +109,19 @@ |
||
| 109 | 109 | */ |
| 110 | 110 | public function build() |
| 111 | 111 | { |
| 112 | - $ret = 'INSERT '.$this->options |
|
| 113 | - .' INTO '.$this->into; |
|
| 112 | + $ret = 'INSERT ' . $this->options |
|
| 113 | + .' INTO ' . $this->into; |
|
| 114 | 114 | |
| 115 | 115 | if ($this->values != null && count($this->values) > 0) { |
| 116 | - $ret .= ' VALUES '.Array2d::build($this->values); |
|
| 116 | + $ret .= ' VALUES ' . Array2d::build($this->values); |
|
| 117 | 117 | } elseif ($this->set != null && count($this->set) > 0) { |
| 118 | - $ret .= ' SET '.SetOperation::build($this->set); |
|
| 118 | + $ret .= ' SET ' . SetOperation::build($this->set); |
|
| 119 | 119 | } elseif ($this->select != null && strlen($this->select) > 0) { |
| 120 | - $ret .= ' '.$this->select->build(); |
|
| 120 | + $ret .= ' ' . $this->select->build(); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($this->onDuplicateSet != null && count($this->onDuplicateSet) > 0) { |
| 124 | - $ret .= ' ON DUPLICATE KEY UPDATE '.SetOperation::build($this->onDuplicateSet); |
|
| 124 | + $ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $ret; |