| @@ 77-102 (lines=26) @@ | ||
| 74 | * |
|
| 75 | * @return string[] |
|
| 76 | */ |
|
| 77 | public function getListNameTable () |
|
| 78 | { |
|
| 79 | if ( empty( $this->tableList ) ) { |
|
| 80 | ||
| 81 | $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":''; |
|
| 82 | ||
| 83 | $strSchema = implode ( "', '", $this->schema ); |
|
| 84 | ||
| 85 | $this->tableList = $this->getPDO () |
|
| 86 | ->query ( |
|
| 87 | "SELECT table_schema, |
|
| 88 | table_name |
|
| 89 | FROM information_schema.tables |
|
| 90 | WHERE |
|
| 91 | table_type = 'BASE TABLE' |
|
| 92 | AND table_schema IN ( '$strSchema' ) $sqlTables |
|
| 93 | ORDER by |
|
| 94 | table_schema, |
|
| 95 | table_name |
|
| 96 | ASC" |
|
| 97 | ) |
|
| 98 | ->fetchAll (); |
|
| 99 | } |
|
| 100 | ||
| 101 | return $this->tableList; |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * retorna multiplos arrays com dados da column em array |
|
| @@ 252-271 (lines=20) @@ | ||
| 249 | * |
|
| 250 | * @return int |
|
| 251 | */ |
|
| 252 | public function getTotalTables () |
|
| 253 | { |
|
| 254 | if ( empty( $this->totalTables ) ) { |
|
| 255 | $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":''; |
|
| 256 | ||
| 257 | $strSchema = implode ( "', '", $this->schema ); |
|
| 258 | ||
| 259 | $this->totalTables = $this->getPDO () |
|
| 260 | ->query ( |
|
| 261 | "SELECT COUNT(table_name) AS total |
|
| 262 | FROM information_schema.tables |
|
| 263 | WHERE |
|
| 264 | table_type = 'BASE TABLE' |
|
| 265 | AND table_schema IN ( '" . $strSchema . "' ) $sqlTables" |
|
| 266 | ) |
|
| 267 | ->fetchColumn (); |
|
| 268 | } |
|
| 269 | ||
| 270 | return (int) $this->totalTables; |
|
| 271 | } |
|
| 272 | } |
|
| 273 | ||
| @@ 101-128 (lines=28) @@ | ||
| 98 | * @inheritDoc |
|
| 99 | * @return string[] |
|
| 100 | */ |
|
| 101 | public function getListNameTable () |
|
| 102 | { |
|
| 103 | if ( empty( $this->tableList ) ) |
|
| 104 | { |
|
| 105 | ||
| 106 | $sqlTables = ! empty( $this->tablesName ) |
|
| 107 | ? "AND table_name IN ( $this->tablesName )" : ''; |
|
| 108 | ||
| 109 | $strSchema = implode ( "', '" , $this->schema ); |
|
| 110 | ||
| 111 | $this->tableList = $this->getPDO () |
|
| 112 | ->query ( |
|
| 113 | "SELECT table_schema, |
|
| 114 | table_name |
|
| 115 | FROM {$this->database}.information_schema.tables |
|
| 116 | WHERE |
|
| 117 | table_type = 'BASE TABLE' |
|
| 118 | AND table_schema IN ( '$strSchema' ) $sqlTables |
|
| 119 | ORDER by |
|
| 120 | table_schema, |
|
| 121 | table_name |
|
| 122 | ASC" |
|
| 123 | ) |
|
| 124 | ->fetchAll (); |
|
| 125 | } |
|
| 126 | ||
| 127 | return $this->tableList; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * retorna multiplos arrays com dados da column em array |
|
| @@ 172-193 (lines=22) @@ | ||
| 169 | * |
|
| 170 | * @return int |
|
| 171 | */ |
|
| 172 | public function getTotalTables () |
|
| 173 | { |
|
| 174 | if ( empty( $this->totalTables ) ) |
|
| 175 | { |
|
| 176 | $sqlTables = ! empty( $this->tablesName ) |
|
| 177 | ? "AND table_name IN ( $this->tablesName )" : ''; |
|
| 178 | ||
| 179 | $strSchema = implode ( "', '" , $this->schema ); |
|
| 180 | ||
| 181 | $this->totalTables = $this->getPDO () |
|
| 182 | ->query ( |
|
| 183 | "SELECT COUNT(table_name) AS total |
|
| 184 | FROM {$this->database}.information_schema.tables |
|
| 185 | WHERE |
|
| 186 | table_type = 'BASE TABLE' |
|
| 187 | AND table_schema IN ( '" . $strSchema . "' ) $sqlTables" |
|
| 188 | ) |
|
| 189 | ->fetchColumn (); |
|
| 190 | } |
|
| 191 | ||
| 192 | return (int) $this->totalTables; |
|
| 193 | } |
|
| 194 | ||
| 195 | public function getSequence ( $table , $column , $schema = 0 ) |
|
| 196 | { |
|