SqlitePreparedStatement

Search for usage in LXR

#include <SqlitePreparedStatement.h>

Inheritance diagram for SqlitePreparedStatement:

Public Member Functions

 SqlitePreparedStatement (SqliteConnectionInternal *conn)
 
- Public Member Functions inherited from KDbResultable
 KDbResultable (const KDbResultable &other)
 
void clearResult ()
 
KDbMessageHandlermessageHandler () const
 
KDbResultableoperator= (const KDbResultable &other)
 
KDbResult result () const
 
virtual QString serverResultName () const
 
void setMessageHandler (KDbMessageHandler *handler)
 
void showMessage ()
 

Protected Member Functions

bool bindValue (KDbField *field, const QVariant &value, int arg)
 
QSharedPointer< KDbSqlResultexecute (KDbPreparedStatement::Type type, const KDbField::List &selectFieldList, KDbFieldList *insertFieldList, const KDbPreparedStatementParameters &parameters) override
 
bool prepare (const KDbEscapedString &sql) override
 
SqliteSqlResult * sqlResult ()
 

Protected Attributes

QSharedPointer< KDbSqlResultm_sqlResult
 
- Protected Attributes inherited from KDbResultable
Private *const d
 
KDbResult m_result
 

Detailed Description

Implementation of prepared statements for the SQLite driver.

Definition at line 29 of file SqlitePreparedStatement.h.

Constructor & Destructor Documentation

◆ SqlitePreparedStatement()

SqlitePreparedStatement::SqlitePreparedStatement ( SqliteConnectionInternal * conn)
explicit

Definition at line 24 of file SqlitePreparedStatement.cpp.

◆ ~SqlitePreparedStatement()

SqlitePreparedStatement::~SqlitePreparedStatement ( )
override

Definition at line 32 of file SqlitePreparedStatement.cpp.

Member Function Documentation

◆ bindValue()

bool SqlitePreparedStatement::bindValue ( KDbField * field,
const QVariant & value,
int arg )
protected
Todo
optimize: make a static copy so SQLITE_STATIC can be used
Todo
what about unsigned > INT_MAX ?
Todo
what about unsigned > LLONG_MAX ?

Definition at line 43 of file SqlitePreparedStatement.cpp.

◆ execute()

QSharedPointer< KDbSqlResult > SqlitePreparedStatement::execute ( KDbPreparedStatement::Type type,
const KDbField::List & selectFieldList,
KDbFieldList * insertFieldList,
const KDbPreparedStatementParameters & parameters )
overrideprotectedvirtual

For implementation, executes the prepared statement Type of statement is specified by the type parameter.

selectFieldList specifies fields for SELECT statement. insertFieldList is set to list of fields in INSERT statement. Parameters parameters are passed to the statement, usually using binding.

Todo
fetch result

Implements KDbPreparedStatementInterface.

Definition at line 191 of file SqlitePreparedStatement.cpp.

◆ prepare()

bool SqlitePreparedStatement::prepare ( const KDbEscapedString & sql)
overrideprotectedvirtual

For implementation. Initializes the prepared statement in a backend-dependent way using recently generated sql statement. It should be guaranteed that sql is valid and not empty. For example sqlite3_prepare() is used for SQLite. This is called only when d->dirty == true is encountered on execute(), i.e. when attributes of the object (like WHERE field names) change.

Implements KDbPreparedStatementInterface.

Definition at line 36 of file SqlitePreparedStatement.cpp.

◆ sqlResult()

SqliteSqlResult * SqlitePreparedStatement::sqlResult ( )
inlineprotected

Definition at line 46 of file SqlitePreparedStatement.h.

Member Data Documentation

◆ m_sqlResult

QSharedPointer<KDbSqlResult> SqlitePreparedStatement::m_sqlResult
protected

Definition at line 48 of file SqlitePreparedStatement.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:01 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.