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

Modified Files:
      Tag: SQL_2-16
        bat_sequence.mx 
Log Message:
add sql function get_value_for('sequence name')


Index: bat_sequence.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_sequence.mx,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -d -r1.17.2.1 -r1.17.2.2
--- bat_sequence.mx     23 Jan 2007 13:27:40 -0000      1.17.2.1
+++ bat_sequence.mx     13 Feb 2007 12:06:34 -0000      1.17.2.2
@@ -23,6 +23,7 @@
 extern void sequences_exit(void);
 
 extern int seq_next_value(sql_sequence *seq, lng *val);
+extern int seq_get_value(sql_sequence *seq, lng *val);
 extern int seq_restart(sql_sequence *seq, lng start);
 
 #endif /* BAT_SEQ_H */
@@ -176,3 +177,31 @@
        store_unlock(); 
        return 1;
 }
+
+int
+seq_get_value(sql_sequence *seq, lng *val)
+{
+       node *n = NULL;
+       bat_sequence *s;
+
+       *val = 0;
+       store_lock();
+       for ( n = sql_seqs->h; n; n = n ->next ) {
+               s = n->data;
+               if (s->seqid == seq->base.id)
+                       break;
+       }
+       if (!n) {
+               s = sql_create_sequence(seq);
+               if (!s) {
+                       store_unlock();
+                       return 0;
+               }
+               list_append(sql_seqs, s);
+       } else {
+               s = n->data;
+       }
+       *val = s->cur;
+       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