sql_exp * exp_atom_dbl(sql_allocator *sa, dbl f) { sql_subtype it; sql_find_subtype(&it, "double", 53, 0); return exp_atom(sa, atom_float(sa, &it, (dbl)f )); }
atom * atom_int( sql_allocator *sa, sql_subtype *tpe, #ifdef HAVE_HGE hge val #else lng val #endif ) { if (tpe->type->eclass == EC_FLT) { return atom_float(sa, tpe, (double) val); } else { atom *a = atom_create(sa); a->isnull = 0; a->tpe = *tpe; a->data.vtype = tpe->type->localtype; switch (ATOMstorage(a->data.vtype)) { case TYPE_bte: a->data.val.btval = (bte) val; break; case TYPE_sht: a->data.val.shval = (sht) val; break; case TYPE_int: a->data.val.ival = (int) val; break; case TYPE_wrd: a->data.val.wval = (wrd) val; break; case TYPE_oid: a->data.val.oval = (oid) val; break; case TYPE_lng: a->data.val.lval = (lng) val; break; #ifdef HAVE_HGE case TYPE_hge: a->data.val.hval = val; break; #endif default: printf("atom_int %d\n", a->data.vtype); assert(0); } a->d = (dbl) val; a->data.len = 0; if (atom_debug) fprintf(stderr, "atom_int(%s,%.40g)\n", tpe->type->sqlname, (dbl)val); return a; } }