Changeset: b44ef7e41086 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b44ef7e41086
Modified Files:
        monetdb5/mal/mal_instruction.mx
        monetdb5/tests/gdkTests/Tests/casts.mal
        monetdb5/tests/gdkTests/Tests/casts.stable.out
        monetdb5/tests/gdkTests/Tests/casts.stable.out.SunOS5.10
        monetdb5/tests/gdkTests/Tests/casts.stable.out.SunOS5.10.oid64
        monetdb5/tests/gdkTests/Tests/casts.stable.out.Windows
        monetdb5/tests/gdkTests/Tests/casts.stable.out.Windows.64bit.oid64
        monetdb5/tests/gdkTests/Tests/casts.stable.out.oid64
Branch: default
Log Message:

Merge with Apr2012 branch.


diffs (truncated from 13389 to 300 lines):

diff --git a/monetdb5/mal/mal_instruction.mx b/monetdb5/mal/mal_instruction.mx
--- a/monetdb5/mal/mal_instruction.mx
+++ b/monetdb5/mal/mal_instruction.mx
@@ -1495,22 +1495,23 @@ convertConstant(int type, ValPtr vr)
        if (vr->vtype == TYPE_str) {
                int ll = 0;
                ptr d = NULL;
+               char *s = vr->val.sval;
 
                ATOMfromstr(type, &d, &ll, vr->val.sval);
                if (d == NULL) {
                        VALinit(vr, type, ATOMnilptr(type));
-                       throw(SYNTAX, "convertConstant", "parse error in '%s'", 
vr->val.sval);
+                       throw(SYNTAX, "convertConstant", "parse error in '%s'", 
s);
                }
-               if (strncmp(vr->val.sval, "nil", 3) != 0 && ATOMcmp(type, vr, 
ATOMnilptr(type)) == 0) {
+               if (strncmp(vr->val.sval, "nil", 3) != 0 && ATOMcmp(type, d, 
ATOMnilptr(type)) == 0) {
                        GDKfree(d);
                        VALinit(vr, type, ATOMnilptr(type));
-                       throw(SYNTAX, "convertConstant", "parse error in '%s'", 
vr->val.sval);
+                       throw(SYNTAX, "convertConstant", "parse error in '%s'", 
s);
                }
                VALset(vr, type, d);
                if (ATOMextern(type) == 0)
                        GDKfree(d);
                if (vr->vtype != type)
-                       throw(SYNTAX, "convertConstant", "coercion failed in 
'%s'", vr->val.sval);
+                       throw(SYNTAX, "convertConstant", "coercion failed in 
'%s'", s);
        }
 
        if (type == TYPE_bat || isaBatType(type)) {
@@ -1560,10 +1561,10 @@ convertConstant(int type, ValPtr vr)
                vr->len = (int) strlen(w);
                vr->val.sval = w;
                /* VALset(vr, type, w); does not use TYPE-str */
-       }
                if (vr->vtype != type)
                        throw(SYNTAX, "convertConstant", "coercion failed");
                return MAL_SUCCEED;
+       }
 
        case TYPE_bat:
                /* BAT variables can only be set to nil */
diff --git a/monetdb5/tests/gdkTests/Tests/casts.mal 
b/monetdb5/tests/gdkTests/Tests/casts.mal
--- a/monetdb5/tests/gdkTests/Tests/casts.mal
+++ b/monetdb5/tests/gdkTests/Tests/casts.mal
@@ -101,16 +101,34 @@ io.print(2147483648@0:int);
 io.print(2147483649@0:int);
 
 io.printf("# int from str\n");
-io.print("0":int);
-io.print("32767":int);
-io.print("2147483647":int);
-io.print("2147483648":int);
-io.print("2147483649":int);
-io.print("-2147483647":int);
-io.print("-2147483648":int);
-io.print("-2147483649":int);
-io.print("":int);
-io.print("random string":int);
+s := "0"; s_int := calc.int(s); io.print(s_int);
+s := "32767"; s_int := calc.int(s); io.print(s_int);
+s := "2147483647"; s_int := calc.int(s); io.print(s_int);
+s := "2147483648"; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "2147483649"; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-2147483647"; s_int := calc.int(s); io.print(s_int);
+s := "-2147483648"; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-2147483649"; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := ""; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "random string"; s_int := calc.int(s); io.print(s_int);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
 
 io.printf("# to bit\n");
 
@@ -160,12 +178,18 @@ io.print(1073741824@0:bit);
 io.print(2147483647@0:bit);
 
 io.printf("# bit from str\n");
-io.print("true":bit);
-io.print("false":bit);
-io.print("0":bit);
-io.print("1":bit);
-io.print("random string":bit);
-io.print("":bit);
+s := "true"; s_bit := calc.bit(s); io.print(s_bit);
+s := "false"; s_bit := calc.bit(s); io.print(s_bit);
+s := "0"; s_bit := calc.bit(s); io.print(s_bit);
+s := "1"; s_bit := calc.bit(s); io.print(s_bit);
+s := "random string"; s_bit := calc.bit(s); io.print(s_bit);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := ""; s_bit := calc.bit(s); io.print(s_bit);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
 
 io.printf("# to sht\n");
 
@@ -235,15 +259,33 @@ io.print(1073741824@0:sht);
 io.print(2147483647@0:sht);
 
 io.printf("# sht from str\n");
-io.print("0":sht);
-io.print("32767":sht);
-io.print("32768":sht);
-io.print("32769":sht);
-io.print("-32767":sht);
-io.print("-32768":sht);
-io.print("-32769":sht);
-io.print("":sht);
-io.print("random string":sht);
+s := "0"; s_sht := calc.sht(s); io.print(s_sht);
+s := "32767"; s_sht := calc.sht(s); io.print(s_sht);
+s := "32768"; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "32769"; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-32767"; s_sht := calc.sht(s); io.print(s_sht);
+s := "-32768"; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-32769"; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := ""; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "random string"; s_sht := calc.sht(s); io.print(s_sht);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
 
 io.printf("# to long\n");
 
@@ -362,22 +404,40 @@ io.print(9223372036854775808@0:lng);
 io.print(9223372036854775809@0:lng);
 
 io.printf("# lng from str\n");
-io.print("0":lng);
-io.print("32767":lng);
-io.print("2147483647":lng);
-io.print("2147483648":lng);
-io.print("2147483649":lng);
-io.print("-2147483647":lng);
-io.print("-2147483648":lng);
-io.print("-2147483649":lng);
-io.print("":lng);
-io.print("random string":lng);
-io.print("9223372036854775807":lng);
-io.print("9223372036854775808":lng);
-io.print("9223372036854775809":lng);
-io.print("-9223372036854775807":lng);
-io.print("-9223372036854775808":lng);
-io.print("-9223372036854775809":lng);
+s := "0"; s_lng := calc.lng(s); io.print(s_lng);
+s := "32767"; s_lng := calc.lng(s); io.print(s_lng);
+s := "2147483647"; s_lng := calc.lng(s); io.print(s_lng);
+s := "2147483648"; s_lng := calc.lng(s); io.print(s_lng);
+s := "2147483649"; s_lng := calc.lng(s); io.print(s_lng);
+s := "-2147483647"; s_lng := calc.lng(s); io.print(s_lng);
+s := "-2147483648"; s_lng := calc.lng(s); io.print(s_lng);
+s := "-2147483649"; s_lng := calc.lng(s); io.print(s_lng);
+s := ""; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "random string"; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "9223372036854775807"; s_lng := calc.lng(s); io.print(s_lng);
+s := "9223372036854775808"; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "9223372036854775809"; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-9223372036854775807"; s_lng := calc.lng(s); io.print(s_lng);
+s := "-9223372036854775808"; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
+s := "-9223372036854775809"; s_lng := calc.lng(s); io.print(s_lng);
+catch SQLException:str;
+io.printf("Caught exception\n");
+exit SQLException;
 
 io.printf("# to flt\n");
 
@@ -462,98 +522,122 @@ io.print(2147483648@0:flt);
 io.print(2147483649@0:flt);
 
 io.printf("# flt from str\n");
-io.print("0":flt);
-io.print("32767":flt);
-io.print("2147483647":flt);
-io.print("2147483648":flt);
-io.print("2147483649":flt);
-io.print("-2147483647":flt);
-io.print("-2147483648":flt);
-io.print("-2147483649":flt);
-io.print("0.0":flt);
-io.print("0.1":flt);
-io.print("1.0":flt);
-io.print("1e0":flt);
-io.print("1e1":flt);
-io.print("1e10":flt);
-io.print("1e+10":flt);
-io.print("1e-10":flt);
-io.print("1.e0":flt);
-io.print("1.e1":flt);
-io.print("1.e10":flt);
-io.print("1.e+10":flt);
-io.print("1.e-10":flt);
-io.print("1.0e0":flt);
-io.print("1.0e1":flt);
-io.print("1.0e10":flt);
-io.print("1.0e+10":flt);
-io.print("1.0e-10":flt);
-io.print("-0.0":flt);
-io.print("-0.1":flt);
-io.print("-1.0":flt);
-io.print("-1e0":flt);
-io.print("-1e1":flt);
-io.print("-1e10":flt);
-io.print("-1e+10":flt);
-io.print("-1e-10":flt);
-io.print("-1.e0":flt);
-io.print("-1.e1":flt);
-io.print("-1.e10":flt);
-io.print("-1.e+10":flt);
-io.print("-1.e-10":flt);
-io.print("-1.0e0":flt);
-io.print("-1.0e1":flt);
-io.print("-1.0e10":flt);
-io.print("-1.0e+10":flt);
-io.print("-1.0e-10":flt);
-io.print("1E0":flt);
-io.print("1E1":flt);
-io.print("1E10":flt);
-io.print("1E+10":flt);
-io.print("1E-10":flt);
-io.print("1.E0":flt);
-io.print("1.E1":flt);
-io.print("1.E10":flt);
-io.print("1.E+10":flt);
-io.print("1.E-10":flt);
-io.print("1.0E0":flt);
-io.print("1.0E1":flt);
-io.print("1.0E10":flt);
-io.print("1.0E+10":flt);
-io.print("1.0E-10":flt);
-io.print("-1E0":flt);
-io.print("-1E1":flt);
-io.print("-1E10":flt);
-io.print("-1E+10":flt);
-io.print("-1E-10":flt);
-io.print("-1.E0":flt);
-io.print("-1.E1":flt);
-io.print("-1.E10":flt);
-io.print("-1.E+10":flt);
-io.print("-1.E-10":flt);
-io.print("-1.0E0":flt);
-io.print("-1.0E1":flt);
-io.print("-1.0E10":flt);
-io.print("-1.0E+10":flt);
-io.print("-1.0E-10":flt);
+s := "0"; s_flt := calc.flt(s); io.print(s_flt);
+s := "32767"; s_flt := calc.flt(s); io.print(s_flt);
+s := "2147483647"; s_flt := calc.flt(s); io.print(s_flt);
+s := "2147483648"; s_flt := calc.flt(s); io.print(s_flt);
+s := "2147483649"; s_flt := calc.flt(s); io.print(s_flt);
+s := "-2147483647"; s_flt := calc.flt(s); io.print(s_flt);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to