KDbSqlResult
#include <KDbSqlResult.h>
Public Member Functions | |
virtual KDbConnection * | connection () const |
virtual KDbField * | createField (const QString &tableName, int index)=0 |
virtual QSharedPointer< KDbSqlRecord > | fetchRecord ()=0 |
KDbRecordData * | fetchRecordData () |
virtual KDbSqlField * | field (int index)=0 |
virtual int | fieldsCount ()=0 |
virtual quint64 | lastInsertRecordId () |
virtual KDbResult | lastResult ()=0 |
Detailed Description
The KDbSqlResult class abstracts result of a raw SQL query preparation by KDbConnection::prepareSql()
The KDbSqlResult object provides low-level access to information about fields of the result and can fetch records by actual execution of the prepared query.
- Note
- the KDbSqlResult object should be deleted before closing the database connection that created it. This is needed because the connection is used by the object to retrieve data or to obtain status information.
Definition at line 44 of file KDbSqlResult.h.
Constructor & Destructor Documentation
◆ KDbSqlResult()
KDbSqlResult::KDbSqlResult | ( | ) |
Definition at line 26 of file KDbSqlResult.cpp.
◆ ~KDbSqlResult()
|
virtual |
Definition at line 30 of file KDbSqlResult.cpp.
Member Function Documentation
◆ connection()
|
inlinevirtual |
- Returns
- connection for this result
Definition at line 52 of file KDbSqlResult.h.
◆ createField()
Creates a KDb field for field index and returns it On failure returns nullptr
.
tableName is the table name and may be used to retrieve information but may be ignored as well if the KDbSqlResult already has field metadata available.
◆ fetchRecord()
|
pure virtual |
Fetches one record.
- Returns
- a shared pointer to the record or a null pointer if there is no record to fetch or on error. Check lastResult() for detailed result. Ownership is transferred to the caller.
◆ fetchRecordData()
KDbRecordData * KDbSqlResult::fetchRecordData | ( | ) |
Convenience method.
Fetches one record and all values into data.
- Returns
- record data object and passes its ownership
nullptr
is returned on error or when there is no record to fetch. Check lastResult() for errors.
Definition at line 34 of file KDbSqlResult.cpp.
◆ field()
|
pure virtual |
- Returns
- field index from this result
◆ fieldsCount()
|
pure virtual |
- Returns
- number of fields in this result
◆ lastInsertRecordId()
|
inlinevirtual |
- Returns
- unique identifier of the most recently inserted record. Typically this is just primary key value. This identifier could be reused when we want to reference just inserted record. If there was no insertion recently performed for the result, std::numeric_limits<quint64>::max() is returned.
Definition at line 88 of file KDbSqlResult.h.
◆ lastResult()
|
pure virtual |
- Returns
- result of last operation on this SQL result
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:09:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.