Home » U++ Library support » U++ SQL » sqlite and Execute
Re: sqlite and Execute [message #25850 is a reply to message #25823] |
Mon, 15 March 2010 20:41 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
forlano wrote on Sun, 14 March 2010 12:18 | Hello,
I followed the tutorial and I come to the following very simple code that should perform a query on an existing database:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <c16/c16.lay>
#include <CtrlCore/lay.h>
#include <plugin/sqlite3/Sqlite3.h>
class c16 : public Withc16Layout<TopWindow> {
public:
void FillRankingTables();
typedef c16 CLASSNAME;
c16();
};
c16::c16()
{
CtrlLayout(*this, "Window title");
Sqlite3Session sqlite3;
if(!sqlite3.Open(ConfigFile("c16.db"))) {
Exclamation("Can't create or open database file");
return;
}
SQL = sqlite3;
SQL.Execute("insert into PUNTI_GIOCATORI (IDFSI,IDCIRCOLO,SIGLAPROV,SIGLAREG) select ID_FSI,IDCIRCOLO,SIGLAPROV,SIGLAREG from ISCRITTI");
}
void c16::FillRankingTables()
{
}
GUI_APP_MAIN
{ c16().Run();
}
No compile error (The .lay file contains a button and is irrilevant... I guess).
The relevant part is the SQL.Execute(...) statement that does nothing. If I copy the string inside Execute and paste into SQliteManager (a Firefox plugin) to run the query it is executed without problem and the table is filled with the right values.
Instead SQL.Execute does not perform the query. What am I missing?
It should be not related to a missing schema file.
Thank you.
Luigi
|
I tried even this
SQL.Execute("INSERT INTO PUNTI_GIOCATORI (IDFSI,IDCIRCOLO,SIGLAPROV,SIGLAREG) SELECT ISCRITTI.ID_FSI,ISCRITTI.IDCIRCOLO,ISCRITTI.SIGLAPROV,ISCRITTI.SIGLAREG FROM ISCRITTI");
that is run without problem in sqlitemanager but gives the following error in Upp:
SQL* INSERT INTO PUNTI_GIOCATORI (IDFSI,IDCIRCOLO,SIGLAPROV,SIGLAREG) SELECT ISCRITTI.ID_FSI,ISCRITTI.IDCIRCOLO,ISCRITTI.SIGLAPROV,ISCRIT TI.SIGLAREG FROM ISCRITTI
ERROR SQL logic error or missing database(0): INSERT INTO PUNTI_GIOCATORI (IDFSI,IDCIRCOLO,SIGLAPROV,SIGLAREG) SELECT ISCRITTI.ID_FSI,ISCRITTI.IDCIRCOLO,ISCRITTI.SIGLAPROV,ISCRIT TI.SIGLAREG FROM ISCRITTI
|
|
|
Goto Forum:
Current Time: Thu May 09 15:49:26 CEST 2024
Total time taken to generate the page: 0.02587 seconds
|