我编写了数据库模式(到目前为止只有一个表),并在一个文件中编写了该表的INSERT语句.然后我创建了数据库,如下所示:
$ sqlite3 newdatabase.db
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .read ./schema.sql
SQL error near line 16: near "s": syntax error
Run Code Online (Sandbox Code Playgroud)
我的文件的第16行看起来像这样:
INSERT INTO table_name (field1, field2) VALUES (123, 'Hello there\'s');
Run Code Online (Sandbox Code Playgroud)
问题是单引号的转义字符.我也试过双重转义单引号(使用\\\'
而不是\'
),但这也不起作用.我究竟做错了什么?