MCPcopy Create free account
hub / github.com/anse1/sqlsmith / const_expr

Method const_expr

expr.cc:195–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195const_expr::const_expr(prod *p, sqltype *type_constraint)
196 : value_expr(p), expr("")
197{
198 type = type_constraint ? type_constraint : scope->schema->inttype;
199
200 if (type == scope->schema->inttype)
201 expr = to_string(d100());
202 else if (type == scope->schema->booltype)
203 expr += (d6() > 3) ? scope->schema->true_literal : scope->schema->false_literal;
204 else if (dynamic_cast<insert_stmt*>(p) && (d6() > 3))
205 expr += "default";
206 else
207 expr += "cast(null as " + type->name + ")";
208}
209
210funcall::funcall(prod *p, sqltype *type_constraint, bool agg)
211 : value_expr(p), is_aggregate(agg)

Callers

nothing calls this directly

Calls 2

d100Function · 0.85
d6Function · 0.85

Tested by

no test coverage detected