[PyKDE] QSqlRecordInfo iteration...
Hans-Peter Jansen
hpj at urpla.net
Thu Jul 4 19:18:00 BST 2002
Hi Phil,
today I've tried to iterate through the fields of a table, similar to
void SqlEx::dbConnect() in sqlex.ui.h. While iterating through the
list of tables is perfectly possible, the same action failed for
a QValueList of QSqlRecordInfos. This is the corresponding c++ code:
QStringList tables = db->tables();
for ( QStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) {
QListViewItem* lvi = new QListViewItem( lv, *it );
QSqlRecordInfo ri = db->recordInfo ( *it );
for ( QSqlRecordInfo::Iterator it = ri.begin(); it != ri.end(); ++it ) {
QString req;
if ( (*it).isRequired() > 0 ) {
req = "Yes";
} else if ( (*it).isRequired() == 0 ) {
req = "No";
} else {
req = "?";
}
QListViewItem* fi = new QListViewItem( lvi, (*it).name(), +
QVariant::typeToName((*it).type() ), req );
lvi->insertItem( fi );
}
lv->insertItem( lvi );
}
I bluntly patched sip/qvaluelist.sip with something hopefully taking the
right direction, but unfortunetely siping failed:
sip: QSqlRecordInfo is undefined
******************************************************************************
Error: /usr/local/bin/sip failed with an exit code of 1.
Now, that I haven't any real grasp on sip, I'm stuck.
Any ideas, how to preceed?
Hans-Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qvaluelist.dif
Type: application/octet-stream
Size: 1198 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020704/8418ca27/qvaluelist.obj
More information about the PyQt
mailing list