diff --git a/autotest/SqlExp/SqlExp.cpp b/autotest/SqlExp/SqlExp.cpp index fcf986adb..3797c9fec 100644 --- a/autotest/SqlExp/SqlExp.cpp +++ b/autotest/SqlExp/SqlExp.cpp @@ -94,6 +94,8 @@ void Test(int dialect, const char *dialectn, SqlStatement s, const char *q) CONSOLE_APP_MAIN { + StdLogSetup(LOG_COUT|LOG_FILE); + SqlId::UseQuotes(); Date date = Date(2011, 12, 31); @@ -227,5 +229,5 @@ CONSOLE_APP_MAIN LOG("\n\n\n========================================================================="); #include "Test.i" - LOG("OK"); + LOG("================== OK"); } diff --git a/autotest/SqlId/SqlId.cpp b/autotest/SqlId/SqlId.cpp new file mode 100644 index 000000000..dbff97ae9 --- /dev/null +++ b/autotest/SqlId/SqlId.cpp @@ -0,0 +1,39 @@ +#include + +using namespace Upp; + +SQLID(COLUMN) +SQLID(TABLE) + +SQLID(column) +SQLID(table) + +void Test(SqlStatement s, const char *e) +{ + String h = s.Get(PGSQL); + + LOG(h); + LOG(" " << AsCString(h)); + + ASSERT(h == e); +} + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + Test(Select(COLUMN).From(TABLE), "select COLUMN from TABLE"); + SqlId::UseQuotes(); + Test(Select(COLUMN).From(TABLE), "select \"COLUMN\" from \"TABLE\""); + SqlId::ToUpperCase(); + Test(Select(column).From(table), "select \"COLUMN\" from \"TABLE\""); + SqlId::ToLowerCase(); + Test(Select(COLUMN).From(TABLE), "select \"column\" from \"table\""); + SqlId::UseQuotes(false); + SqlId::ToUpperCase(); + Test(Select(column).From(table), "select COLUMN from TABLE"); + SqlId::ToLowerCase(); + Test(Select(COLUMN).From(TABLE), "select column from table"); + + LOG("================ OK"); +} diff --git a/autotest/SqlId/SqlId.upp b/autotest/SqlId/SqlId.upp new file mode 100644 index 000000000..01054587e --- /dev/null +++ b/autotest/SqlId/SqlId.upp @@ -0,0 +1,10 @@ +uses + Core, + Sql; + +file + SqlId.cpp; + +mainconfig + "" = "SSE2"; + diff --git a/autotest/SqlId/init b/autotest/SqlId/init new file mode 100644 index 000000000..1d1dfccee --- /dev/null +++ b/autotest/SqlId/init @@ -0,0 +1,5 @@ +#ifndef _SqlId_icpp_init_stub +#define _SqlId_icpp_init_stub +#include "Core/init" +#include "Sql/init" +#endif