44 char*
v =
const_cast<char*
>(
reinterpret_cast<const char *
>(
68SqlStatement::SqlStatement(sqlite3* db, std::string
zSql)
75void SqlStatement::Must(
int status) {
78 throw IOError(
"SQL error [" + zSql_ +
"]: " +
err);
115 std::ifstream
ifile(path_.c_str());
128 throw IOError(
"Unable to create/open database " + path_);
147 throw IOError(
"SQL error: " +
sql +
" " + error);
153 throw IOError(
"SQL error: " +
sql +
" " + error);
168 throw IOError(
"SQL error: " + error);
181 for (
int col = 0; col < cols; col++) {
189 values.push_back(val);
197 throw IOError(
"SQL error: " + error);
for failed reading/writing to files, network connections, etc..
Thin wrapper class over sqlite3 prepared statements.
double GetDouble(int col)
Returns a double value for the specified column of the current query row.
boost::shared_ptr< SqlStatement > Ptr
int GetInt(int col)
Returns an int value for the specified column of the current query row.
char * GetText(int col, int *n)
Returns a byte array value for the specified column of the current query row.
void BindDouble(int i, double val)
Binds the templated sql parameter at index i to val.
void Reset()
Executes the prepared statement.
bool Step()
Step to next row of previously executed query.
void BindText(int i, const char *val)
Binds the templated sql parameter at index i to val.
void BindInt(int i, int val)
Binds the templated sql parameter at index i to val.
void Exec()
Executes the prepared statement.
void BindBlob(int i, const void *val, int n)
Binds the templated sql parameter at index i to the value pointed to by val.
void Overwrite()
Instead of opening a file of the specified name (if it already exists), overwrite it with a new empty...
void open()
Opens the sqlite database by either opening/creating a file (default) or creating/overwriting a file ...
void close()
Finishes any incomplete operations and closes the database.
void Execute(std::string cmd)
Execute an SQL command.
SqlStatement::Ptr Prepare(std::string sql)
Creates a sqlite prepared statement for the given sql.
SqliteDb(std::string path, bool readonly=false)
Creates a new Sqlite database to be stored at the specified path.
std::vector< StrList > Query(std::string cmd)
Execute an SQL query and return its results.
Code providing rudimentary logging capability for the Cyclus core.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
std::vector< std::string > StrList
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters