14 #pragma warning(disable:4355) 27 , databaseReady_(false)
30 , rowsAffectedBulk_(-1LL)
45 sqlite3_finalize(
stmt_);
59 static_cast<int>(query.size()),
66 std::ostringstream ss;
67 ss <<
"sqlite3_statement_backend::prepare: " 80 int const res = sqlite3_reset(
stmt_);
107 int const res = sqlite3_step(
stmt_);
109 if (SQLITE_DONE == res)
111 databaseReady_ =
false;
115 else if (SQLITE_ROW == res)
120 numCols = sqlite3_column_count(
stmt_);
121 for (sqlite3_recordset::iterator it =
dataCache_.begin(),
124 (*it).resize(numCols);
127 for (
int c = 0; c < numCols; ++c)
130 reinterpret_cast<char const*
>(sqlite3_column_text(
stmt_, c));
145 std::ostringstream ss;
146 ss <<
"sqlite3_statement_backend::loadRS: " 164 int const res = sqlite3_step(
stmt_);
166 if (SQLITE_DONE == res)
171 else if (SQLITE_ROW == res)
180 std::ostringstream ss;
181 ss <<
"sqlite3_statement_backend::loadOne: " 195 long long rowsAffectedBulkTemp = 0;
197 int const rows =
static_cast<int>(
useData_.size());
200 sqlite3_reset(
stmt_);
202 int const totalPositions =
static_cast<int>(
useData_[0].size());
203 for (
int pos = 1; pos <= totalPositions; ++pos)
205 int bindRes = SQLITE_OK;
209 bindRes = sqlite3_bind_null(
stmt_, pos);
213 bindRes = sqlite3_bind_blob(
stmt_, pos,
220 bindRes = sqlite3_bind_text(
stmt_, pos,
221 curCol.
data_.c_str(),
222 static_cast<int>(curCol.
data_.length()),
226 if (SQLITE_OK != bindRes)
236 if (1 == rows && number != rows)
253 throw soci_error(
"No sqlite statement created");
256 sqlite3_reset(
stmt_);
301 std::string
const &query)
308 return sqlite3_column_count(
stmt_);
312 std::string & columnName)
314 columnName = sqlite3_column_name(
stmt_, colNum-1);
321 bool typeFound =
false;
323 char const* declType = sqlite3_column_decltype(
stmt_, colNum-1);
325 if ( declType == NULL )
327 static char const* s_char =
"char";
331 std::string dt = declType;
334 std::transform(dt.begin(), dt.end(), dt.begin(), tolower);
336 if (dt.find(
"time", 0) != std::string::npos)
341 if (dt.find(
"date", 0) != std::string::npos)
347 if (dt.find(
"int8", 0) != std::string::npos || dt.find(
"bigint", 0) != std::string::npos)
352 else if (dt.find(
"unsigned big int", 0) != std::string::npos)
357 else if (dt.find(
"int", 0) != std::string::npos)
363 if (dt.find(
"float", 0) != std::string::npos || dt.find(
"double", 0) != std::string::npos)
368 if (dt.find(
"text", 0) != std::string::npos)
373 if (dt.find(
"char", 0) != std::string::npos)
378 if (dt.find(
"boolean", 0) != std::string::npos)
395 int const sqlite3_type = sqlite3_column_type(
stmt_, colNum-1);
396 switch (sqlite3_type)
413 sqlite3_reset(
stmt_);
exec_fetch_result load_rowset(int totalRows)
sqlite3_statement_backend(sqlite3_session_backend &session)
virtual void describe_column(int colNum, data_type &dtype, std::string &columnName)
virtual sqlite3_vector_use_type_backend * make_vector_use_type_backend()
virtual exec_fetch_result fetch(int number)
virtual sqlite3_standard_into_type_backend * make_into_type_backend()
virtual sqlite3_vector_into_type_backend * make_vector_into_type_backend()
virtual int prepare_for_describe()
long long rowsAffectedBulk_
virtual exec_fetch_result execute(int number)
exec_fetch_result load_one()
virtual sqlite3_standard_use_type_backend * make_use_type_backend()
sqlite3_recordset useData_
virtual int get_number_of_rows()
virtual long long get_affected_rows()
virtual std::string rewrite_for_procedure_call(std::string const &query)
sqlite_api::sqlite3_stmt * stmt_
virtual void prepare(std::string const &query, details::statement_type eType)
sqlite3_session_backend & session_
sqlite3_recordset dataCache_
sqlite_api::sqlite3 * conn_
exec_fetch_result bind_and_execute(int number)