From fa4ee095cf8f7b61fee681e134ce847747e0ec4e Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 26 Feb 2009 11:03:34 +0000 Subject: [PATCH] odbctst git-svn-id: svn://ultimatepp.org/upp/trunk@906 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/Mirrors/main.cpp | 16 ++++++++-------- upptst/odbctst/init | 5 +++++ upptst/odbctst/odbctst.cpp | 21 +++++++++++++++++++++ upptst/odbctst/odbctst.upp | 10 ++++++++++ upptst/odbstst/odbstst.upp | 0 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 upptst/odbctst/init create mode 100644 upptst/odbctst/odbctst.cpp create mode 100644 upptst/odbctst/odbctst.upp create mode 100644 upptst/odbstst/odbstst.upp diff --git a/upptst/Mirrors/main.cpp b/upptst/Mirrors/main.cpp index a24f01379..9831f8dcc 100644 --- a/upptst/Mirrors/main.cpp +++ b/upptst/Mirrors/main.cpp @@ -37,20 +37,20 @@ GUI_APP_MAIN r.DrawText(x, y, String(ch, 1) + String(cl, 1), fnt); } r.NewPage(); - for(int i = 0; i < 10; i++) { + for(int i = 0; i < 18; i++) { int a, b; + do { + a = Random(100) + 1; + b = Random(100) + 1; + } + while(a + b < 0 || a + b > 100); + r.DrawText(10, 10 + 3 * isz.cy / 2 * i, Format("%d + %d =", a, b), fnt); do { a = Random(50) + 1; b = Random(50) + 1; } - while(a + b < 0 || a + b > 50); - r.DrawText(10, 10 + isz.cy * 2 * i, Format("%d + %d = ", a, b), fnt); - do { - a = Random(30) + 1; - b = Random(20) + 1; - } while(a - b < 1); - r.DrawText(2000, 10 + isz.cy * 2 * i, Format("%d - %d = ", a, b), fnt); + r.DrawText(2000, 10 + 3 * isz.cy / 2 * i, Format("%d - %d =", a, b), fnt); } Perform(r); } diff --git a/upptst/odbctst/init b/upptst/odbctst/init new file mode 100644 index 000000000..e016cad6c --- /dev/null +++ b/upptst/odbctst/init @@ -0,0 +1,5 @@ +#ifndef _odbctst_icpp_init_stub +#define _odbctst_icpp_init_stub +#include "Core/init" +#include "ODBC/init" +#endif diff --git a/upptst/odbctst/odbctst.cpp b/upptst/odbctst/odbctst.cpp new file mode 100644 index 000000000..7fd2dd760 --- /dev/null +++ b/upptst/odbctst/odbctst.cpp @@ -0,0 +1,21 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + ODBCSession session; + session.Connect("DRIVER=SQL Server Native Client 10.0;SERVER=QUAD\\SQLEXPRESS;DATABASE=Holly;UID=test;PWD=koblih;"); + LOG("Connected!"); + SQL = session; + Sql sql; + sql.Execute("select ID, TEXT, SINCE, TILL from SUBJECT_ATTR where SINCE > ?", Date(2009, 2, 20)); +// sql.Execute("select ID, TEXT, SINCE, TILL from SUBJECT_ATTR where ID > ?", 1700); + while(sql.Fetch()) { + for(int i = 0; i < sql.GetColumns(); i++) { + const SqlColumnInfo& f = sql.GetColumnInfo(i); + LOG(f.name << '=' << sql[i]); + } + } +} + diff --git a/upptst/odbctst/odbctst.upp b/upptst/odbctst/odbctst.upp new file mode 100644 index 000000000..4841c5841 --- /dev/null +++ b/upptst/odbctst/odbctst.upp @@ -0,0 +1,10 @@ +uses + Core, + ODBC; + +file + odbctst.cpp; + +mainconfig + "" = ""; + diff --git a/upptst/odbstst/odbstst.upp b/upptst/odbstst/odbstst.upp new file mode 100644 index 000000000..e69de29bb