From fb2510a86623a00f784ac9cae998d8811693e42f Mon Sep 17 00:00:00 2001 From: fazi Date: Fri, 10 Mar 2017 00:53:15 +0100 Subject: [PATCH] fk support removed --- .../Event/RowEvent/Columns.php | 9 +----- .../Event/RowEvent/RowEvent.php | 4 +-- .../Repository/MySQLRepository.php | 28 ++++++------------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/MySQLReplication/Event/RowEvent/Columns.php b/src/MySQLReplication/Event/RowEvent/Columns.php index 5693e7b..4d59c94 100644 --- a/src/MySQLReplication/Event/RowEvent/Columns.php +++ b/src/MySQLReplication/Event/RowEvent/Columns.php @@ -35,14 +35,7 @@ public static function parse($columnType, array $columnSchema, BinaryDataReader self::$field['unsigned'] = !(stripos($columnSchema['COLUMN_TYPE'], 'unsigned') === false); self::$field['type_is_bool'] = false; self::$field['is_primary'] = $columnSchema['COLUMN_KEY'] === 'PRI'; - self::$field['is_foreign'] = null !== $columnSchema['REFERENCED_TABLE_NAME'] && null !== $columnSchema['REFERENCED_COLUMN_NAME']; - - if (self::$field['is_foreign']) - { - self::$field['referenced_table_name'] = $columnSchema['REFERENCED_TABLE_NAME']; - self::$field['referenced_column_name'] = $columnSchema['REFERENCED_COLUMN_NAME']; - } - + if (self::$field['type'] === ConstFieldType::VARCHAR) { self::$field['max_length'] = $binaryDataReader->readInt16(); diff --git a/src/MySQLReplication/Event/RowEvent/RowEvent.php b/src/MySQLReplication/Event/RowEvent/RowEvent.php index cb1c759..eb18276 100644 --- a/src/MySQLReplication/Event/RowEvent/RowEvent.php +++ b/src/MySQLReplication/Event/RowEvent/RowEvent.php @@ -161,9 +161,7 @@ public function makeTableMapDTO() 'CHARACTER_SET_NAME' => null, 'COLUMN_COMMENT' => null, 'COLUMN_TYPE' => 'BLOB', - 'COLUMN_KEY' => '', - 'REFERENCED_TABLE_NAME' => '', - 'REFERENCED_COLUMN_NAME' => '', + 'COLUMN_KEY' => '' ]; $type = ConstFieldType::IGNORE; diff --git a/src/MySQLReplication/Repository/MySQLRepository.php b/src/MySQLReplication/Repository/MySQLRepository.php index 01e3c31..8202129 100644 --- a/src/MySQLReplication/Repository/MySQLRepository.php +++ b/src/MySQLReplication/Repository/MySQLRepository.php @@ -34,28 +34,18 @@ public function getFields($schema, $table) { $sql = ' SELECT - c.`COLUMN_NAME`, - c.`COLLATION_NAME`, - c.`CHARACTER_SET_NAME`, - c.`COLUMN_COMMENT`, - c.`COLUMN_TYPE`, - c.`COLUMN_KEY`, - `kcu`.`REFERENCED_TABLE_NAME`, - `kcu`.`REFERENCED_COLUMN_NAME` + `COLUMN_NAME`, + `COLLATION_NAME`, + `CHARACTER_SET_NAME`, + `COLUMN_COMMENT`, + `COLUMN_TYPE`, + `COLUMN_KEY` FROM - `information_schema`.`COLUMNS` c - LEFT JOIN - `information_schema`.KEY_COLUMN_USAGE kcu - ON - c.`TABLE_SCHEMA` = kcu.`TABLE_SCHEMA` - AND - c.`TABLE_NAME` = kcu.`TABLE_NAME` - AND - c.`COLUMN_NAME` = kcu.`COLUMN_NAME` + `information_schema`.`COLUMNS` WHERE - c.`TABLE_SCHEMA` = ? + `TABLE_SCHEMA` = ? AND - c.`TABLE_NAME` = ? + `TABLE_NAME` = ? '; return $this->getConnection()->fetchAll($sql, [$schema, $table]);