307
307
if (err.isSucceeded()) err = msg.setAttribute("t_message", iMessage);
308
308
if (err.isSucceeded()) err = msg.setAttribute("t_popup", iPopup ? "Y" : "N");
309
309
if (err.isSucceeded()) err = msg.save();
311
//Addition message in global variable in case of no transaction opened
312
if (iPopup) unTransactionnalMessages.push_back(iMessage);
312
//Addition message in global variable in case of
313
if (iPopup) unTransactionnalMessages.push_back(iMessage);
707
707
{//This scope is needed to avoid a warning at remove
708
QSqlDatabase dbfile = QSqlDatabase::addDatabase("QSQLITE", "TEMPORARY");
708
QSqlDatabase dbfile = QSqlDatabase::addDatabase("QSQLITE", "TEMPORARY_LOAD");
709
709
dbfile.setDatabaseName(name);
710
710
if (!dbfile.open()) {
711
711
//Set error message
713
713
err = SKGError(SQLLITEERROR + sqlErr.number(), sqlErr.text());
715
715
//Copy db from file to memory
716
err = SKGServices::copySqliteDatabase(name, &dbfile, getDatabase(), true);
716
err = SKGServices::copySqliteDatabase(&dbfile, getDatabase(), true);
722
722
//Remove database
723
QSqlDatabase::removeDatabase("TEMPORARY");
723
QSqlDatabase::removeDatabase("TEMPORARY_LOAD");
726
726
currentFileName=name;
887
887
if (getDatabaseMode()==CopiedInMemory) {
888
//Remove previous file
889
QFile(name).remove();
891
888
{//This scope is needed to avoid a warning at remove
892
//Copy memory in file
893
QSqlDatabase dbfile = QSqlDatabase::addDatabase("QSQLITE", "TEMPORARY");
894
dbfile.setDatabaseName(name);
895
if (!dbfile.open()) {
889
//Remove previous file
890
if (QFile(name).exists()) {
891
SKGTRACEL(20) << "WARNING: [" << name << "] exists ==> remove it !" << endl;
895
if (QFile(name).exists()) {
896
896
//Set error message
897
QSqlError sqlErr=dbfile.lastError();
898
err = SKGError(SQLLITEERROR + sqlErr.number(), sqlErr.text());
897
err.setReturnCode(ERR_FAIL);
898
err.setMessage(tr("Impossible to remove [%1]").arg(name));
900
//Copy db from memory to file
901
err = SKGServices::copySqliteDatabase(name, &dbfile, getDatabase(), false);
900
//Copy memory in file
901
QSqlDatabase dbfile = QSqlDatabase::addDatabase("QSQLITE", "TEMPORARY_SAVE");
902
dbfile.setDatabaseName(name);
903
if (!dbfile.open()) {
905
QSqlError sqlErr=dbfile.lastError();
906
err = SKGError(SQLLITEERROR + sqlErr.number(), sqlErr.text());
908
//Copy db from memory to file
909
err = SKGServices::copySqliteDatabase(&dbfile, getDatabase(), false);
908
917
//Remove database
909
QSqlDatabase::removeDatabase("TEMPORARY");
918
QSqlDatabase::removeDatabase("TEMPORARY_SAVE");
910
919
} else if (getDatabaseMode()==CopiedInFile) {
911
920
//Rename previous file
912
921
QFile(name).rename(name+".old");
1562
1571
if (output.endsWith("t_name")) output=tr("Name");
1563
1572
else if (output.endsWith("d_date")) output=tr("Date");
1564
1573
else if (output.endsWith("t_savestep")) output=tr("Save");
1574
else if (output.endsWith("t_value")) output=tr("Value");
1575
else if (output.endsWith("d_lastmodifdate")) output=tr("Last modification");