mysql2sqlite
mysql2sqlite copied to clipboard
USING BTREE in KEY
Hi. I was getting this error:
Error: near line 4: near "USING": syntax error
When I had the following syntax in my SQL backup file:
CREATE TABLE `table_name` (
UNIQUE KEY `hostname_domain` (`hostname`,`domain`) USING BTREE,
);
This patch gets rid of "USING BTREE" and other "USING". Tested and it works for me. Please consider for inclusion. I don't know how to submit them using GIT, sorry:
--- mysql2sqlite 2018-02-07 19:01:00.000000000 +0000
+++ mysql2sqlite_ignoring_using_in_key.awk 2018-03-12 11:50:38.090073802 +0000
@@ -184,6 +184,10 @@
if( match($0, ere_bit_field) ){
sub( ere_bit_field, bit_to_int( substr( $0, RSTART +2, RLENGTH -2 -1 ) ) )
}
+
+ #remove USING BTREE and other suffixes for USING, for example: "UNIQUE KEY `hostname_domain` (`hostname`,`domain`) USING BTREE,"
+ gsub( / USING [^, ]+/, "" )
+
# field comments are not supported
gsub( / (COMMENT|comment).+$/, "" )
# Get commas off end of line
Duplicate of https://github.com/dumblob/mysql2sqlite/issues/11 .