| @@ 106-125 (lines=20) @@ | ||
| 103 | * |
|
| 104 | * @return array |
|
| 105 | */ |
|
| 106 | public function getListColumns () |
|
| 107 | { |
|
| 108 | $strSchema = implode ( "', '" , $this->schema ); |
|
| 109 | ||
| 110 | return $this->getPDO ()->query ( |
|
| 111 | "SELECT distinct |
|
| 112 | c.table_schema, |
|
| 113 | c.table_name, |
|
| 114 | c.column_name , |
|
| 115 | c.data_type, |
|
| 116 | is_nullable, |
|
| 117 | character_maximum_length AS max_length |
|
| 118 | FROM |
|
| 119 | information_schema.tables AS st |
|
| 120 | INNER JOIN information_schema.columns AS c |
|
| 121 | ON st.table_name=c.table_name and st.table_type = 'BASE TABLE' |
|
| 122 | and c.table_schema IN ('$strSchema') |
|
| 123 | order by c.table_name asc" |
|
| 124 | )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function getListConstrant () |
|
| 128 | { |
|
| @@ 127-152 (lines=26) @@ | ||
| 124 | )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function getListConstrant () |
|
| 128 | { |
|
| 129 | $strSchema = implode ( "', '" , $this->schema ); |
|
| 130 | ||
| 131 | return $this->getPDO ()->query ( |
|
| 132 | "SELECT distinct |
|
| 133 | tc.constraint_type, |
|
| 134 | tc.constraint_name, |
|
| 135 | tc.table_schema, |
|
| 136 | tc.table_name, |
|
| 137 | kcu.column_name, |
|
| 138 | ccu.table_schema AS foreign_schema, |
|
| 139 | ccu.table_name AS foreign_table, |
|
| 140 | ccu.column_name as foreign_column |
|
| 141 | FROM |
|
| 142 | information_schema.table_constraints AS tc |
|
| 143 | JOIN information_schema.key_column_usage AS kcu |
|
| 144 | ON tc.constraint_name = kcu.constraint_name |
|
| 145 | AND tc.table_schema IN ('$strSchema') |
|
| 146 | AND tc.constraint_type IN ('FOREIGN KEY','PRIMARY KEY') |
|
| 147 | JOIN information_schema.constraint_column_usage AS ccu |
|
| 148 | ON tc.constraint_name = ccu.constraint_name |
|
| 149 | AND tc.constraint_schema = ccu.constraint_schema |
|
| 150 | ORDER by tc.table_schema" |
|
| 151 | )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 152 | } |
|
| 153 | ||
| 154 | ||
| 155 | /** |
|