问题描述
我正在尝试对格式错误的sqlite文件进行干净的导出-导入.
I'm trying to do a clean export-import of a malformed sqlite file.
使用来自 techblog.dorogin.com/sqliteexception- datab ... ,这就是我sqlite3 oldfile
所做的事情:
Using info from techblog.dorogin.com/sqliteexception-datab..., this is what I did sqlite3 oldfile
:
-
.mode insert
-
.output tempfile
-
.dump
.mode insert
.output tempfile
.dump
然后我创建了一个新的sqlite3 newfile
:
Then I created a new sqlite3 newfile
:
-
.read tempfile
错误:
sqlite> .read tempfile
Error: near line 52330: Expression tree is too large (maximum depth 1000)
Error: near line 53097: Expression tree is too large (maximum depth 1000)
Error: near line 53427: Expression tree is too large (maximum depth 1000)
Error: near line 54013: Expression tree is too large (maximum depth 1000)
Error: near line 54014: Expression tree is too large (maximum depth 1000)
Error: near line 54047: Expression tree is too large (maximum depth 1000)
Error: near line 54048: Expression tree is too large (maximum depth 1000)
Error: near line 54227: Expression tree is too large (maximum depth 1000)
Error: near line 54294: Expression tree is too large (maximum depth 1000)
Error: near line 54373: Expression tree is too large (maximum depth 1000)
Error: near line 54374: Expression tree is too large (maximum depth 1000)
Error: near line 56688: Expression tree is too large (maximum depth 1000)
Error: near line 57950: Expression tree is too large (maximum depth 1000)
Error: near line 58015: Expression tree is too large (maximum depth 1000)
Error: near line 58077: Expression tree is too large (maximum depth 1000)
Error: near line 58246: Expression tree is too large (maximum depth 1000)
Error: near line 59795: Expression tree is too large (maximum depth 1000)
Error: near line 60439: Expression tree is too large (maximum depth 1000)
Error: near line 61501: Expression tree is too large (maximum depth 1000)
Error: near line 61523: Expression tree is too large (maximum depth 1000)
Error: near line 61811: Expression tree is too large (maximum depth 1000)
Error: near line 61824: Expression tree is too large (maximum depth 1000)
在输出文件中,我的最大行数是35737个字符.
In the output file, my maximum line is 35737 chars.
如何解决此错误?
对格式错误的sqlite文件进行干净的导出导入有哪些解决方案?
What are some solutions to do a clean export-import of a malformed sqlite file?
推荐答案
这是由于在版本3.18.0的sqlite3
中更改:
This is due to a change in version 3.18.0's sqlite3
:
如果单个字符串值中的换行符太多,则生成的SQL表达式将变得过于复杂.
If there are too many newline characters in a single string value, the resulting SQL expression becomes too complex.
这是已修复./www.sqlite.org/releaselog/3_19_0.html"rel =" nofollow noreferrer> 3.19.0 .如果您仍在使用3.18.0,则可以通过将文件转换为使用原始换行符来解决此问题:
This was fixed in version 3.19.0.If you are still using 3.18.0, you can work around this by converting the file to use raw newlines instead:
sed -e "s/'||char(10)||'/\\n/g" < tempfile > tempfile_with_newlines
这篇关于Sqlite错误:表达式树太大(最大深度为1000)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!