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

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


Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.207.2.2
retrieving revision 1.207.2.3
diff -u -d -r1.207.2.2 -r1.207.2.3
--- sql.mx      31 Jan 2007 10:18:55 -0000      1.207.2.2
+++ sql.mx      13 Feb 2007 12:06:33 -0000      1.207.2.3
@@ -93,6 +93,10 @@
 address mvc_next_value
 comment "return the next value of the sequence";
 
+command get_value( sequence:str ):lng
+address mvc_get_value
+comment "return the current value of the sequence";
+
 command restart( sequence:str, start:lng ):lng
 address mvc_restart_seq
 comment "restart the sequence with value start";
@@ -583,6 +587,7 @@
 sql5_export str getVariable(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 sql5_export str sql_variables(int *res);
 sql5_export str mvc_next_value(lng *res, str *seqname);
+sql5_export str mvc_get_value(lng *res, str *seqname);
 sql5_export str mvc_restart_seq(lng *res, str *seqname, lng *start);
 sql5_export str mvc_affected_rows_int(int *r, int *nr, str *w);
 sql5_export str zero_or_one(ptr ret, int *bid);
@@ -951,6 +956,25 @@
 }
 
 str
+mvc_get_value(lng *res, str *seqname)
+{
+       mvc *m = NULL;
+       str msg = getContext(&m, NULL);
+       sql_schema *s;
+
+       if (msg)
+               return msg;
+       s = m->session->schema;
+       if (s) {
+               sql_sequence *seq = find_sql_sequence(s, *seqname);
+
+               if (seq && seq_get_value(seq, res))
+                       return MAL_SUCCEED;
+       }
+       throw(SQL, "sql.get_value", "error");
+}
+
+str
 mvc_restart_seq(lng *res, str *seqname, lng *start)
 {
        mvc *m = NULL;


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