Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Temukan informasi kunci asing menggunakan Perl/DBI/MySQL/InnoDB

Sepertinya belum didukung oleh driver mysql. Melakukan pemeriksaan cepat melalui debug, sepertinya pernyataan sql berikut dimasukkan:

SELECT NULL AS PKTABLE_CAT,
   A.REFERENCED_TABLE_SCHEMA AS PKTABLE_SCHEM,
   A.REFERENCED_TABLE_NAME AS PKTABLE_NAME,
   A.REFERENCED_COLUMN_NAME AS PKCOLUMN_NAME,
   A.TABLE_CATALOG AS FKTABLE_CAT,
   A.TABLE_SCHEMA AS FKTABLE_SCHEM,
   A.TABLE_NAME AS FKTABLE_NAME,
   A.COLUMN_NAME AS FKCOLUMN_NAME,
   A.ORDINAL_POSITION AS KEY_SEQ,
   NULL AS UPDATE_RULE,
   NULL AS DELETE_RULE,
   A.CONSTRAINT_NAME AS FK_NAME,
   NULL AS PK_NAME,
   NULL AS DEFERABILITY,
   NULL AS UNIQUE_OR_PRIMARY
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE A,
   INFORMATION_SCHEMA.TABLE_CONSTRAINTS B
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME
   AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE IS NOT NULL
   AND A.TABLE_NAME = ? ORDER BY A.TABLE_SCHEMA, A.TABLE_NAME, A.ORDINAL_POSITION

Perhatikan bahwa kolom UPDATE_RULE dan DELETE_RULE keduanya disetel ke NULL.




  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Deklarasikan variabel di Bash?

  2. xampp mysql Gagal menginisialisasi struktur multi master

  3. simpan format input textarea setelah menggunakan mysql_real_escape_string untuk menyimpan

  4. Cara Mengubah Detik ke Nilai Waktu di MySQL

  5. Koordinat perbandingan dalam database