From 463037682451461e61cce82a31679fb455d1b33a Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 3 Jun 2009 11:50:29 +0000 Subject: [PATCH] syncing uppdev git-svn-id: svn://ultimatepp.org/upp/trunk@1269 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppdev/ArrayCtrl/ArrayCtrl.upp | 2 +- uppdev/sqlite3sch/init | 5 +++++ uppdev/sqlite3sch/schema.sch | 14 +++++++++++++ uppdev/sqlite3sch/sqlite3sch.cpp | 35 ++++++++++++++++++++++++++++++++ uppdev/sqlite3sch/sqlite3sch.upp | 11 ++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 uppdev/sqlite3sch/init create mode 100644 uppdev/sqlite3sch/schema.sch create mode 100644 uppdev/sqlite3sch/sqlite3sch.cpp create mode 100644 uppdev/sqlite3sch/sqlite3sch.upp diff --git a/uppdev/ArrayCtrl/ArrayCtrl.upp b/uppdev/ArrayCtrl/ArrayCtrl.upp index 53fbc3ca6..a4f404cce 100644 --- a/uppdev/ArrayCtrl/ArrayCtrl.upp +++ b/uppdev/ArrayCtrl/ArrayCtrl.upp @@ -1,4 +1,4 @@ -description "\377B0,0,255"; +description "\377B"; uses CtrlLib, diff --git a/uppdev/sqlite3sch/init b/uppdev/sqlite3sch/init new file mode 100644 index 000000000..b480e0e30 --- /dev/null +++ b/uppdev/sqlite3sch/init @@ -0,0 +1,5 @@ +#ifndef _sqlite3sch_icpp_init_stub +#define _sqlite3sch_icpp_init_stub +#include "Core/init" +#include "plugin\sqlite3/init" +#endif diff --git a/uppdev/sqlite3sch/schema.sch b/uppdev/sqlite3sch/schema.sch new file mode 100644 index 000000000..37148e851 --- /dev/null +++ b/uppdev/sqlite3sch/schema.sch @@ -0,0 +1,14 @@ +TABLE_(SUPPLIER) + INT_ (ID) PRIMARY_KEY AUTO_INCREMENT + STRING_ (NAME, 80) NOT_NULL SQLDEFAULT("") + STRING_ (ADDRESS1, 128) + STRING_ (ADDRESS2, 128) + STRING_ (CITY, 128) + STRING_ (STATE, 80) + STRING_ (POSTAL_CODE, 24) + STRING_ (PRIMARY_PHONE, 35) + STRING_ (SECONDARY_PHONE, 35) + STRING_ (EMAIL, 128) + STRING_ (WEB_ADDRESS, 500) + BLOB_ (DESCRIPTION) +END_TABLE diff --git a/uppdev/sqlite3sch/sqlite3sch.cpp b/uppdev/sqlite3sch/sqlite3sch.cpp new file mode 100644 index 000000000..826a60bbd --- /dev/null +++ b/uppdev/sqlite3sch/sqlite3sch.cpp @@ -0,0 +1,35 @@ +#include +#include + +using namespace Upp; + +#define SCHEMADIALECT +#define MODEL +#include "Sql/sch_header.h" + +#include +#include + +CONSOLE_APP_MAIN +{ + Sqlite3Session sqlite3; + if(!sqlite3.Open(ConfigFile("simple.db"))) { + Cout() << "Can't create or open database file\n"; + return; + } + +#ifdef _DEBUG + sqlite3.SetTrace(); +#endif + + + SQL = sqlite3; + + SQL.Execute("drop table SUPPLIER"); + + SqlSchema sch(SQLITE3); + All_Tables(sch); + SqlPerformScript(sch.Upgrade()); + SqlPerformScript(sch.Attributes()); + SQL.ClearError(); +} diff --git a/uppdev/sqlite3sch/sqlite3sch.upp b/uppdev/sqlite3sch/sqlite3sch.upp new file mode 100644 index 000000000..fff87f832 --- /dev/null +++ b/uppdev/sqlite3sch/sqlite3sch.upp @@ -0,0 +1,11 @@ +uses + Core, + plugin\sqlite3; + +file + sqlite3sch.cpp, + schema.sch; + +mainconfig + "" = ""; +