Re: [sqlite] How to create a table from a text file via c/c++interface?

2009-05-04 Thread knightfeng
It works. I changed 
" for (int i=0;i<1e5;i++)
{
rc = sqlite3_exec(db, "insert into wigfile values(1,2000,3000,0.4)", callback, 
0, );
}"

into 
"sqlite3_exec(db, "begin", callback, 0, );
for (int i=0;i<1e5;i++){
rc = sqlite3_exec(db, "insert into wigfile values(1,2000,3000,0.4)", 
callback, 0, );
}
sqlite3_exec(db, "commit", callback, 0, );"

the second one run much faster the first one.

Thank you very much.


Zhixing
2009-05-04 



knightfeng 



发件人: Griggs, Donald 
发送时间: 2009-05-04  11:16:35 
收件人: General Discussion of SQLite Database 
抄送: 
主题: Re: [sqlite] How to create a table from a text file via c/c++interface? 
 
Hi, Feng,
I don't think that "load data from" is part of the sql standard -- I may
be wrong.
At any rate, the source code to the command line utility is freely
available.
When you wrote that "Using ' insert into values' ... is very time
comsuming" did you mean time consuming to write the program, or
time-consuming to run?  If it is taking a very long time to RUN compare
to the sqlite3 ".import" command, then be sure you're surrounding the
import (or at least every 1000 lines or so) in a TRANSACTION.  Expect a
large increase in speed.
http://www.sqlite.org/lang_transaction.html
Perhaps this helps,
   Donald Griggs

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of knightfeng
Sent: Sunday, May 03, 2009 10:41 PM
To: sqlite-users
Subject: [sqlite] How to create a table from a text file via c/c++
interface?
Hi,
   
   '.import' can be used to create a table from text file in the command
line version , but how can I do that using C/C++ interface? Using '
insert into values' by reading a text file line by line is very time
comsuming and it seems that there is no such SQL command "LOAD DATA
FROM" supported by MySql in sqlite.  
Many thanks.
Zhixing Feng
2009-05-04 
knightfeng
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to create a table from a text file via c/c++ interface?

2009-05-03 Thread Griggs, Donald
Hi, Feng,

I don't think that "load data from" is part of the sql standard -- I may
be wrong.

At any rate, the source code to the command line utility is freely
available.

When you wrote that "Using ' insert into values' ... is very time
comsuming" did you mean time consuming to write the program, or
time-consuming to run?  If it is taking a very long time to RUN compare
to the sqlite3 ".import" command, then be sure you're surrounding the
import (or at least every 1000 lines or so) in a TRANSACTION.  Expect a
large increase in speed.

http://www.sqlite.org/lang_transaction.html

Perhaps this helps,
   Donald Griggs

 

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of knightfeng
Sent: Sunday, May 03, 2009 10:41 PM
To: sqlite-users
Subject: [sqlite] How to create a table from a text file via c/c++
interface?

Hi,
   
   '.import' can be used to create a table from text file in the command
line version , but how can I do that using C/C++ interface? Using '
insert into values' by reading a text file line by line is very time
comsuming and it seems that there is no such SQL command "LOAD DATA
FROM" supported by MySql in sqlite.  

Many thanks.

Zhixing Feng




2009-05-04 



knightfeng
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to create a table from a text file via c/c++ interface?

2009-05-03 Thread knightfeng
Hi,
   
   '.import' can be used to create a table from text file in the command line 
version , but how can I do that using C/C++
interface? Using ' insert into values' by reading a text file line by line is 
very time comsuming and it seems that there is no such SQL command "LOAD DATA 
FROM" supported by MySql in sqlite.  

Many thanks.

Zhixing Feng




2009-05-04 



knightfeng 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users