Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16404/bat

Modified Files:
      Tag: SQL_2-16
        bat_sequence.mx 
Log Message:
after a cycle we should start a the minvalue not the start value
also return the 'next' free value in get_value_for


Index: bat_sequence.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_sequence.mx,v
retrieving revision 1.17.2.2
retrieving revision 1.17.2.3
diff -u -d -r1.17.2.2 -r1.17.2.3
--- bat_sequence.mx     13 Feb 2007 12:06:34 -0000      1.17.2.2
+++ bat_sequence.mx     13 Feb 2007 16:23:40 -0000      1.17.2.3
@@ -156,8 +156,8 @@
            (seq->minvalue && s->cur < seq->minvalue))
        {
                if (seq->cycle) {
-                       /* cycle to the start value again */
-                       s->cur = seq->start;
+                       /* cycle to the min value again */
+                       s->cur = seq->minvalue;
                        save = 1;
                } else { /* we're out of numbers */
                        store_unlock();
@@ -202,6 +202,20 @@
                s = n->data;
        }
        *val = s->cur;
+       if (s->called)
+               *val += seq->increment;
+       /* handle min/max and cycle */
+       if ((seq->maxvalue && val > seq->maxvalue) ||
+           (seq->minvalue && val < seq->minvalue))
+       {
+               if (seq->cycle) {
+                       /* cycle to the min value again */
+                       val = seq->minvalue;
+               } else { /* we're out of numbers */
+                       store_unlock();
+                       return(0);
+               }
+       }
        store_unlock();
        return 1;
 }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to