An abstract base class for interfacing with relational databases.
More...
#include <backend.hpp>
|
class | Cursor |
| An abstract base class for cursors that iterate result sets returned by relational database. More...
|
|
class | Result |
|
|
virtual | ~Backend () |
| empty
|
|
virtual bool | supportsSequences () const |
| return true if backend supports CREATE SEQUENCE - SQL-statements
|
|
virtual std::string | getSQLType (AT_field_type fieldType, const std::string &length="") const |
|
virtual std::string | getCreateSequenceSQL (const std::string &name) const |
|
virtual std::string | getSeqSQL (const std::string &sname) const |
|
virtual std::string | getRowIDType () const |
| backend may want to set an AUTO_INCREMENT-attribute for table's primary key field. More...
|
|
virtual std::string | getInsertID () const |
| if backend supports this, new primary key of the last insert is returned
|
|
virtual void | begin () const |
| begin SQL transaction, may or may not have an effect
|
|
virtual void | commit () const |
| commit SQL transaction
|
|
virtual void | rollback () const |
| rollback SQL transaction
|
|
virtual Result * | execute (const std::string &query) const =0 |
| executes SQL-query More...
|
|
virtual Cursor * | cursor (const std::string &query) const =0 |
| executes SQL-query More...
|
|
virtual std::string | groupInsert (const Record &tables, const Records &fields, const Records &values, const std::string &sequence) const |
| executes multiple INSERT-statements and assigns same 'row id' for first field of every record More...
|
|
|
static std::unique_ptr< Backend > | getBackend (const std::string &type, const std::string &connInfo) noexcept(false) |
| returns a backend according to Backendtype in type, parameters are specific to backend and are separated by semicolon. More...
|
|
An abstract base class for interfacing with relational databases.
◆ cursor()
virtual Cursor* litesql::Backend::cursor |
( |
const std::string & |
query | ) |
const |
|
pure virtual |
executes SQL-query
- Parameters
-
query | SQL-query to execute |
- Returns
- Cursor-object which can be used to iterate result set row by row without loading everything to memory
◆ execute()
virtual Result* litesql::Backend::execute |
( |
const std::string & |
query | ) |
const |
|
pure virtual |
executes SQL-query
- Parameters
-
query | SQL-query to execute |
- Returns
- Result-object which holds result set of query
Referenced by groupInsert().
◆ getBackend()
unique_ptr< Backend > Backend::getBackend |
( |
const std::string & |
type, |
|
|
const std::string & |
connInfo |
|
) |
| |
|
staticnoexcept |
returns a backend according to Backendtype in type, parameters are specific to backend and are separated by semicolon.
- Parameters
-
type | type of the database backend (supported are : "mysql","postgresql","sqlite3","odbc" |
connInfo | database connection specific parameters (parameters are separated by semicolon) |
- Exceptions
-
◆ getRowIDType()
virtual std::string litesql::Backend::getRowIDType |
( |
| ) |
const |
|
inlinevirtual |
backend may want to set an AUTO_INCREMENT-attribute for table's primary key field.
this method is to deliver the details to database schema
◆ groupInsert()
string Backend::groupInsert |
( |
const Record & |
tables, |
|
|
const Records & |
fields, |
|
|
const Records & |
values, |
|
|
const std::string & |
sequence |
|
) |
| const |
|
virtual |
The documentation for this class was generated from the following files: