Re: [sqlite] Running sqlite script in Sqlite db using C++
On 14 May 2013, at 1:59pm, Dulini Atapattuwrote: > If anyway I omit these sqlite commands from script, so is there anyway of > providing the script file to API? If you strip out the lines which start with a dot, everything else in the script should be a legitimate SQL command. You could use the API to execute the whole thing as one bit _exec(). But it would be more conventional to read the file in a line at a time, and execute each line separately. You should write your own code to open the database file you want the results in, then do all the _exec() commands, checking the result returned to make sure there were no errors, then close the file. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Running sqlite script in Sqlite db using C++
You may want to consider writing a bash/msdos-batch file and do your stuff from your OS command line Bıt C API is quite handy, you can do most of the stuff with it. On 14/05/2013, at 10:29 PM, Dulini Atapattuwrote: > If anyway I omit these sqlite commands from script, so is there anyway of > providing the script file to API? > > > On Tue, May 14, 2013 at 6:07 PM, wrote: > >> If you are dealing with CSV files, there is a simple API I wrote you can >> use. >> >> https://github.com/fnoyanisi/sqlite3_capi_extensions >> >> I was looking for .import functionality for C API, but I ended up writing >> my own fınctions. >> >> On 14/05/2013, at 9:39 PM, Richard Hipp wrote: >> >>> On Tue, May 14, 2013 at 1:53 AM, Dulini Atapattu >>> wrote: >>> Hi all, I have some sqlite scripts with some sqlite commands like: - .headers ON - .mode CSV etc. Is there anyway of running this script in SqliteDB using Sqlite >> interface for C++, instead of redirecting the file to sqlite using sqlite command line shell? >>> >>> Those commands are implemented by the sqlite3 command-line shell, not by >>> the SQLite library. >>> >>> You can copy/paste the code out of the sqlite3 command-line shell source >>> code (www.sqlite.org/src/artifact/2109d54f67) and add that code to your >> C++ >>> application, I suppose. >>> >>> -- >>> D. Richard Hipp >>> d...@sqlite.org >>> ___ >>> 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Running sqlite script in Sqlite db using C++
If anyway I omit these sqlite commands from script, so is there anyway of providing the script file to API? On Tue, May 14, 2013 at 6:07 PM,wrote: > If you are dealing with CSV files, there is a simple API I wrote you can > use. > > https://github.com/fnoyanisi/sqlite3_capi_extensions > > I was looking for .import functionality for C API, but I ended up writing > my own fınctions. > > On 14/05/2013, at 9:39 PM, Richard Hipp wrote: > > > On Tue, May 14, 2013 at 1:53 AM, Dulini Atapattu > > wrote: > > > >> Hi all, > >> > >> I have some sqlite scripts with some sqlite commands like: > >> > >> - .headers ON > >> - .mode CSV etc. > >> > >> Is there anyway of running this script in SqliteDB using Sqlite > interface > >> for C++, instead of redirecting the file to sqlite using sqlite command > >> line shell? > > > > Those commands are implemented by the sqlite3 command-line shell, not by > > the SQLite library. > > > > You can copy/paste the code out of the sqlite3 command-line shell source > > code (www.sqlite.org/src/artifact/2109d54f67) and add that code to your > C++ > > application, I suppose. > > > > -- > > D. Richard Hipp > > d...@sqlite.org > > ___ > > 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] Running sqlite script in Sqlite db using C++
If you are dealing with CSV files, there is a simple API I wrote you can use. https://github.com/fnoyanisi/sqlite3_capi_extensions I was looking for .import functionality for C API, but I ended up writing my own fınctions. On 14/05/2013, at 9:39 PM, Richard Hippwrote: > On Tue, May 14, 2013 at 1:53 AM, Dulini Atapattu > wrote: > >> Hi all, >> >> I have some sqlite scripts with some sqlite commands like: >> >> - .headers ON >> - .mode CSV etc. >> >> Is there anyway of running this script in SqliteDB using Sqlite interface >> for C++, instead of redirecting the file to sqlite using sqlite command >> line shell? > > Those commands are implemented by the sqlite3 command-line shell, not by > the SQLite library. > > You can copy/paste the code out of the sqlite3 command-line shell source > code (www.sqlite.org/src/artifact/2109d54f67) and add that code to your C++ > application, I suppose. > > -- > D. Richard Hipp > d...@sqlite.org > ___ > 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] Running sqlite script in Sqlite db using C++
On Tue, May 14, 2013 at 1:53 AM, Dulini Atapattuwrote: > Hi all, > > I have some sqlite scripts with some sqlite commands like: > >- .headers ON >- .mode CSV etc. > > Is there anyway of running this script in SqliteDB using Sqlite interface > for C++, instead of redirecting the file to sqlite using sqlite command > line shell? > Those commands are implemented by the sqlite3 command-line shell, not by the SQLite library. You can copy/paste the code out of the sqlite3 command-line shell source code (www.sqlite.org/src/artifact/2109d54f67) and add that code to your C++ application, I suppose. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Running sqlite script in Sqlite db using C++
Hi all, I have some sqlite scripts with some sqlite commands like: - .headers ON - .mode CSV etc. Is there anyway of running this script in SqliteDB using Sqlite interface for C++, instead of redirecting the file to sqlite using sqlite command line shell? Thanks ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users