| 193 | } |
| 194 | |
| 195 | const_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 | |
| 210 | funcall::funcall(prod *p, sqltype *type_constraint, bool agg) |
| 211 | : value_expr(p), is_aggregate(agg) |