On Sat, Jun 16, 2012 at 4:32 AM, Simon Slavin <[email protected]> wrote:
> There is no way to do it in one command. You can write your own C++ code
> to read the text file one line at a time and call sqlite3_exec() for that
> line. There is an example of a C++ program which calls that function here:
>
be careful with "lines" - SQL lines end in semicolons, lines read with
C++'s std::getline() and friends end on newlines:
SELECT
foo FROM
bar...
To copy a whole C++ stream:
std::ostringstream os;
std::istream is("filename");
is >> std::noskipws;
std::istream_iterator<char> begin(is);
std::istream_iterator<char> end;
std::copy( begin, end, std::ostream_iterator<char>(os, "")
now the contents are in os.str() resp. os.str().c_str().
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users