18 using std::shared_ptr;
22 static map<string, struct sqltype*> typemap;
23 static struct sqltype *get(
string s);
40 column(
string name) : name(name) { }
48 virtual vector<column> &columns() {
return cols; }
53 virtual string ident() {
return name; }
62 virtual vector<column>& columns() {
return rel->columns(); }
69 vector<string> constraints;
70 table(
string name,
string schema,
bool insertable,
bool base_table)
73 is_insertable(insertable),
74 is_base_table(base_table) { }
75 virtual string ident() {
return schema +
"." + name; }
84 vector<named_relation*>
refs;
87 shared_ptr<map<string,unsigned int> >
stmt_seq;
88 scope(
struct scope *parent = 0) : parent(parent) {
96 vector<pair<named_relation*, column> > refs_of_type(
sqltype *t) {
97 vector<pair<named_relation*, column> > result;
99 for (
auto c : r->columns())
101 result.push_back(make_pair(r,c));
106 string result(prefix);
108 result += std::to_string((*
stmt_seq)[result]++);
113 stmt_seq = std::make_shared<map<string,unsigned int> >();
123 : name(n), left(l), right(r), result(res) { }
128 string specific_name;
130 vector<sqltype *> argtypes;
134 : specific_name(specific_name),
schema(
schema), restype(data_type), name(name) {
137 virtual string ident() {
139 return schema +
"." + name;
void new_stmt()
Reset unique identifier counters.
vector< named_relation * > tables
available to table_ref productions
vector< named_relation * > refs
available to column_ref productions
shared_ptr< map< string, unsigned int > > stmt_seq
Counters for prefixed stmt-unique identifiers.
string stmt_uid(const char *prefix)
Generate unique identifier with prefix.
virtual bool consistent(struct sqltype *rvalue)
This function is used to model postgres-style pseudotypes.