@@ -298,8 +298,8 @@ |
||
298 | 298 | public function getSequence ( $table , $column ) |
299 | 299 | { |
300 | 300 | $return = $this->getPDO () |
301 | - ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
302 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
301 | + ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
302 | + ->fetch ( \PDO::FETCH_ASSOC ); |
|
303 | 303 | |
304 | 304 | if ( ! $return ) |
305 | 305 | { |
@@ -247,7 +247,7 @@ |
||
247 | 247 | { |
248 | 248 | $pdo = $this->getPDO (); |
249 | 249 | $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$table', '$column');" ) |
250 | - ->fetchColumn (); |
|
250 | + ->fetchColumn (); |
|
251 | 251 | |
252 | 252 | if ( $return1 ) |
253 | 253 | { |
@@ -19,6 +19,6 @@ |
||
19 | 19 | |
20 | 20 | public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
21 | 21 | { |
22 | - return array(); |
|
22 | + return array(); |
|
23 | 23 | } |
24 | 24 | } |
@@ -117,7 +117,7 @@ |
||
117 | 117 | */ |
118 | 118 | public function isOverwrite () |
119 | 119 | { |
120 | - return $this->overwrite; |
|
120 | + return $this->overwrite; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | } |
@@ -178,14 +178,14 @@ |
||
178 | 178 | public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
179 | 179 | { |
180 | 180 | $objConstrantDependence = Constrant::getInstance () |
181 | - ->populate ( |
|
182 | - array ( |
|
183 | - 'constrant' => $constraint_name , |
|
184 | - 'schema' => $schema , |
|
185 | - 'table' => $table_name , |
|
186 | - 'column' => $column_name |
|
187 | - ) |
|
188 | - ); |
|
181 | + ->populate ( |
|
182 | + array ( |
|
183 | + 'constrant' => $constraint_name , |
|
184 | + 'schema' => $schema , |
|
185 | + 'table' => $table_name , |
|
186 | + 'column' => $column_name |
|
187 | + ) |
|
188 | + ); |
|
189 | 189 | |
190 | 190 | $this->addDependece ( $objConstrantDependence ); |
191 | 191 |
@@ -107,30 +107,30 @@ discard block |
||
107 | 107 | if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) |
108 | 108 | { |
109 | 109 | $objConstrant = Constrant::getInstance () |
110 | - ->populate ( |
|
111 | - array ( |
|
112 | - 'constrant' => $constrant[ 'constraint_name' ] , |
|
113 | - 'schema' => $constrant[ 'foreign_schema' ] , |
|
114 | - 'table' => $constrant[ 'foreign_table' ] , |
|
115 | - 'column' => $constrant[ 'foreign_column' ] |
|
116 | - ) |
|
117 | - ); |
|
110 | + ->populate ( |
|
111 | + array ( |
|
112 | + 'constrant' => $constrant[ 'constraint_name' ] , |
|
113 | + 'schema' => $constrant[ 'foreign_schema' ] , |
|
114 | + 'table' => $constrant[ 'foreign_table' ] , |
|
115 | + 'column' => $constrant[ 'foreign_column' ] |
|
116 | + ) |
|
117 | + ); |
|
118 | 118 | |
119 | 119 | switch ( $constrant[ 'constraint_type' ] ) |
120 | 120 | { |
121 | 121 | case "FOREIGN KEY": |
122 | 122 | $table->getColumn ( $constrant[ "column_name" ] ) |
123 | - ->addRefFk ( $objConstrant ); |
|
123 | + ->addRefFk ( $objConstrant ); |
|
124 | 124 | break; |
125 | 125 | case"PRIMARY KEY": |
126 | 126 | $table->getColumn ( $constrant[ "column_name" ] ) |
127 | - ->setPrimaryKey ( $objConstrant ) |
|
128 | - ->setSequence ( |
|
129 | - $this->getSequence ( |
|
130 | - $schema . '.' . $table_name , |
|
131 | - $constrant[ "column_name" ] |
|
132 | - ) |
|
133 | - ); |
|
127 | + ->setPrimaryKey ( $objConstrant ) |
|
128 | + ->setSequence ( |
|
129 | + $this->getSequence ( |
|
130 | + $schema . '.' . $table_name , |
|
131 | + $constrant[ "column_name" ] |
|
132 | + ) |
|
133 | + ); |
|
134 | 134 | break; |
135 | 135 | } |
136 | 136 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) |
151 | 151 | { |
152 | 152 | $table->getColumn ( $constrant[ "foreign_column" ] ) |
153 | - ->createDependece ( |
|
154 | - $constrant[ 'constraint_name' ] , |
|
155 | - $constrant[ 'table_name' ] , |
|
156 | - $constrant[ 'column_name' ] , |
|
157 | - $constrant[ 'table_schema' ] |
|
158 | - ); |
|
153 | + ->createDependece ( |
|
154 | + $constrant[ 'constraint_name' ] , |
|
155 | + $constrant[ 'table_name' ] , |
|
156 | + $constrant[ 'column_name' ] , |
|
157 | + $constrant[ 'table_schema' ] |
|
158 | + ); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | ); |
191 | 191 | |
192 | 192 | $this->getTable ( $key , $schema ) |
193 | - ->addColumn ( $column ) |
|
194 | - ->setNamespace ( |
|
195 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
196 | - ); |
|
193 | + ->addColumn ( $column ) |
|
194 | + ->setNamespace ( |
|
195 | + $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
196 | + ); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | public function createTable ( $nameTable , $schema = 0 ) |
254 | 254 | { |
255 | 255 | $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance () |
256 | - ->populate ( |
|
257 | - array ( |
|
258 | - 'table' => $nameTable , |
|
259 | - 'schema' => $schema , |
|
260 | - 'database' => $this->database |
|
261 | - ) |
|
262 | - ); |
|
256 | + ->populate ( |
|
257 | + array ( |
|
258 | + 'table' => $nameTable , |
|
259 | + 'schema' => $schema , |
|
260 | + 'database' => $this->database |
|
261 | + ) |
|
262 | + ); |
|
263 | 263 | |
264 | 264 | return $this; |
265 | 265 | } |