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

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


Index: sql_server.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet4/sql_server.mx,v
retrieving revision 1.157
retrieving revision 1.157.2.1
diff -u -d -r1.157 -r1.157.2.1
--- sql_server.mx       3 Jan 2007 12:39:25 -0000       1.157
+++ sql_server.mx       13 Feb 2007 12:06:33 -0000      1.157.2.1
@@ -77,6 +77,9 @@
        .COMMAND mvc_next_value( mvc m, str sequence ) : lng = mvc_next_value;
                "return the next value of the sequence"
 
+       .COMMAND mvc_get_value( mvc m, str sequence ) : lng = mvc_get_value;
+               "return the current value of the sequence"
+
        .COMMAND mvc_restart_seq( mvc m, str sequence, lng start ) : lng = 
mvc_restart_seq;
                "restart the sequence with value start"
 @-
@@ -425,6 +428,20 @@
        }
        return GDK_FAIL;
 }
+int
+mvc_get_value(lng *res, mvc *C, str seqname)
+{
+       mvc *c = *(mvc**)C;
+       sql_schema *s = c->session->schema;
+
+       if (s) {
+               sql_sequence *seq = find_sql_sequence(s, seqname);
+
+               if (seq && seq_get_value(seq, res))
+                       return GDK_SUCCEED;
+       }
+       return GDK_FAIL;
+}
 
 int
 mvc_restart_seq(lng *res, mvc *C, str seqname, lng *start)
@@ -1367,6 +1384,9 @@
 proc next_value( str v ) : lng {
        return mvc_next_value(myc, v);
 }
+proc get_value( str v ) : lng {
+       return mvc_get_value(myc, v);
+}
 proc restart( str seq, lng v ) : lng {
        return mvc_restart_seq(myc, seq, v);
 }


-------------------------------------------------------------------------
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