Home · Modules · Classes · Namespaces · Functions

QxtSqlPackage Class Reference
[QxtSql module]

The QxtSqlPackage class provides a full serializable QSqlQuery storage More...

    #include <QxtSqlPackage>

Inherits QObject.

Public Functions

Additional Inherited Members


Detailed Description

The QxtSqlPackage class provides a full serializable QSqlQuery storage

Sometimes you want to send sql results over network or store them into files. QxtSqlPackage can provide you a storage that is still valid after the actual QSqlQuery has been destroyed. for confidence the interface is similar to QSqlQuery.


Member Function Documentation

QxtSqlPackage::QxtSqlPackage ( QObject * parent = 0 )

Constructs a QxtSqlPackage with parent.

QxtSqlPackage::QxtSqlPackage ( const QxtSqlPackage & other, QObject * parent = 0 )

Constructs a copy of other with parent.

int QxtSqlPackage::at ()

curent pointer position

int QxtSqlPackage::count () const

Returns the number of rows stored

QByteArray QxtSqlPackage::data () const

Returns serialised data

See also setData().

bool QxtSqlPackage::first ()

point to first entry in storage

QHash<QString, QString> QxtSqlPackage::hash ( int index )

return a specific index as Hash

QHash<QString, QString> QxtSqlPackage::hash ()

return the curent row as Hash

void QxtSqlPackage::insert ( QSqlQuery query )

read from query

read out a QSqlQuery and store the result. you may close the query after reading, the data will stay.

    QxSqlPackage::insert(QSqlQuery::exec("select name,foo,bar from table;"));

bool QxtSqlPackage::isValid ()

Returns true if the package is valid, false otherwise.

bool QxtSqlPackage::last ()

point to last entry in storage

bool QxtSqlPackage::next ()

point to next entry

returns false if there is no next entry. provided for easy porting from QSqlQuery.

    while (query.next())
        {
        }

void QxtSqlPackage::setData ( const QByteArray & data )

Deserialise data

See also data().

QString QxtSqlPackage::value ( const QString & key )

return a column in current row in contrast to QSqlQuery you have to provide the name of the key.

the entry is returned as QString becouse in most cases you need QString anyway, and converting to needed data type is easy.

    QString name = query.value("name");

QxtSqlPackage & QxtSqlPackage::operator= ( const QxtSqlPackage & other )

copy other


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1