|
|
Home » U++ Library support » U++ SQL » gridctrl won't map to schema
gridctrl won't map to schema [message #52412] |
Sun, 22 September 2019 05:32 |
|
Hi all-
I am not sure why my schema won't map to GridCtrl.
Anyone know what can cause that? I put some source code at the bottom of this
msg.
Maybe someone will notice what I did wrong right away.
Thanks for any help,
roboloki
C:\Ultimate++\upp\MyApps\roominder\main.cpp (16): error: 'ID' was not declared in this scope
(): eg.AddIndex(ID);
C:\Ultimate++\upp\MyApps\roominder\main.cpp (16): note: suggested alternative: 'SID'
(): eg.AddIndex(ID);
(): SID
C:\Ultimate++\upp\MyApps\roominder\main.cpp (17): error: 'CATID' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (18): error: 'TASKID' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (19): error: 'DT' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (20): error: 'DT2' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (21): error: 'TM' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (22): error: 'TM2' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (23): error: 'LOC' was not declared in this scope
C:\Ultimate++\upp\MyApps\roominder\main.cpp (24): error: 'EVENT' was not declared in this scope
[code]#include "schedule.h"
#include <CtrlLib/CtrlLib.h>
#include <Sql/sch_schema.h>
#include <Sql/sch_source.h>
Cantonedu::Cantonedu(){
}
void Cantonedu::Setup() {
CtrlLayout(*this, String(t_("roominder")) + " 1.0");
eg.AddIndex(ID);
eg.AddColumn(CATID, t_("Category")).Edit(cId);
eg.AddColumn(TASKID, t_("Task")).Edit(tId);
eg.AddColumn(DT, t_("Start Date")).Edit(d1).Default(GetSysDate());
eg.AddColumn(DT2, t_("End Date")).Edit(d2).Default(GetSysDate());
eg.AddColumn(TM, t_("Start Time")).Edit(t1);
eg.AddColumn(TM2, t_("End Time")).Edit(t2);
eg.AddColumn(LOC, t_("Location")).Edit(es);
eg.AddColumn(EVENT, t_("Event")).Edit(ev);
eg.Appending().Removing().Editing().Accepting().Canceling();
eg.RejectNullRow();
// eg.WhenInsertRow = THISBACK(InsertEG);
// eg.WhenUpdateRow = THISBACK(UpdateEG);
// eg.WhenRemoveRow = THISBACK(RemoveEG);
eg.SetToolBar();
}
GUI_APP_MAIN
{
SQL;
Sqlite3Session sqlite3;
if(!sqlite3.Open(ConfigFile("slashdb"))) {
Exclamation("Can't create or open database file\n");
return;
}
SQL = sqlite3;
#ifdef _DEBUG
SqlSchema sch(SQLITE3);
sqlite3.SetTrace();
All_Tables(sch);
if(sch.ScriptChanged(SqlSchema::UPGRADE))
Sqlite3PerformScript(sch.Upgrade());
if(sch.ScriptChanged(SqlSchema::ATTRIBUTES))
Sqlite3PerformScript(sch.Attributes());
if(sch.ScriptChanged(SqlSchema::CONFIG)) {
Sqlite3PerformScript(sch.ConfigDrop());
Sqlite3PerformScript(sch.Config());
}
sch.SaveNormal();
sqlite3.SetTrace();
#endif
Cantonedu suny;
LoadFromFile(suny);
suny.Setup();
suny.Run();
StoreToFile(suny);
}
#include <GridCtrl/GridCtrl.h>
#include <CtrlLib/CtrlLib.h>
#include <Core/Core.h>
#include <plugin/sqlite3/Sqlite3.h>
using namespace Upp;
#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#define MODEL <roominder/schedule.sch>
#include "Sql/sch_header.h"
#define LAYOUTFILE <roominder/chips.lay>
#include <CtrlCore/lay.h>
class Cantonedu : public WithRooLayout<TopWindow>
{
public:
typedef Cantonedu CLASSNAME;
GridCtrl eg;
Splitter spl;
DropDate d1, d2;
EditTime t1, t2;
EditString es, ev;
EditInt cId, tId;
Cantonedu();
void Setup();
void InsertEG();
void UpdateEG();
void RemoveEG();
};
#endif
TABLE_(SCHEDULE)
INT_ (id) PRIMARY_KEY
DATE_ (dt)
TIME_ (tm)
DATE_ (dt2)
TIME_ (tm2)
STRING_ (loc,40)
INT_ (taskId)
STRING_ (event,55)
INT_ (catId)
END_TABLE
|
|
|
Re: gridctrl won't map to schema [message #52413 is a reply to message #52412] |
Sun, 22 September 2019 09:22 |
coolman
Messages: 114 Registered: April 2006 Location: Czech Republic
|
Experienced Member |
|
|
mtdew3q wrote on Sun, 22 September 2019 05:32Hi all-
I am not sure why my schema won't map to GridCtrl.
...
eg.AddIndex(ID);
eg.AddColumn(CATID, t_("Category")).Edit(cId);
eg.AddColumn(TASKID, t_("Task")).Edit(tId);
eg.AddColumn(DT, t_("Start Date")).Edit(d1).Default(GetSysDate());
eg.AddColumn(DT2, t_("End Date")).Edit(d2).Default(GetSysDate());
eg.AddColumn(TM, t_("Start Time")).Edit(t1);
eg.AddColumn(TM2, t_("End Time")).Edit(t2);
eg.AddColumn(LOC, t_("Location")).Edit(es);
eg.AddColumn(EVENT, t_("Event")).Edit(ev);
eg.Appending().Removing().Editing().Accepting().Canceling();
eg.RejectNullRow();
// eg.WhenInsertRow = THISBACK(InsertEG);
// eg.WhenUpdateRow = THISBACK(UpdateEG);
// eg.WhenRemoveRow = THISBACK(RemoveEG);
eg.SetToolBar();
...
TABLE_(SCHEDULE)
INT_ (id) PRIMARY_KEY
DATE_ (dt)
TIME_ (tm)
DATE_ (dt2)
TIME_ (tm2)
STRING_ (loc,40)
INT_ (taskId)
STRING_ (event,55)
INT_ (catId)
END_TABLE
SqlId are case sensitive.
|
|
|
|
Goto Forum:
Current Time: Tue Apr 23 09:12:27 CEST 2024
Total time taken to generate the page: 0.02259 seconds
|
|
|