I have a text file with the db schema definition
dbschema.sql
Is there a way to let my application to set up the db using soci?
I am using sqlite.
my idea (which I could not get working) was to read in the file by
line and than to run a loop
i.e. to execute the sql.
std::string bla = "heresql.sqlite";
try{
soci::session sql_( soci::sqlite3 , bla );
std::vector<std::string> lines;
ralab::base::utils::readLines("../sql/dbschema.sql",lines);
for(size_t i = 0 ; i < lines.size() ; ++i)
{
sql_<< lines[i];
}
catch( ...
soci throws a error:
No sqlite statement created
...
Here is how the txt file with the schema looks.
<dbschame.sql>
-- basic sample information
PRAGMA foreign_keys = ON;
drop table if exists sample;
CREATE TABLE sample (
id integer primary key,
name text,
file text,
description text
);
</dbschame.sql>
Any suggestions?
--
Witold Eryk Wolski
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users