Trying the easy approach:
尝试简单的方法:
sqlite2 mydb.db .dump | sqlite3 mydb-new.db
sqlite2 mydb.db .dump | sqlite3 mydb-new.db
I got this error:
我收到了这个错误:
SQL error near line 84802: no such column: Ð
第84802行附近的SQL错误:没有这样的列:Ð
In that line the script is this:
在该行中,脚本是这样的:
INSERT INTO vehiculo VALUES(127548,'21K0065217',Ñ,'PA007808',65217,279,1989,3,468,'1998-07-30 00:00:00.000000','14/697/98-07',2,'',1);
INSERT INTO vehiculo VALUES(127548,'21K0065217',Ñ,'PA007808',65217,279,1989,3,468,'1998-07-30 00:00:00.000000','14/697 / 98-07',2, '',1);
My guess is that the 'Ñ' without quotes is the problem.
我的猜测是没有引号的'Ñ'是问题所在。
any idea?
PD: I'm under Windows right now and I would like to use the command-line so it can be automatized (this process will be done on daily basis by a server).
PD:我现在在Windows下,我想使用命令行,因此它可以自动化(这个过程将每天由服务器完成)。
4 个解决方案
#1
1
Simply open the v2 database with the sqlite3 binary CLI, and then save it. The database file will be transparently migrated to v3.
只需使用sqlite3二进制CLI打开v2数据库,然后保存它。数据库文件将透明地迁移到v3。
It doesn't work.
它不起作用。
$sqlite3 db2
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Error: file is encrypted or is not a database
sqlite> .q
And the file is not changed (apparently sqlite3 couldn't read it). I think the original problem is a bug in sqlite2.
并且文件没有改变(显然sqlite3无法读取它)。我认为最初的问题是sqlite2中的一个错误。
#2
2
Simply open the v2 database with the sqlite3 binary CLI, and then save it. The database file will be transparently migrated to v3.
只需使用sqlite3二进制CLI打开v2数据库,然后保存它。数据库文件将透明地迁移到v3。
$ sqlite3 v2database.db
sqlite> .quit
$
Note: you may need to insert/delete a row before quitting to force an update.
注意:您可能需要在退出之前插入/删除一行以强制更新。
#3
1
Well nobody answer... at the end I end up modifying my original script(the one that created the sqlite2 database in the first place) to create the database directly in sqlite3.
好吧没有人回答......最后我最终修改了原始脚本(首先创建了sqlite2数据库的脚本),直接在sqlite3中创建了数据库。
I think that a big string processing script(big because mi databases are 800mb and 200mb each) can do the job, but generating the database directly was easier for me.
我认为一个大的字符串处理脚本(很大,因为mi数据库是800mb和200mb)可以完成这项工作,但直接生成数据库对我来说更容易。
#4
0
I tried to do it without windows intervention:
我尝试在没有Windows干预的情况下这样做:
*by calling sqlite2 on old.db, and send the dump directly to a file
*通过在old.db上调用sqlite2,并将转储直接发送到文件
*and then call sqlite3 on new.db and loading the dump directly from the file.
*然后在new.db上调用sqlite3并直接从文件加载转储。
Just in case windows was messing with the characters on the command-line.
以防Windows在命令行中弄乱字符。
Same Result.
#1
1
Simply open the v2 database with the sqlite3 binary CLI, and then save it. The database file will be transparently migrated to v3.
只需使用sqlite3二进制CLI打开v2数据库,然后保存它。数据库文件将透明地迁移到v3。
It doesn't work.
它不起作用。
$sqlite3 db2
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Error: file is encrypted or is not a database
sqlite> .q
And the file is not changed (apparently sqlite3 couldn't read it). I think the original problem is a bug in sqlite2.
并且文件没有改变(显然sqlite3无法读取它)。我认为最初的问题是sqlite2中的一个错误。
#2
2
Simply open the v2 database with the sqlite3 binary CLI, and then save it. The database file will be transparently migrated to v3.
只需使用sqlite3二进制CLI打开v2数据库,然后保存它。数据库文件将透明地迁移到v3。
$ sqlite3 v2database.db
sqlite> .quit
$
Note: you may need to insert/delete a row before quitting to force an update.
注意:您可能需要在退出之前插入/删除一行以强制更新。
#3
1
Well nobody answer... at the end I end up modifying my original script(the one that created the sqlite2 database in the first place) to create the database directly in sqlite3.
好吧没有人回答......最后我最终修改了原始脚本(首先创建了sqlite2数据库的脚本),直接在sqlite3中创建了数据库。
I think that a big string processing script(big because mi databases are 800mb and 200mb each) can do the job, but generating the database directly was easier for me.
我认为一个大的字符串处理脚本(很大,因为mi数据库是800mb和200mb)可以完成这项工作,但直接生成数据库对我来说更容易。
#4
0
I tried to do it without windows intervention:
我尝试在没有Windows干预的情况下这样做:
*by calling sqlite2 on old.db, and send the dump directly to a file
*通过在old.db上调用sqlite2,并将转储直接发送到文件
*and then call sqlite3 on new.db and loading the dump directly from the file.
*然后在new.db上调用sqlite3并直接从文件加载转储。
Just in case windows was messing with the characters on the command-line.
以防Windows在命令行中弄乱字符。
Same Result.