Changeset: 64bfabbaaefe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64bfabbaaefe
Modified Files:
        sql/common/sql_types.c
Branch: Dec2011
Log Message:

Merge with Aug2011 branch.


diffs (68 lines):

diff --git a/monetdb5/modules/kernel/calc.mx b/monetdb5/modules/kernel/calc.mx
--- a/monetdb5/modules/kernel/calc.mx
+++ b/monetdb5/modules/kernel/calc.mx
@@ -341,7 +341,7 @@ comment "Concatenate two strings";
                comment "negative value";
                command sizeof(x:@1):int
                address CALCsizeof@1;
-               command sign(x:@1) :@1 
+               command sign(x:@1) :int
                address CALCunary@1SIGN 
                comment "Returns +1, 0, -1 based on the sign of the given 
expression";
 @= unary_ops
@@ -620,7 +620,7 @@ str CALCsizeof@1(int *res , @1 *a ) {
 @:calc_unop(ABS,calc_abs,@1)@
 @:check_unop(INV,calc_inv,@1)@
 @:calc_unop(NEG,calc_neg,@1)@
-@:calc_unop(SIGN,calc_sign,@1)@
+@:calc_unopint(SIGN,calc_sign,@1)@
 @:calc_length(@1)@
 @
 @c
@@ -1188,6 +1188,20 @@ str CALCunary@3@1(@3 *res , @3 *a ) {
    return(MAL_SUCCEED);
 }
 @
+@= calc_unopint
+calc_export str CALCunary@3@1(int *res , @3 *a );
+str CALCunary@3@1(int *res , @3 *a ) {
+#ifdef DEBUG
+       printf( "CALCunary@3@1\n");
+#endif
+   if (*a == @3_nil) {
+          *res = int_nil;
+   } else {
+                  *res = (int) (@2 (*a));
+   }
+   return(MAL_SUCCEED);
+}
+@
 @= check_unop
 calc_export str CALCunarycheck@3@1(@3 *res , @3 *a );
 str CALCunarycheck@3@1(@3 *res , @3 *a ) {
diff --git a/sql/ChangeLog.Aug2011 b/sql/ChangeLog.Aug2011
--- a/sql/ChangeLog.Aug2011
+++ b/sql/ChangeLog.Aug2011
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Nov  2 2011 Sjoerd Mullender <[email protected]>
+- Changed a bug where the sign() function returned the same type as its
+  argument instead of always an INTEGER.
+
 * Wed Oct 26 2011 Fabian Groffen <[email protected]>
 - Added a fix for bug #2834, which caused weird (failing) behaviour
   with PreparedStatements.
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1307,7 +1307,7 @@ sqltypeinit(void)
                sql_create_func("sql_neg", "calc", "-", *t, NULL, *t, INOUT);
                sql_create_func("sql_pos", "calc", "+", *t, NULL, *t, INOUT);
                sql_create_func("abs", "calc", "abs", *t, NULL, *t, SCALE_FIX);
-               sql_create_func("sign", "calc", "sign", *t, NULL, *t, 
SCALE_FIX);
+               sql_create_func("sign", "calc", "sign", *t, NULL, INT, 
SCALE_NONE);
                /* scale fixing for all numbers */
                sql_create_func("scale_up", "calc", "*", *t, lt->type, *t, 
SCALE_NONE);
                sql_create_func("scale_down", "sql", "dec_round", *t, lt->type, 
*t, SCALE_NONE);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to