*/
void BindInteger(ArgumentIndex position, int value);
- /**
- * Bind int8_t to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt8(ArgumentIndex position, int8_t value);
-
- /**
- * Bind int16 to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt16(ArgumentIndex position, int16_t value);
-
- /**
- * Bind int32 to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt32(ArgumentIndex position, int32_t value);
-
- /**
- * Bind int64 to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt64(ArgumentIndex position, int64_t value);
-
- /**
- * Bind float to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindFloat(ArgumentIndex position, float value);
-
- /**
- * Bind double to the prepared statement argument
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindDouble(ArgumentIndex position, double value);
-
/**
* Bind string to the prepared statement argument
*
*/
void BindBlob(ArgumentIndex position, const RawBuffer &value);
- /**
- * Bind optional int to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInteger(ArgumentIndex position, const boost::optional<int> &value);
-
- /**
- * Bind optional int8 to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt8(ArgumentIndex position, const boost::optional<int8_t> &value);
-
- /**
- * Bind optional int16 to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt16(ArgumentIndex position, const boost::optional<int16_t> &value);
-
- /**
- * Bind optional int32 to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt32(ArgumentIndex position, const boost::optional<int32_t> &value);
-
- /**
- * Bind optional int64 to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindInt64(ArgumentIndex position, const boost::optional<int64_t> &value);
-
- /**
- * Bind optional float to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindFloat(ArgumentIndex position, const boost::optional<float> &value);
-
- /**
- * Bind optional double to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindDouble(ArgumentIndex position, const boost::optional<double> &value);
-
- /**
- * Bind optional string to the prepared statement argument.
- * If optional is not set null will be bound
- *
- * @param position Index of argument to bind value to
- * @param value Value to bind
- */
- void BindBlob(ArgumentIndex position, const boost::optional<RawBuffer> &value);
/**
* Execute the prepared statement and/or move
*/
void Reset();
- /**
- * Checks whether column value is null
- *
- * @throw Exception::InvalidColumn
- */
- bool IsColumnNull(ColumnIndex column);
-
/**
* Get integer value from column in current row.
*
*/
int GetColumnInteger(ColumnIndex column);
- /**
- * Get int8 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- int8_t GetColumnInt8(ColumnIndex column);
-
- /**
- * Get int16 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- int16_t GetColumnInt16(ColumnIndex column);
- /**
- * Get int32 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- int32_t GetColumnInt32(ColumnIndex column);
-
- /**
- * Get int64 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- int64_t GetColumnInt64(ColumnIndex column);
-
- /**
- * Get float value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- float GetColumnFloat(ColumnIndex column);
-
- /**
- * Get double value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- double GetColumnDouble(ColumnIndex column);
-
/**
* Get string value from column in current row.
*
* @throw Exception::InvalidColumn
*/
RawBuffer GetColumnBlob(ColumnIndex column);
-
- /**
- * Get optional integer value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<int> GetColumnOptionalInteger(ColumnIndex column);
-
- /**
- * Get optional int8 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<int8_t> GetColumnOptionalInt8(ColumnIndex column);
-
- /**
- * Get optional int16value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<int16_t> GetColumnOptionalInt16(ColumnIndex column);
-
- /**
- * Get optional int32 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<int32_t> GetColumnOptionalInt32(ColumnIndex column);
-
- /**
- * Get optional int64 value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<int64_t> GetColumnOptionalInt64(ColumnIndex column);
-
- /**
- * Get optional float value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<float> GetColumnOptionalFloat(ColumnIndex column);
-
- /**
- * Get optional double value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<double> GetColumnOptionalDouble(ColumnIndex column);
-
- /**
- * Get string value from column in current row.
- *
- * @throw Exception::InvalidColumn
- */
- boost::optional<RawBuffer> GetColumnOptionalBlob(ColumnIndex column);
};
class DataCommandHandler {
void BindInteger(ArgumentIndex pos, int val) { m_dataCommand.BindInteger(pos, val); }
- void BindInt8(ArgumentIndex pos, int8_t val) { m_dataCommand.BindInt8(pos, val); }
-
- void BindInt16(ArgumentIndex pos, int8_t val) { m_dataCommand.BindInt16(pos, val); }
-
- void BindInt32(ArgumentIndex pos, int8_t val) { m_dataCommand.BindInt32(pos, val); }
-
- void BindInt64(ArgumentIndex pos, int8_t val) { m_dataCommand.BindInt64(pos, val); }
-
- void BindFloat(ArgumentIndex pos, float val) { m_dataCommand.BindFloat(pos, val); }
-
- void BindDouble(ArgumentIndex pos, double val) { m_dataCommand.BindDouble(pos, val); }
-
void BindString(ArgumentIndex pos, const char *val) { m_dataCommand.BindString(pos, val); }
void BindBlob(ArgumentIndex pos, const RawBuffer &val) { m_dataCommand.BindBlob(pos, val); }
- void BindInteger(ArgumentIndex pos, const boost::optional<int> &val)
- {
- m_dataCommand.BindInteger(pos, val);
- }
-
- void BindInt8(ArgumentIndex pos, const boost::optional<int8_t> &val)
- {
- m_dataCommand.BindInt8(pos, val);
- }
-
- void BindInt16(ArgumentIndex pos, const boost::optional<int16_t> &val)
- {
- m_dataCommand.BindInt16(pos, val);
- }
-
- void BindInt32(ArgumentIndex pos, const boost::optional<int32_t> &val)
- {
- m_dataCommand.BindInt32(pos, val);
- }
-
- void BindInt64(ArgumentIndex pos, const boost::optional<int64_t> &val)
- {
- m_dataCommand.BindInt64(pos, val);
- }
-
- void BindFloat(ArgumentIndex pos, const boost::optional<float> &val)
- {
- m_dataCommand.BindFloat(pos, val);
- }
-
- void BindDouble(ArgumentIndex pos, const boost::optional<double> &val)
- {
- m_dataCommand.BindDouble(pos, val);
- }
-
- void BindBlob(ArgumentIndex pos, const boost::optional<RawBuffer> &val)
- {
- m_dataCommand.BindBlob(pos, val);
- }
-
bool Step() { return m_dataCommand.Step(); }
- bool IsColumnNull(ColumnIndex col) { return m_dataCommand.IsColumnNull(col); }
-
int GetColumnInteger(ColumnIndex col) { return m_dataCommand.GetColumnInteger(col); }
- int8_t GetColumnInt8(ColumnIndex col) { return m_dataCommand.GetColumnInt8(col); }
-
- int16_t GetColumnInt16(ColumnIndex col) { return m_dataCommand.GetColumnInt16(col); }
-
- int32_t GetColumnInt32(ColumnIndex col) { return m_dataCommand.GetColumnInt32(col); }
-
- int64_t GetColumnInt64(ColumnIndex col) { return m_dataCommand.GetColumnInt64(col); }
-
- float GetColumnFloat(ColumnIndex col) { return m_dataCommand.GetColumnFloat(col); }
-
- double GetColumnDouble(ColumnIndex col) { return m_dataCommand.GetColumnDouble(col); }
-
std::string GetColumnString(ColumnIndex col) { return m_dataCommand.GetColumnString(col); }
RawBuffer GetColumnBlob(ColumnIndex col) { return m_dataCommand.GetColumnBlob(col); }
- boost::optional<int> GetColumnOptionalInteger(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalInteger(col);
- }
-
- boost::optional<int8_t> GetColumnOptionalInt8(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalInt8(col);
- }
-
- boost::optional<int16_t> GetColumnOptionalInt16(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalInt16(col);
- }
-
- boost::optional<int32_t> GetColumnOptionalInt32(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalInt32(col);
- }
-
- boost::optional<int64_t> GetColumnOptionalInt64(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalInt64(col);
- }
-
- boost::optional<float> GetColumnOptionalFloat(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalFloat(col);
- }
-
- boost::optional<double> GetColumnOptionalDouble(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalDouble(col);
- }
-
- boost::optional<RawBuffer> GetColumnOptionalBlob(ColumnIndex col)
- {
- return m_dataCommand.GetColumnOptionalBlob(col);
- }
-
private:
DataCommand &m_dataCommand;
};
*/
void SetKey(const RawBuffer &rawPass);
- /**
- * ResetKey is used for changing key used for database encryption.
- * If key was already set by using SetKey, this function will only change it.
- * If no key was yet set, this function first will set key with rawPassOld and
- * then change it to rawPassNew.
- * Same rules for failing apply as for SetKey.
- * Both password must have length >=1.
- *
- * @param rawPassOld current password for encryption in raw binary format
- * @param rawPassNew new password for encryption in raw binary format
- *
- */
- void ResetKey(const RawBuffer &rawPassOld,
- const RawBuffer &rawPassNew);
-
/**
* Execute SQL command without result
*
*/
bool CheckTableExist(const char *tableName);
- /**
- * Get last insert operation new row id
- *
- * @return Row ID
- */
- RowID GetLastInsertRowID() const;
-
/**
* Clear prepared SQL statements map
*
<< position << "] -> " << value);
}
-//LCOV_EXCL_START
-void SqlConnection::DataCommand::BindInt8(
- SqlConnection::ArgumentIndex position,
- int8_t value)
-{
- CheckBindResult(sqlite3_bind_int(m_stmt, position,
- static_cast<int>(value)));
- LogPedantic("SQL data command bind int8: ["
- << position << "] -> " << value);
-}
-
-void SqlConnection::DataCommand::BindInt16(
- SqlConnection::ArgumentIndex position,
- int16_t value)
-{
- CheckBindResult(sqlite3_bind_int(m_stmt, position,
- static_cast<int>(value)));
- LogPedantic("SQL data command bind int16: ["
- << position << "] -> " << value);
-}
-
-void SqlConnection::DataCommand::BindInt32(
- SqlConnection::ArgumentIndex position,
- int32_t value)
-{
- CheckBindResult(sqlite3_bind_int(m_stmt, position,
- static_cast<int>(value)));
- LogPedantic("SQL data command bind int32: ["
- << position << "] -> " << value);
-}
-
-void SqlConnection::DataCommand::BindInt64(
- SqlConnection::ArgumentIndex position,
- int64_t value)
-{
- CheckBindResult(sqlite3_bind_int64(m_stmt, position,
- static_cast<sqlite3_int64>(value)));
- LogPedantic("SQL data command bind int64: ["
- << position << "] -> " << value);
-}
-
-void SqlConnection::DataCommand::BindFloat(
- SqlConnection::ArgumentIndex position,
- float value)
-{
- CheckBindResult(sqlite3_bind_double(m_stmt, position,
- static_cast<double>(value)));
- LogPedantic("SQL data command bind float: ["
- << position << "] -> " << value);
-}
-
-void SqlConnection::DataCommand::BindDouble(
- SqlConnection::ArgumentIndex position,
- double value)
-{
- CheckBindResult(sqlite3_bind_double(m_stmt, position, value));
- LogPedantic("SQL data command bind double: ["
- << position << "] -> " << value);
-}
-//LCOV_EXCL_STOP
-
void SqlConnection::DataCommand::BindString(
SqlConnection::ArgumentIndex position,
const char *value)
<< position << "] -> " << raw.size());
}
-//LCOV_EXCL_START
-void SqlConnection::DataCommand::BindInteger(
- SqlConnection::ArgumentIndex position,
- const boost::optional<int> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindInteger(position, *value);
-}
-
-void SqlConnection::DataCommand::BindInt8(
- SqlConnection::ArgumentIndex position,
- const boost::optional<int8_t> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindInt8(position, *value);
-}
-
-void SqlConnection::DataCommand::BindInt16(
- SqlConnection::ArgumentIndex position,
- const boost::optional<int16_t> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindInt16(position, *value);
-}
-
-void SqlConnection::DataCommand::BindInt32(
- SqlConnection::ArgumentIndex position,
- const boost::optional<int32_t> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindInt32(position, *value);
-}
-
-void SqlConnection::DataCommand::BindInt64(
- SqlConnection::ArgumentIndex position,
- const boost::optional<int64_t> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindInt64(position, *value);
-}
-
-void SqlConnection::DataCommand::BindFloat(
- SqlConnection::ArgumentIndex position,
- const boost::optional<float> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindFloat(position, *value);
-}
-
-void SqlConnection::DataCommand::BindDouble(
- SqlConnection::ArgumentIndex position,
- const boost::optional<double> &value)
-{
- if (!value)
- BindNull(position);
- else
- BindDouble(position, *value);
-}
-
-void SqlConnection::DataCommand::BindBlob(
- SqlConnection::ArgumentIndex position,
- const boost::optional<RawBuffer> &value)
-{
- if (!!value)
- BindBlob(position, *value);
- else
- BindNull(position);
-}
-//LCOV_EXCL_STOP
-
bool SqlConnection::DataCommand::Step()
{
// Notify all after potentially synchronized database connection access
ThrowMsg(Exception::InvalidColumn, "Column index is out of bounds");
}
-//LCOV_EXCL_START
-bool SqlConnection::DataCommand::IsColumnNull(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column type: [" << column << "]");
- CheckColumnIndex(column);
- return sqlite3_column_type(m_stmt, column) == SQLITE_NULL;
-}
-//LCOV_EXCL_STOP
-
int SqlConnection::DataCommand::GetColumnInteger(
SqlConnection::ColumnIndex column)
{
return value;
}
-//LCOV_EXCL_START
-int8_t SqlConnection::DataCommand::GetColumnInt8(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column int8: [" << column << "]");
- CheckColumnIndex(column);
- int8_t value = static_cast<int8_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return value;
-}
-
-int16_t SqlConnection::DataCommand::GetColumnInt16(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column int16: [" << column << "]");
- CheckColumnIndex(column);
- int16_t value = static_cast<int16_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return value;
-}
-
-int32_t SqlConnection::DataCommand::GetColumnInt32(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column int32: [" << column << "]");
- CheckColumnIndex(column);
- int32_t value = static_cast<int32_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return value;
-}
-
-int64_t SqlConnection::DataCommand::GetColumnInt64(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column int64: [" << column << "]");
- CheckColumnIndex(column);
- int64_t value = static_cast<int64_t>(sqlite3_column_int64(m_stmt, column));
- LogPedantic(" Value: " << value);
- return value;
-}
-
-float SqlConnection::DataCommand::GetColumnFloat(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column float: [" << column << "]");
- CheckColumnIndex(column);
- float value = static_cast<float>(sqlite3_column_double(m_stmt, column));
- LogPedantic(" Value: " << value);
- return value;
-}
-
-double SqlConnection::DataCommand::GetColumnDouble(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column double: [" << column << "]");
- CheckColumnIndex(column);
- double value = sqlite3_column_double(m_stmt, column);
- LogPedantic(" Value: " << value);
- return value;
-}
-//LCOV_EXCL_STOP
-
std::string SqlConnection::DataCommand::GetColumnString(
SqlConnection::ColumnIndex column)
{
return RawBuffer(value, value + length);
}
-//LCOV_EXCL_START
-boost::optional<int> SqlConnection::DataCommand::GetColumnOptionalInteger(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional integer: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<int>();
-
- int value = sqlite3_column_int(m_stmt, column);
- LogPedantic(" Value: " << value);
- return boost::optional<int>(value);
-}
-
-boost::optional<int8_t> SqlConnection::DataCommand::GetColumnOptionalInt8(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional int8: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<int8_t>();
-
- int8_t value = static_cast<int8_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return boost::optional<int8_t>(value);
-}
-
-boost::optional<int16_t> SqlConnection::DataCommand::GetColumnOptionalInt16(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional int16: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<int16_t>();
-
- int16_t value = static_cast<int16_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return boost::optional<int16_t>(value);
-}
-
-boost::optional<int32_t> SqlConnection::DataCommand::GetColumnOptionalInt32(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional int32: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<int32_t>();
-
- int32_t value = static_cast<int32_t>(sqlite3_column_int(m_stmt, column));
- LogPedantic(" Value: " << value);
- return boost::optional<int32_t>(value);
-}
-
-boost::optional<int64_t> SqlConnection::DataCommand::GetColumnOptionalInt64(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional int64: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<int64_t>();
-
- int64_t value = static_cast<int64_t>(sqlite3_column_int64(m_stmt, column));
- LogPedantic(" Value: " << value);
- return boost::optional<int64_t>(value);
-}
-
-boost::optional<float> SqlConnection::DataCommand::GetColumnOptionalFloat(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional float: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<float>();
-
- float value = static_cast<float>(sqlite3_column_double(m_stmt, column));
- LogPedantic(" Value: " << value);
- return boost::optional<float>(value);
-}
-
-boost::optional<double> SqlConnection::DataCommand::GetColumnOptionalDouble(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column optional double: ["
- << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<double>();
-
- double value = sqlite3_column_double(m_stmt, column);
- LogPedantic(" Value: " << value);
- return boost::optional<double>(value);
-}
-
-boost::optional<RawBuffer> SqlConnection::DataCommand::GetColumnOptionalBlob(
- SqlConnection::ColumnIndex column)
-{
- LogPedantic("SQL data command get column blog: [" << column << "]");
- CheckColumnIndex(column);
-
- if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL)
- return boost::optional<RawBuffer>();
-
- const unsigned char *value = reinterpret_cast<const unsigned char *>(
- sqlite3_column_blob(m_stmt, column));
-
- int length = sqlite3_column_bytes(m_stmt, column);
- LogPedantic("Got blob of length: " << length);
-
- RawBuffer temp(value, value + length);
- return boost::optional<RawBuffer>(temp);
-}
-//LCOV_EXCL_STOP
SqlConnection::DataCommandHandler::~DataCommandHandler() {
LogPedantic("SQL DataCommandHandler finalizing");
try{
m_isKeySet = true;
};
-//LCOV_EXCL_START
-void SqlConnection::ResetKey(const RawBuffer &rawPassOld,
- const RawBuffer &rawPassNew)
-{
- if (m_connection == NULL) {
- LogPedantic("Cannot reset key. No connection to DB!");
- return;
- }
-
- // Binary data for raw password should be 32 bytes long.
- assert(rawPassOld.size() == SQLITE_RAW_DATA_SIZE &&
- rawPassNew.size() == SQLITE_RAW_DATA_SIZE);
-
- // sqlite3_rekey requires for key to be already set
- if (!m_isKeySet)
- SetKey(rawPassOld);
-
- RawBuffer pass = createHexPass(rawPassNew);
- int result = sqlite3_rekey(m_connection, pass.data(), pass.size());
-
- if (result == SQLITE_OK) {
- LogPedantic("Reset key on DB");
- } else {
- //sqlite3_rekey fails only when m_connection == NULL || key == NULL ||
- // key length == 0
- LogError("Failed to reset key on DB");
- ThrowMsg(Exception::InvalidArguments, result);
- }
-}
-//LCOV_EXCL_STOP
-
void SqlConnection::Disconnect()
{
if (m_connection == NULL) {
m_preparedStatements.clear();
}
-//LCOV_EXCL_START
-SqlConnection::RowID SqlConnection::GetLastInsertRowID() const
-{
- return static_cast<RowID>(sqlite3_last_insert_rowid(m_connection));
-}
-//LCOV_EXCL_STOP
-
void SqlConnection::TurnOnForeignKeys()
{
ExecCommand("PRAGMA foreign_keys = ON;");