
Originally Posted by
caduel
I get the error on Oracle + linux.
debug your table if driver can find index field from table
If no index is found it not possibel to "auto update" or submitAll().
Mysql = SHOW INDEX FROM table
Ora = select index_name from dba_indexes where table_name='tablename';
on oracle must display a key PRIMARY
if not, set one...
update where what = xx
/* discovery total row whitout limit mysql / to play next prev ... button */
void Mysql_Table::UpdateSumm()
{
/* reset index fieldname */
/* SHOW INDEX FROM table */
INDEXFIELD = "";
FieldNameList.clear();
////int sumcol = rec.count();
while (query.next()) {
grepprimary = query.value(3).toString();
grepprimary = grepprimary.toLower();
grepauto = query.value(5).toString();
grepauto = grepauto.toLower();
///////Q_ASSERT(grepauto.size() > 1); /* no mysql or not connect! or grand not...*/
if (grepprimary == "pri" && grepauto.contains("auto")) {
INDEXFIELD = query.value(0).toString();
//////////qDebug() << "### INDEXFIELD have found " << INDEXFIELD ;
}
FieldNameList.append(query.value(0).toString());
}
if (INDEXFIELD.size() < 1) {
haveindex = false;
} else {
haveindex = true;
}
totalrow = 0;
if (haveindex) {
const QString summitem
= QString("SELECT COUNT(%2) FROM %1").
arg(table
).
arg(INDEXFIELD
);
query.exec(summitem);
while (query.next()) {
totalrow = query.value(0).toInt();
}
}
qDebug() << "### totalrow " << totalrow;
}
/* discovery total row whitout limit mysql / to play next prev ... button */
void Mysql_Table::UpdateSumm()
{
QString grepprimary,grepauto;
/* reset index fieldname */
/* SHOW INDEX FROM table */
INDEXFIELD = "";
FieldNameList.clear();
const QString info = QString("SHOW COLUMNS FROM %1").arg(table);
QSqlQuery query(info,db);
QSqlRecord rec = query.record();
////int sumcol = rec.count();
while (query.next()) {
grepprimary = query.value(3).toString();
grepprimary = grepprimary.toLower();
grepauto = query.value(5).toString();
grepauto = grepauto.toLower();
///////Q_ASSERT(grepauto.size() > 1); /* no mysql or not connect! or grand not...*/
if (grepprimary == "pri" && grepauto.contains("auto")) {
INDEXFIELD = query.value(0).toString();
//////////qDebug() << "### INDEXFIELD have found " << INDEXFIELD ;
}
FieldNameList.append(query.value(0).toString());
}
if (INDEXFIELD.size() < 1) {
haveindex = false;
} else {
haveindex = true;
}
totalrow = 0;
if (haveindex) {
const QString summitem = QString("SELECT COUNT(%2) FROM %1").arg(table).arg(INDEXFIELD);
query.exec(summitem);
while (query.next()) {
totalrow = query.value(0).toInt();
}
}
qDebug() << "### totalrow " << totalrow;
}
To copy to clipboard, switch view to plain text mode
Bookmarks