static PyObject *meth_QSqlIndex_setCursorName(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QString* a0; int a0State = 0; QSqlIndex *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QSqlIndex, &sipCpp, sipType_QString,&a0, &a0State)) { Py_BEGIN_ALLOW_THREADS sipCpp->setCursorName(*a0); Py_END_ALLOW_THREADS sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QSqlIndex, sipName_setCursorName, doc_QSqlIndex_setCursorName); return NULL; }
QSqlIndex QMYSQLDriver::primaryIndex( const QString& tablename ) const { QSqlIndex idx; if ( !isOpen() ) return idx; QSqlQuery i = createQuery(); QString stmt( "show index from %1;" ); QSqlRecord fil = record( tablename ); i.exec( stmt.arg( tablename ) ); while ( i.isActive() && i.next() ) { if ( i.value(2).toString() == "PRIMARY" ) { idx.append( *fil.field( i.value(4).toString() ) ); idx.setCursorName( i.value(0).toString() ); idx.setName( i.value(2).toString() ); } } return idx; }