Qovery / Replibyte

Seed your development database with real data ⚡️
https://www.replibyte.com
GNU General Public License v3.0
4.18k stars 129 forks source link

Failed to parse mysql with "Unterminated string literal" #136

Closed koolay closed 2 years ago

koolay commented 2 years ago

Unterminated string literal

failing query: '
CREATE TABLE `contact` (
  `id` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
  `account` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '',
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '姓名',
  `mobile` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '',
  `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '',
  `wx_app_id` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
  `created_by` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
  `updated_by` char(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='';'
thread 'main' panicked at 'TokenizerError { message: "Unterminated string literal", line: 15, col: 23 }', dump-parser/src/mysql/mod.rs:697:13
DeaeLunae commented 2 years ago

As best I can tell, this happens when replibyte hits a value that has a semicolon in it, based on my current issues.

koolay commented 2 years ago

It is about the keyword of comment.

evoxmusic commented 2 years ago

Hi, thanks for reporting. I will take a look ASAP (this weekend hopefully)

koolay commented 2 years ago

@evoxmusic

I works now after removing the comment of table.

evoxmusic commented 2 years ago

Hi @koolay I think this PR will fix this issue https://github.com/Qovery/Replibyte/pull/141