blob: da9ecb22e4073c7066e1f988ca75317a37edb608 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// file : odb/sql-token.cxx
// license : GNU GPL v3; see accompanying LICENSE file
#include <ostream>
#include <odb/sql-token.hxx>
using namespace std;
static char punctuation_literals[] = {';', ',', '(', ')', '='};
string sql_token::
string () const
{
switch (type ())
{
case sql_token::t_eos:
{
return "<end-of-stream>";
}
case sql_token::t_identifier:
{
return identifier ();
}
case sql_token::t_punctuation:
{
return std::string (1, punctuation_literals[punctuation ()]);
}
case sql_token::t_string_lit:
case sql_token::t_int_lit:
case sql_token::t_float_lit:
{
return literal ();
}
}
return "";
}
ostream&
operator<< (ostream& os, sql_token const& t)
{
return os << t.string ();
}
|