Re: [sqlite] Import and export databases from/to SQL dump files

2010-09-22 Thread Rich Shepard
On Wed, 22 Sep 2010, Nimish Nayak wrote:

> I saw the shell.c file in src and figured out how exactly it exports
> databases to SQL dump files and implemented the same in C. But i could not
> find anything for importing the databases to SQL dump files.

   I've not looked at the source code, but the shell command for importing
SQL files is .read. I regularly .dump files, tweak the data, then re-import
using .read after dropping the original table.

HTH,

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


[sqlite] Import and export databases from/to SQL dump files

2010-09-22 Thread Nimish Nayak
Hi

I am trying to understand how to Import and export databases from/to SQL
dump files

I saw the shell.c file in src and figured out how exactly it exports
databases to SQL dump files and implemented the same in C.But i could not
find anything for importing the databases to SQL dump files So since i was
working in C
I first read the SQL dump file and then used SQLite C API's
sqlite3_prepare_v2,sqlite3_step
and sqlite3_finalize to
execute the set of commands. But What i Observed was if prepare api would
fail (incase table already pre-exisinting and a create table query
encountered) it would give an error message without proceeding to the next
statement while if i try using CLI mode (sqlite3 mydb.db < sql_file.sql) it
would give me those error message but will process the remaining statements.
So i wanted to know how does SQLite3 achieve this

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