--- collabreate.orig/server/my_dbschema.sql	2010-10-09 20:06:49.000000000 +0000
+++ collabreate/server/my_dbschema.sql	2011-07-01 13:39:57.000000000 +0000
@@ -62,6 +62,7 @@
 
 delimiter //
 CREATE FUNCTION nextid() RETURNS BIGINT
+DETERMINISTIC
 BEGIN
    DECLARE temp BIGINT;
    SELECT seq into temp FROM updateid;
@@ -83,6 +84,7 @@
 
 delimiter //
 CREATE FUNCTION insertUpdate(uid INTEGER, proj_id INTEGER, command INTEGER, value BLOB) RETURNS BIGINT
+DETERMINISTIC
 BEGIN
    DECLARE temp BIGINT;
    SELECT nextid() INTO temp;
@@ -94,6 +96,7 @@
 
 delimiter //
 CREATE PROCEDURE copyUpdates(old_pid int, max_update int, new_pid int)
+DETERMINISTIC
 BEGIN
    CREATE TEMPORARY TABLE tmptable (LIKE updates);
    INSERT INTO tmptable SELECT * FROM updates WHERE pid = old_pid AND updateid <= max_update;
@@ -113,6 +116,7 @@
 
 delimiter //
 CREATE FUNCTION addUserQuery(user varchar(32), pw varchar(64), p BIGINT, s BIGINT) RETURNS INTEGER
+DETERMINISTIC
 BEGIN
   insert into users (username,pwhash,pub,sub) values (user, pw, p, s);
   return LAST_INSERT_ID();
@@ -120,6 +124,7 @@
 //
 
 CREATE FUNCTION updateUserQuery(user varchar(32), pw varchar(64), p BIGINT, s BIGINT, uid INTEGER) RETURNS INTEGER
+DETERMINISTIC
 BEGIN
   update users set username=user,pwhash=pw,pub=p,sub=s where userid=uid;
   return LAST_INSERT_ID();
@@ -127,6 +132,7 @@
 //
 
 CREATE FUNCTION addProjectQuery(hash varchar(64), gpid varchar(128), descr text, owner int, p BIGINT, s BIGINT) RETURNS INTEGER
+DETERMINISTIC
 BEGIN
   insert into projects (hash,gpid,description,owner,pub,sub) values (hash, gpid, descr, owner, p, s);
   return LAST_INSERT_ID();
@@ -134,6 +140,7 @@
 //
 
 CREATE FUNCTION addProjectSnapQuery(hash varchar(64), gpid varchar(128), descr text, owner int, snapid BIGINT) RETURNS INTEGER
+DETERMINISTIC
 BEGIN
   insert into projects (hash,gpid,description,owner,snapupdateid) values (hash, gpid, descr, owner, snapid);
   return LAST_INSERT_ID();
@@ -141,6 +148,7 @@
 //
 
 CREATE FUNCTION addProjectForkQuery(child int, parent int) RETURNS INTEGER
+DETERMINISTIC
 BEGIN
   insert into forklist (child,parent) values (child, parent);
   return LAST_INSERT_ID();
