Allow table creation if database user only has access to the existing KBarcode table

pull/1/head
Timothy Pearson 9 years ago
parent ba10527d0e
commit 9e61fbb21f

@ -157,7 +157,6 @@ bool SqlTables::newTables( const TQString & username, const TQString & password,
dbase->setHostName( hostname );
if (dbase->open()) {
if ((driver != "QSQLITE") && (driver != "TQSQLITE"))
{
bool found = false;
@ -177,6 +176,14 @@ bool SqlTables::newTables( const TQString & username, const TQString & password,
}
dbase->close();
TQSqlDatabase::removeDatabase(drivers[driver]->initdb( database ));
} else {
TQSqlError dbError = dbase->lastError();
dbase->close();
TQSqlDatabase::removeDatabase(drivers[driver]->initdb( database ));
if (KMessageBox::warningContinueCancel(0, i18n("<qt>Can't connect to database to create table.") + "<p>" + dbError.driverText() + "<br>" + dbError.databaseText() + i18n("<br>You can continue if the table exists already.</qt>")) == KMessageBox::Cancel) {
return false;
}
}
// The database is created, now connect to the one specified by the user
dbase = TQSqlDatabase::addDatabase(driver, database );
@ -190,7 +197,6 @@ bool SqlTables::newTables( const TQString & username, const TQString & password,
return false;
}
TQSqlQuery query( NULL, dbase );
// barcode_basic
@ -268,13 +274,6 @@ bool SqlTables::newTables( const TQString & username, const TQString & password,
dbase->close();
TQSqlDatabase::removeDatabase( database );
KMessageBox::information( 0, i18n("Created table ")+database+i18n(" successfully!") );
} else {
TQSqlError dbError = dbase->lastError();
dbase->close();
TQSqlDatabase::removeDatabase(drivers[driver]->initdb( database ));
KMessageBox::sorry(0, i18n("Can't connect to database.") + "\n" + dbError.driverText() + "\n" + dbError.databaseText());
return false;
}
return true;
}

Loading…
Cancel
Save