Sqlite错误:表达式树太大(最大深度为1000) [英] Sqlite Error: Expression tree is too large (maximum depth 1000)

查看:411
本文介绍了Sqlite错误:表达式树太大(最大深度为1000)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对格式错误的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:

  1. .mode insert
  2. .output tempfile
  3. .dump
  1. .mode insert
  2. .output tempfile
  3. .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?

推荐答案

这是由于

This is due to a change in version 3.18.0's sqlite3:

在CLI的".dump"命令的输出中,使用char()函数引用换行符和回车符,这样它们就不会在OS或Windows的行尾处理逻辑中被吃掉.在其他命令行实用程序和/或库中.

In the output of the ".dump" command in the CLI, quote newline and carriage-return characters using the char() function, so that they do not get eaten by end-of-line processing logic in the OS or in other command-line utilities and/or libraries.

如果单个字符串值中的换行符太多,则生成的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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆