From 0770beace3b6f944209417f1b4541fa31d443529 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 30 Aug 2013 06:04:01 +0200 Subject: Statement processing/optimization base work --- odb/statement-processing.cxx | 44 ++++++++++++++++++++++++++++++++++++++++++-- odb/statement.hxx | 4 ++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/odb/statement-processing.cxx b/odb/statement-processing.cxx index f647966..ed5bad5 100644 --- a/odb/statement-processing.cxx +++ b/odb/statement-processing.cxx @@ -6,14 +6,19 @@ // to minimize statically-linked object code size when processing // is not used. +//#define LIBODB_DEBUG_STATEMENT_PROCESSING 1 +//#define LIBODB_TRACE_STATEMENT_PROCESSING 1 + #include +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING +# include +#endif + #include using namespace std; -// #define LIBODB_DEBUG_STATEMENT_PROCESSING 1 - namespace odb { typedef char_traits traits; @@ -310,6 +315,13 @@ namespace odb r.append (trailer_begin, trailer_size); } +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING + if (r.size () != n) + cerr << endl + << "old: '" << s << "'" << endl << endl + << "new: '" << r << "'" << endl << endl; +#endif + return; } @@ -395,6 +407,13 @@ namespace odb r += ' '; r.append (trailer_begin, trailer_size); } + +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING + if (r.size () != n) + cerr << endl + << "old: '" << s << "'" << endl << endl + << "new: '" << r << "'" << endl << endl; +#endif } void statement:: @@ -484,6 +503,13 @@ namespace odb r.append (trailer_begin, trailer_size); } +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING + if (r.size () != n) + cerr << endl + << "old: '" << s << "'" << endl << endl + << "new: '" << r << "'" << endl << endl; +#endif + return; } @@ -526,6 +552,13 @@ namespace odb r += ' '; r.append (trailer_begin, trailer_size); } + +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING + if (r.size () != n) + cerr << endl + << "old: '" << s << "'" << endl << endl + << "new: '" << r << "'" << endl << endl; +#endif } void statement:: @@ -766,5 +799,12 @@ namespace odb r.erase (join_pos - 1, n + 1); // Extra one for space. } } + +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING + if (r.size () != n) + cerr << endl + << "old: '" << s << "'" << endl << endl + << "new: '" << r << "'" << endl << endl; +#endif } } diff --git a/odb/statement.hxx b/odb/statement.hxx index 00ffa2e..79a8524 100644 --- a/odb/statement.hxx +++ b/odb/statement.hxx @@ -84,8 +84,8 @@ namespace odb // SELECT\n // [schema.]table.a,\n // alias.b\n - // FROM [schema.]table\n - // [LEFT JOIN [schema.]table [AS alias] ON ...\n]* + // FROM [schema.]table[\n] + // [LEFT JOIN [schema.]table [AS alias] ON ...[\n]]* // [WHERE ...] // static void -- cgit v1.1