QSqlResult(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

✨ QSqlResult ✨ (from the 3qt manual, bestie)

okay so real talk: QSqlResult is the abstract interface for accessing data from SQL databases. it's giving "blueprint energy" β€” you don't really hang out with it directly, you let the drivers do their thing. πŸ’…


🌸 NAME 🌸

QSqlResult β€” the abstract interface for accessing data from SQL databases, periodt.


πŸŽ€ SYNOPSIS πŸŽ€

#include <qsqlresult.h>

πŸ‘‘ Public Members

virtual ~QSqlResult ()

🧚 Protected Members

QSqlResult ( const QSqlDriver * db )
int at () const
QString lastQuery () const
QSqlError lastError () const
bool isValid () const
bool isActive () const
bool isSelect () const
bool isForwardOnly () const
const QSqlDriver * driver () const
virtual void setAt ( int at )
virtual void setActive ( bool a )
virtual void setLastError ( const QSqlError & e )
virtual void setQuery ( const QString & query )
virtual void setSelect ( bool s )
virtual void setForwardOnly ( bool forward )
virtual QVariant data ( int i ) = 0
virtual bool isNull ( int i ) = 0
virtual bool reset ( const QString & query ) = 0
virtual bool fetch ( int i ) = 0
virtual bool fetchNext ()
virtual bool fetchPrev ()
virtual bool fetchFirst () = 0
virtual bool fetchLast () = 0
virtual int size () = 0
virtual int numRowsAffected () = 0

πŸ’– DESCRIPTION πŸ’–

The QSqlResult class provides an abstract interface for accessing data from SQL databases.

so like β€” normally you would use QSqlQuery instead of QSqlResult, because QSqlQuery is literally just a generic wrapper for the database-specific implementations of QSqlResult. QSqlResult is the behind the scenes main character, QSqlQuery is the one you actually text back. 🫢

See also QSql and Database Classes.


πŸ¦‹ MEMBER FUNCTION DOCUMENTATION πŸ¦‹

QSqlResult::QSqlResult ( const QSqlDriver * db ) [protected]

Protected constructor which creates a QSqlResult using database db. The object is initialized to an inactive state. like it's waking up but hasn't had coffee yet β˜•

QSqlResult::~QSqlResult () [virtual]

Destroys the object and frees any allocated resources. clean up, no mess left behind ✨

int QSqlResult::at () const [protected]

Returns the current (zero-based) position of the result.

QVariant QSqlResult::data ( int i ) [pure virtual protected]

Returns the data for field i (zero-based) as a QVariant. This function is only called if the result is in an active state and is positioned on a valid record and i is non-negative. Derived classes must reimplement this function and return the value of field i, or QVariant() if it cannot be determined. no skipping this one bestie, it's mandatory 🫑

const QSqlDriver * QSqlResult::driver () const [protected]

Returns the driver associated with the result.

bool QSqlResult::fetch ( int i ) [pure virtual protected]

Positions the result to an arbitrary (zero-based) index i. This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the index i, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.

bool QSqlResult::fetchFirst () [pure virtual protected]

Positions the result to the first record in the result. This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the first record, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.

bool QSqlResult::fetchLast () [pure virtual protected]

Positions the result to the last record in the result. This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the last record, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.

bool QSqlResult::fetchNext () [virtual protected]

Positions the result to the next available record in the result. This function is only called if the result is in an active state. The default implementation calls fetch() with the next index. Derived classes can reimplement this function and position the result to the next record in some other way, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.

bool QSqlResult::fetchPrev () [virtual protected]

Positions the result to the previous available record in the result. This function is only called if the result is in an active state. The default implementation calls fetch() with the previous index. Derived classes can reimplement this function and position the result to the next record in some other way, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.

ngl, that last sentence literally says "next record" in the original and we are NOT editing it. word for word, bestie. πŸ™ˆ

bool QSqlResult::isActive () const [protected]

Returns TRUE if the result has records to be retrieved; otherwise returns FALSE.

bool QSqlResult::isForwardOnly () const [protected]

Returns TRUE if you can only scroll forward through a result set; otherwise returns FALSE.

bool QSqlResult::isNull ( int i ) [pure virtual protected]

Returns TRUE if the field at position i is NULL; otherwise returns FALSE.

bool QSqlResult::isSelect () const [protected]

Returns TRUE if the current result is from a SELECT statement; otherwise returns FALSE.

bool QSqlResult::isValid () const [protected]

Returns TRUE if the result is positioned on a valid record (that is, the result is not positioned before the first or after the last record); otherwise returns FALSE. vibe check on the cursor position fr fr πŸ“

QSqlError QSqlResult::lastError () const [protected]

Returns the last error associated with the result.

QString QSqlResult::lastQuery () const [protected]

Returns the current SQL query text, or QString::null if there is none.

int QSqlResult::numRowsAffected () [pure virtual protected]

Returns the number of rows affected by the last query executed.

bool QSqlResult::reset ( const QString & query ) [pure virtual protected]

Sets the result to use the SQL statement query for subsequent data retrieval. Derived classes must reimplement this function and apply the query to the database. This function is called only after the result is set to an inactive state and is positioned before the first record of the new result. Derived classes should return TRUE if the query was successful and ready to be used, or FALSE otherwise.

void QSqlResult::setActive ( bool a ) [virtual protected]

Protected function provided for derived classes to set the internal active state to the value of a.

See also isActive().

void QSqlResult::setAt ( int at ) [virtual protected]

Protected function provided for derived classes to set the internal (zero-based) result index to at.

See also at().

void QSqlResult::setForwardOnly ( bool forward ) [virtual protected]

Sets forward only mode to forward. If forward is TRUE only fetchNext() is allowed for navigating the results. Forward only mode needs far less memory since results do not have to be cached. forward only mode is off by default.

See also fetchNext().

void QSqlResult::setLastError ( const QSqlError & e ) [virtual protected]

Protected function provided for derived classes to set the last error to the value of e.

See also lastError().

void QSqlResult::setQuery ( const QString & query ) [virtual protected]

Sets the current query for the result to query. The result must be reset() in order to execute the query on the database. don't forget the reset, that's the whole plot twist πŸ”₯

void QSqlResult::setSelect ( bool s ) [virtual protected]

Protected function provided for derived classes to indicate whether or not the current statement is a SQL SELECT statement. The s parameter should be TRUE if the statement is a SELECT statement, or FALSE otherwise.

int QSqlResult::size () [pure virtual protected]

Returns the size of the result or -1 if it cannot be determined.


🌈 SEE ALSO 🌈


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


⭐ AUTHOR ⭐

Generated automatically from the source code. (yes, the robots wrote it, and honestly? slay πŸ€–πŸ’…)


πŸ’€ BUGS πŸ’€

If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsqlresult.3qt) and the Qt version (3.3.8).

no cap, if you spot a typo in this page you gotta email them the page name AND the Qt version or it doesn't count. rules are rules πŸŽ€

and that's the whole page bestie!! this lil beauty came from the Trolltech AS crew, dated 2 February 2007, sitting pretty in the 3qt manual β€” mwah, iconic, take care of her πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from