KDbSqlResult

Search for usage in LXR

KDbSqlResult Class Referenceabstract

#include <KDbSqlResult.h>

Public Member Functions

virtual KDbConnectionconnection () const
 
virtual KDbFieldcreateField (const QString &tableName, int index)=0
 
virtual QSharedPointer< KDbSqlRecordfetchRecord ()=0
 
KDbRecordDatafetchRecordData ()
 
virtual KDbSqlFieldfield (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()

KDbSqlResult::~KDbSqlResult ( )
virtual

Definition at line 30 of file KDbSqlResult.cpp.

Member Function Documentation

◆ connection()

virtual KDbConnection * KDbSqlResult::connection ( ) const
inlinevirtual
Returns
connection for this result

Definition at line 52 of file KDbSqlResult.h.

◆ createField()

virtual KDbField * KDbSqlResult::createField ( const QString & tableName,
int index )
pure virtual

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()

virtual QSharedPointer< KDbSqlRecord > KDbSqlResult::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()

virtual KDbSqlField * KDbSqlResult::field ( int index)
pure virtual
Returns
field index from this result

◆ fieldsCount()

virtual int KDbSqlResult::fieldsCount ( )
pure virtual
Returns
number of fields in this result

◆ lastInsertRecordId()

virtual quint64 KDbSqlResult::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()

virtual KDbResult KDbSqlResult::lastResult ( )
pure virtual
Returns
result of last operation on this SQL result

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 Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.