|
@@ 5389-5426 (lines=38) @@
|
| 5386 |
|
/** |
| 5387 |
|
* @see AQueryWriter::getKeyMapForType |
| 5388 |
|
*/ |
| 5389 |
|
protected function getKeyMapForType( $type ) |
| 5390 |
|
{ |
| 5391 |
|
$table = $this->esc( $type, TRUE ); |
| 5392 |
|
$keys = $this->adapter->get(' |
| 5393 |
|
SELECT |
| 5394 |
|
information_schema.key_column_usage.constraint_name AS `name`, |
| 5395 |
|
information_schema.key_column_usage.referenced_table_name AS `table`, |
| 5396 |
|
information_schema.key_column_usage.column_name AS `from`, |
| 5397 |
|
information_schema.key_column_usage.referenced_column_name AS `to`, |
| 5398 |
|
information_schema.referential_constraints.update_rule AS `on_update`, |
| 5399 |
|
information_schema.referential_constraints.delete_rule AS `on_delete` |
| 5400 |
|
FROM information_schema.key_column_usage |
| 5401 |
|
INNER JOIN information_schema.referential_constraints |
| 5402 |
|
ON ( |
| 5403 |
|
information_schema.referential_constraints.constraint_name = information_schema.key_column_usage.constraint_name |
| 5404 |
|
AND information_schema.referential_constraints.constraint_schema = information_schema.key_column_usage.constraint_schema |
| 5405 |
|
AND information_schema.referential_constraints.constraint_catalog = information_schema.key_column_usage.constraint_catalog |
| 5406 |
|
) |
| 5407 |
|
WHERE |
| 5408 |
|
information_schema.key_column_usage.table_schema IN ( SELECT DATABASE() ) |
| 5409 |
|
AND information_schema.key_column_usage.table_name = ? |
| 5410 |
|
AND information_schema.key_column_usage.constraint_name != \'PRIMARY\' |
| 5411 |
|
AND information_schema.key_column_usage.referenced_table_name IS NOT NULL |
| 5412 |
|
', array($table)); |
| 5413 |
|
$keyInfoList = array(); |
| 5414 |
|
foreach ( $keys as $k ) { |
| 5415 |
|
$label = $this->makeFKLabel( $k['from'], $k['table'], $k['to'] ); |
| 5416 |
|
$keyInfoList[$label] = array( |
| 5417 |
|
'name' => $k['name'], |
| 5418 |
|
'from' => $k['from'], |
| 5419 |
|
'table' => $k['table'], |
| 5420 |
|
'to' => $k['to'], |
| 5421 |
|
'on_update' => $k['on_update'], |
| 5422 |
|
'on_delete' => $k['on_delete'] |
| 5423 |
|
); |
| 5424 |
|
} |
| 5425 |
|
return $keyInfoList; |
| 5426 |
|
} |
| 5427 |
|
|
| 5428 |
|
/** |
| 5429 |
|
* Constructor |
|
@@ 5897-5914 (lines=18) @@
|
| 5894 |
|
/** |
| 5895 |
|
* @see AQueryWriter::getKeyMapForType |
| 5896 |
|
*/ |
| 5897 |
|
protected function getKeyMapForType( $type ) |
| 5898 |
|
{ |
| 5899 |
|
$table = $this->esc( $type, TRUE ); |
| 5900 |
|
$keys = $this->adapter->get( "PRAGMA foreign_key_list('$table')" ); |
| 5901 |
|
$keyInfoList = array(); |
| 5902 |
|
foreach ( $keys as $k ) { |
| 5903 |
|
$label = $this->makeFKLabel( $k['from'], $k['table'], $k['to'] ); |
| 5904 |
|
$keyInfoList[$label] = array( |
| 5905 |
|
'name' => $label, |
| 5906 |
|
'from' => $k['from'], |
| 5907 |
|
'table' => $k['table'], |
| 5908 |
|
'to' => $k['to'], |
| 5909 |
|
'on_update' => $k['on_update'], |
| 5910 |
|
'on_delete' => $k['on_delete'] |
| 5911 |
|
); |
| 5912 |
|
} |
| 5913 |
|
return $keyInfoList; |
| 5914 |
|
} |
| 5915 |
|
|
| 5916 |
|
/** |
| 5917 |
|
* Constructor |
|
@@ 6208-6256 (lines=49) @@
|
| 6205 |
|
/** |
| 6206 |
|
* @see AQueryWriter::getKeyMapForType |
| 6207 |
|
*/ |
| 6208 |
|
protected function getKeyMapForType( $type ) |
| 6209 |
|
{ |
| 6210 |
|
$table = $this->esc( $type, TRUE ); |
| 6211 |
|
$keys = $this->adapter->get( ' |
| 6212 |
|
SELECT |
| 6213 |
|
information_schema.key_column_usage.constraint_name AS "name", |
| 6214 |
|
information_schema.key_column_usage.column_name AS "from", |
| 6215 |
|
information_schema.constraint_table_usage.table_name AS "table", |
| 6216 |
|
information_schema.constraint_column_usage.column_name AS "to", |
| 6217 |
|
information_schema.referential_constraints.update_rule AS "on_update", |
| 6218 |
|
information_schema.referential_constraints.delete_rule AS "on_delete" |
| 6219 |
|
FROM information_schema.key_column_usage |
| 6220 |
|
INNER JOIN information_schema.constraint_table_usage |
| 6221 |
|
ON ( |
| 6222 |
|
information_schema.key_column_usage.constraint_name = information_schema.constraint_table_usage.constraint_name |
| 6223 |
|
AND information_schema.key_column_usage.constraint_schema = information_schema.constraint_table_usage.constraint_schema |
| 6224 |
|
AND information_schema.key_column_usage.constraint_catalog = information_schema.constraint_table_usage.constraint_catalog |
| 6225 |
|
) |
| 6226 |
|
INNER JOIN information_schema.constraint_column_usage |
| 6227 |
|
ON ( |
| 6228 |
|
information_schema.key_column_usage.constraint_name = information_schema.constraint_column_usage.constraint_name |
| 6229 |
|
AND information_schema.key_column_usage.constraint_schema = information_schema.constraint_column_usage.constraint_schema |
| 6230 |
|
AND information_schema.key_column_usage.constraint_catalog = information_schema.constraint_column_usage.constraint_catalog |
| 6231 |
|
) |
| 6232 |
|
INNER JOIN information_schema.referential_constraints |
| 6233 |
|
ON ( |
| 6234 |
|
information_schema.key_column_usage.constraint_name = information_schema.referential_constraints.constraint_name |
| 6235 |
|
AND information_schema.key_column_usage.constraint_schema = information_schema.referential_constraints.constraint_schema |
| 6236 |
|
AND information_schema.key_column_usage.constraint_catalog = information_schema.referential_constraints.constraint_catalog |
| 6237 |
|
) |
| 6238 |
|
WHERE |
| 6239 |
|
information_schema.key_column_usage.table_catalog = current_database() |
| 6240 |
|
AND information_schema.key_column_usage.table_schema = ANY( current_schemas( FALSE ) ) |
| 6241 |
|
AND information_schema.key_column_usage.table_name = ? |
| 6242 |
|
', array( $type ) ); |
| 6243 |
|
$keyInfoList = array(); |
| 6244 |
|
foreach ( $keys as $k ) { |
| 6245 |
|
$label = $this->makeFKLabel( $k['from'], $k['table'], $k['to'] ); |
| 6246 |
|
$keyInfoList[$label] = array( |
| 6247 |
|
'name' => $k['name'], |
| 6248 |
|
'from' => $k['from'], |
| 6249 |
|
'table' => $k['table'], |
| 6250 |
|
'to' => $k['to'], |
| 6251 |
|
'on_update' => $k['on_update'], |
| 6252 |
|
'on_delete' => $k['on_delete'] |
| 6253 |
|
); |
| 6254 |
|
} |
| 6255 |
|
return $keyInfoList; |
| 6256 |
|
} |
| 6257 |
|
|
| 6258 |
|
/** |
| 6259 |
|
* Constructor |