Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16657/src/backends/monet5

Modified Files:
        sql.mx 
Log Message:
propagated changes of Thursday Sep 17 2009 - Monday Sep 21 2009
from the Aug2009 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/09/17 - nielsnes: src/backends/monet5/sql.mx,1.347.2.3
fix overflow bug
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2009/09/19 - nielsnes: src/backends/monet5/sql.mx,1.347.2.4
fix bigendian problem (lng != bat)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.357
retrieving revision 1.358
diff -u -d -r1.357 -r1.358
--- sql.mx      6 Sep 2009 12:24:28 -0000       1.357
+++ sql.mx      21 Sep 2009 14:13:27 -0000      1.358
@@ -675,7 +675,7 @@
 
 command calc.second_interval( v:@1, ek:int, sk:int ) :lng
 address second_interv...@1
-comment "cast @1 to a month_interval and check for overflow";
+comment "cast @1 to a second_interval and check for overflow";
 @mal
 
 @:mal_interval(str)@
@@ -684,6 +684,7 @@
 @:mal_interval(int)@
 @:mal_interval(wrd)@
 @:mal_interval(lng)@
+@:mal_interval(daytime)@
 
 command calc.rowid(v:any_1, schema:str, table:str) :oid
 address sql_rowid
@@ -1074,6 +1075,7 @@
 @:c_interval_export(int)@
 @:c_interval_export(wrd)@
 @:c_interval_export(lng)@
+@:c_interval_export(daytime)@
 @= simpleupcast_export
 sql5_export str @2...@1( @1 *res, @2 *v );
 sql5_export str b...@2_2_@1( int *res, int *v );
@@ -1525,7 +1527,7 @@
        throw(SQL, "sql.next_value", "error");
 }
 
-/* str mvc_bat_next_value(int *res, int *sid, str *seqname); */
+/* str mvc_bat_next_value(bat *res, int *sid, str *seqname); */
 str
 mvc_bat_next_value(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
@@ -1537,7 +1539,7 @@
        sql_sequence *seq = NULL;
        seqbulk *sb = NULL;
        BATiter bi;
-       lng *res  = (lng *) getArgReference(stk, pci, 0);
+       bat *res  = (bat *) getArgReference(stk, pci, 0);
        int *sid  = (int *) getArgReference(stk, pci, 1);
        str *seqname  = (str *) getArgReference(stk, pci, 2);
 
@@ -2780,7 +2782,7 @@
                        lres = (((*v + rnd)/scales[dff])*scales[dff]);
                else
                        lres = (((*v - rnd)/scales[dff])*scales[dff]);
-               assert((lng) g...@1_min <= lres && lres <= (lng) g...@1_max);
+               assert((lng) g...@1_min < lres && lres <= (lng) g...@1_max);
                *res = (@1) lres;
        } else if (*r <= 0 && -*r + *s > 0) {
                int dff = -*r + *s;
@@ -2790,7 +2792,7 @@
                        lres = (((*v + rnd)/scales[dff])*scales[dff]);
                else
                        lres = (((*v - rnd)/scales[dff])*scales[dff]);
-               assert((lng) g...@1_min <= lres && lres <= (lng) g...@1_max);
+               assert((lng) g...@1_min < lres && lres <= (lng) g...@1_max);
                *res = (@1) lres;
        } else {
                *res = *v;
@@ -3197,7 +3199,8 @@
        }
        
        /* see if the number fits in the data type */
-       if (val >= (@3) g...@1_min && val <= (@3) g...@1_max)   {
+       if ((@3)(@1)val > (@3) g...@1_min && 
+           val > (@3) g...@1_min && val <= (@3) g...@1_max)    {
                *res = (@1)val;
                return(MAL_SUCCEED);
        } else {
@@ -3645,7 +3648,7 @@
        if (scale) 
                val = (val+h)/scales[scale];
        /* see if the number fits in the data type */
-       if (val >= g...@1_min && val <= g...@1_max)     {
+       if (val > g...@1_min && val <= g...@1_max)      {
                *res = (@1)val;
                return MAL_SUCCEED;
        } else {
@@ -3683,7 +3686,7 @@
                val = (val+h)/scales[s1-s2];
 
        /* see if the number fits in the data type */
-       if (val >= g...@1_min && val <= g...@1_max)     {
+       if (val > g...@1_min && val <= g...@1_max)      {
                *res = (@1)val;
                return MAL_SUCCEED;
        } else {
@@ -3860,6 +3863,33 @@
 @:c_interval(wrd)@
 @:c_interval(lng)@
 
+str
+second_interval_daytime( lng *res, daytime *s, int *d, int *sk )
+{
+       int k = digits2sk(*d);
+       lng r = *(int*)s;
+
+       (void)sk;
+       switch(k) {
+       case isec:
+               r /= 1000;
+               break;
+       case imin:
+               r /= 60000;
+               break;
+       case ihour:
+               r /= 3600000;
+               break;
+       case iday:      
+               r /= (24*3600000);
+               break;
+       default:
+               throw(ILLARG, "calc.second_interval","illegal argument");
+       }
+       *res = r;
+       return MAL_SUCCEED;
+}
+
 /* str dump_cache(int *r); */
 str
 dump_cache(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to