stack_set_number(mvc *sql, const char *name, lng val) #endif { ValRecord *v = stack_get_var(sql, name); if (v != NULL) { #ifdef HAVE_HGE if (v->vtype == TYPE_hge) v->val.hval = val; #endif if (v->vtype == TYPE_lng) v->val.lval = val; if (v->vtype == TYPE_int) v->val.lval = (int) val; if (v->vtype == TYPE_sht) v->val.lval = (sht) val; if (v->vtype == TYPE_bte) v->val.lval = (bte) val; if (v->vtype == TYPE_bit) { if (val) v->val.btval = 1; else v->val.btval = 0; } } }
hge #else lng #endif stack_get_number(mvc *sql, const char *name) { ValRecord *v = stack_get_var(sql, name); return val_get_number(v); }
str stack_get_string(mvc *sql, const char *name) { ValRecord *v = stack_get_var(sql, name); if (!v || v->vtype != TYPE_str) return NULL; return v->val.sval; }
str getSQLoptimizer(mvc *m) { ValRecord *val = stack_get_var(m, "optimizer"); char *pipe = "default_pipe"; if (val && val->val.sval) pipe = val->val.sval; return pipe; }
void stack_set_string(mvc *sql, const char *name, const char *val) { ValRecord *v = stack_get_var(sql, name); if (v != NULL) { if (v->val.sval) _DELETE(v->val.sval); v->val.sval = _STRDUP(val); } }
lng stack_get_number(mvc *sql, char *name) { ValRecord *v = stack_get_var(sql, name); if (v != NULL) { if (v->vtype == TYPE_lng) return v->val.lval; if (v->vtype == TYPE_int) return v->val.ival; if (v->vtype == TYPE_sht) return v->val.shval; if (v->vtype == TYPE_bte) return v->val.btval; if (v->vtype == TYPE_bit) if (v->val.btval) return 1; return 0; } return 0; }
void stack_set_number(mvc *sql, char *name, lng val) { ValRecord *v = stack_get_var(sql, name); if (v != NULL) { if (v->vtype == TYPE_lng) v->val.lval = val; if (v->vtype == TYPE_int) v->val.lval = (int) val; if (v->vtype == TYPE_sht) v->val.lval = (sht) val; if (v->vtype == TYPE_bte) v->val.lval = (bte) val; if (v->vtype == TYPE_bit) { if (val) v->val.btval = 1; else v->val.btval = 0; } } }