dodo  0.0.1
A C++ library to create containerized Linux services
dodo::persist::sqlite::DML Class Reference

Data Modification Language statements can take bind values. More...

#include <sqlite.hpp>

Inheritance diagram for dodo::persist::sqlite::DML:
Collaboration diagram for dodo::persist::sqlite::DML:

Public Member Functions

 DML (const Database &db)
 Constructor. More...
 
virtual ~DML ()
 Destructor. More...
 
void bind (const std::string &name, const common::Bytes &value)
 Bind a string value to the bind by name. More...
 
void bind (const std::string &name, const std::string &value)
 Bind a string value to the bind by name. More...
 
void bind (const std::string &name, double value)
 Bind a string value to the bind by name. More...
 
void bind (const std::string &name, int value)
 Bind a string value to the bind by name. More...
 
void bind (const std::string &name, int64_t value)
 Bind a string value to the bind by name. More...
 
void bind (int position, const common::Bytes &value)
 Bind an Bytes value to the bind at position. More...
 
void bind (int position, const std::string &value)
 Bind a string value to the bind at position. More...
 
void bind (int position, double value)
 Bind a double value to the bind at position. More...
 
void bind (int position, int value)
 Bind an int value to the bind at position. More...
 
void bind (int position, int64_t value)
 Bind a int64_t value to the bind at position. More...
 
int execute ()
 Execute and return the number of rows affected. More...
 
- Public Member Functions inherited from dodo::persist::sqlite::Statement
 Statement (const Database &db)
 Constructor. More...
 
virtual ~Statement ()
 Destructor. More...
 
void close ()
 A statement handle can be explicitly closed without deleting the Statement object itself. More...
 
void prepare (const std::string &sql)
 Prepare a SQL statement. More...
 
void reset (bool clear=true)
 Reset a SQL statement for re-execute or even re-prepare. More...
 

Additional Inherited Members

- Protected Attributes inherited from dodo::persist::sqlite::Statement
sqlite3 * database_
 database handle on which the stmt_ is created. More...
 
sqlite3_stmt * stmt_
 statement handle. More...
 

Detailed Description

Data Modification Language statements can take bind values.

Note that calling reset leaves set bind values intact.

Definition at line 294 of file sqlite.hpp.

Constructor & Destructor Documentation

◆ DML()

dodo::persist::sqlite::DML::DML ( const Database db)

Constructor.

Parameters
dbYhe database context.

Definition at line 400 of file sqlite.cpp.

◆ ~DML()

virtual dodo::persist::sqlite::DML::~DML ( )
inlinevirtual

Destructor.

Definition at line 304 of file sqlite.hpp.

Member Function Documentation

◆ bind() [1/10]

void dodo::persist::sqlite::DML::bind ( const std::string &  name,
const common::Bytes value 
)

Bind a string value to the bind by name.

Note that this is less efficient than binding by index/position.

Parameters
nameThe name of the bind parameter.
valuethe value to bind.

Definition at line 470 of file sqlite.cpp.

References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [2/10]

void dodo::persist::sqlite::DML::bind ( const std::string &  name,
const std::string &  value 
)

Bind a string value to the bind by name.

Note that this is less efficient than binding by index/position.

Parameters
nameThe name of the bind parameter.
valuethe value to bind.

Definition at line 464 of file sqlite.cpp.

References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [3/10]

void dodo::persist::sqlite::DML::bind ( const std::string &  name,
double  value 
)

Bind a string value to the bind by name.

Note that this is less efficient than binding by index/position.

Parameters
nameThe name of the bind parameter.
valuethe value to bind.

Definition at line 446 of file sqlite.cpp.

References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [4/10]

void dodo::persist::sqlite::DML::bind ( const std::string &  name,
int  value 
)

Bind a string value to the bind by name.

Note that this is less efficient than binding by index/position.

Parameters
nameThe name of the bind parameter.
valuethe value to bind.

Definition at line 452 of file sqlite.cpp.

References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [5/10]

void dodo::persist::sqlite::DML::bind ( const std::string &  name,
int64_t  value 
)

Bind a string value to the bind by name.

Note that this is less efficient than binding by index/position.

Parameters
nameThe name of the bind parameter.
valuethe value to bind.

Definition at line 458 of file sqlite.cpp.

References bind(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [6/10]

void dodo::persist::sqlite::DML::bind ( int  position,
const common::Bytes value 
)

Bind an Bytes value to the bind at position.

Parameters
positionthe bind position in the SQL (start with 1)
valuethe value to bind.

Definition at line 439 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::common::Bytes::getArray(), dodo::common::Bytes::getSize(), dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Here is the call graph for this function:

◆ bind() [7/10]

void dodo::persist::sqlite::DML::bind ( int  position,
const std::string &  value 
)

Bind a string value to the bind at position.

Parameters
positionthe bind position in the SQL (start with 1)
valuethe value to bind.

Definition at line 432 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

◆ bind() [8/10]

void dodo::persist::sqlite::DML::bind ( int  position,
double  value 
)

Bind a double value to the bind at position.

Parameters
positionthe bind position in the SQL (start with 1)
valuethe value to bind.

Definition at line 411 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Referenced by bind(), dodo::persist::KVStore::deleteKey(), dodo::persist::KVStore::exists(), dodo::persist::KVStore::filterKeys(), dodo::persist::KVStore::getMetaData(), dodo::persist::KVStore::getValue(), dodo::persist::KVStore::insertKey(), and dodo::persist::KVStore::setKey().

Here is the caller graph for this function:

◆ bind() [9/10]

void dodo::persist::sqlite::DML::bind ( int  position,
int  value 
)

Bind an int value to the bind at position.

Parameters
positionthe bind position in the SQL (start with 1)
valuethe value to bind.

Definition at line 418 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

◆ bind() [10/10]

void dodo::persist::sqlite::DML::bind ( int  position,
int64_t  value 
)

Bind a int64_t value to the bind at position.

Parameters
positionthe bind position in the SQL (start with 1)
valuethe value to bind.

Definition at line 425 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

◆ execute()

int dodo::persist::sqlite::DML::execute ( )

Execute and return the number of rows affected.

Returns
The number of rows affected by the DML statement.

Definition at line 403 of file sqlite.cpp.

References dodo::persist::sqlite::Statement::database_, dodo::persist::sqlite::Statement::stmt_, and throw_Exception.

Referenced by dodo::persist::KVStore::deleteKey(), dodo::persist::KVStore::insertKey(), and dodo::persist::KVStore::setKey().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: