有没有办法让双引号使用 sqlite 覆盖分隔符
这是我的 sqlite 代码:
create table A(A1 text, A2 text);
.separator ","
import outData.csv A
我得到一个错误语句,如下所示:
outData.csv Line 4: expected 2 columns of data but found 4
这就是第 4 行的样子:
Hallieo,"h, a, and ll"
我明白为什么会出现错误消息。但我想知道是否有人可以建议一种方法让我将“h、a 和 ll”存储为一条记录。因此能够在存在双引号的情况下覆盖分隔符命令。
预先感谢您的任何帮助。
This is my sqlite code:
create table A(A1 text, A2 text);
.separator ","
import outData.csv A
I get an error statement as so:
outData.csv Line 4: expected 2 columns of data but found 4
This is what Line 4 looks like:
Hallieo,"h, a, and ll"
I understand why the error message comes up. But I was wondering if anyone can suggest a way for me to store - "h, a, and ll" as one record. Thus being able to override the separator command in the presence of a double inverted comma.
Thanks in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
sqlite3 控制台程序中的分词器将一行分成单独的字段,它很简单,但无法应对这一挑战。
您必须编写自己的程序来逐行读取文件,对每一行进行标记,然后存储到数据库中。如果您真的了解您的编程语言,那么这是一个有趣的挑战,将占用您一天的时间。
我自己使用 C++,对于这类事情会使用 boost::tokenizer。 http://www.boost.org/doc/libs/1_46_0 /libs/tokenizer/tokenizer.htm
The tokenizer, which is what splits a line up into individual fields, in the sqlite3 console program is straightforward and not up to this challenge.
You will have to write your own program to read the file line by line, tokenize each line, and store into the database. An entertaining challenge that will occupy a day if you really know your programming language.
Myself, I use C++ and for this sort of thing would use boost::tokenizer. http://www.boost.org/doc/libs/1_46_0/libs/tokenizer/tokenizer.htm