diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-30 06:04:01 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-30 06:04:01 +0200 |
commit | 0770beace3b6f944209417f1b4541fa31d443529 (patch) | |
tree | 7014d6663b7c694acf3f6e6c60f200f666eb2777 | |
parent | 08022a07eead928949be5581f1202a197bf68551 (diff) |
Statement processing/optimization base work
-rw-r--r-- | odb/statement-processing.cxx | 44 | ||||
-rw-r--r-- | 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 <cassert> +#ifdef LIBODB_TRACE_STATEMENT_PROCESSING +# include <iostream> +#endif + #include <odb/statement.hxx> using namespace std; -// #define LIBODB_DEBUG_STATEMENT_PROCESSING 1 - namespace odb { typedef char_traits<char> 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 |