Skip to content

Commit 3cedfa6

Browse files
authored
Merge pull request mysql2sqlite#59 from frrad/rm_using
Ignore "USING ..." (e.g. "USING BTREE")
2 parents a3bb48e + 1fda3fe commit 3cedfa6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

mysql2sqlite

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ aInc == 1 && /PRIMARY KEY|primary key/ { next }
195195
if( match($0, ere_bit_field) ){
196196
sub( ere_bit_field, bit_to_int( substr( $0, RSTART +2, RLENGTH -2 -1 ) ) )
197197
}
198+
199+
# remove USING BTREE and other suffixes for USING, for example: "UNIQUE KEY
200+
# `hostname_domain` (`hostname`,`domain`) USING BTREE,"
201+
gsub( / USING [^, ]+/, "" )
202+
198203
# field comments are not supported
199204
gsub( / (COMMENT|comment).+$/, "" )
200205
# Get commas off end of line

unit_tests.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,10 @@ SQLout
121121

122122

123123
cat <<\SQL
124+
CREATE TABLE `scimag` (
125+
`ID` int(15) unsigned NOT NULL AUTO_INCREMENT,
126+
`DOI` varchar(200) NOT NULL,
127+
PRIMARY KEY (`ID`) USING BTREE,
128+
UNIQUE KEY `DOIUNIQUE` (`DOI`) USING BTREE,
129+
);
124130
SQL
125-

0 commit comments

Comments
 (0)