diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-22 14:10:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-22 17:57:00 +0200 |
commit | bc9e3154a6ebe08c65c3be66cf642c30c5c1a726 (patch) | |
tree | 77c1bf0021980ce3d2edf1ac3d4be209bbd71917 /odb/relational/mysql/context.cxx | |
parent | cfc64a1b06cbef49050bc4555a60806b59d90f8b (diff) |
Parse and store MySQL ENUM enumerator strings
Diffstat (limited to 'odb/relational/mysql/context.cxx')
-rw-r--r-- | odb/relational/mysql/context.cxx | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/odb/relational/mysql/context.cxx b/odb/relational/mysql/context.cxx index 8fe19fe..84f2bf6 100644 --- a/odb/relational/mysql/context.cxx +++ b/odb/relational/mysql/context.cxx @@ -589,11 +589,35 @@ namespace relational // if (r.type == sql_type::ENUM || r.type == sql_type::SET) { - // Skip tokens until we get the closing paren. - // - while (t.type () != sql_token::t_eos && - t.punctuation () != sql_token::p_rparen) + while (true) + { + if (t.type () != sql_token::t_string_lit) + { + cerr << m.file () << ":" << m.line () << ":" << m.column () + << ": error: string literal expected in MySQL ENUM " + << "or SET declaration" << endl; + + throw generation_failed (); + } + + if (r.type == sql_type::ENUM) + r.enumerators.push_back (t.literal ()); + t = l.next (); + + if (t.punctuation () == sql_token::p_rparen) + break; + else if (t.punctuation () != sql_token::p_comma) + { + cerr << m.file () << ":" << m.line () << ":" << m.column () + << ": error: comma expected in MySQL ENUM or " + << "SET declaration" << endl; + + throw generation_failed (); + } + + t = l.next (); + } } else { |