]> andersk Git - moira.git/blobdiff - server/qrtn.qc
changed names of some of the clients; and changed order or arguments
[moira.git] / server / qrtn.qc
index 12bbfa1d7013bbae91597a5b369ee4a23f53d653..3d432483dab3d235cbd3264d222a1ac594f2d410 100644 (file)
@@ -4,6 +4,8 @@
  *     $Header$
  *
  *     Copyright (C) 1987, 1988 by the Massachusetts Institute of Technology
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  * 
  */
 
 static char *rcsid_qrtn_qc = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include "query.h"
 #include "sms_server.h"
 
 char *Argv[16];
 
-int ingres_errno = 0;
+static int ingres_errno = 0;
 extern char *whoami;
 extern FILE *journal;
 
@@ -43,6 +46,7 @@ static int ingerr(num)
        ingres_errno = SMS_DATE;
        break;
     case INGRES_DEADLOCK:
+       com_err(whoami, 0, "INGRES deadlock detected");
        ingres_errno = SMS_DEADLOCK;
        break;
     default:
@@ -137,9 +141,10 @@ sms_process_query(cl, name, argc, argv_ro, action, actarg)
     if (q == (struct query *)0) return(SMS_NO_HANDLE);
     v = q->validate;
 
-    ingres_errno = 0;
-    if (q->type != RETRIEVE)
+    if (q->type != RETRIEVE) {
+##     set lockmode session where readlock = exclusive
 ##      begin transaction
+    }
 
     /* setup argument vector, verify access and arguments */
     if ((status = sms_verify_query(cl, q, argc, argv_ro)) != SMS_SUCCESS)
@@ -290,6 +295,7 @@ out:
     if (q->type != RETRIEVE) {
         if (status == SMS_SUCCESS) {
 ##          end transaction    /* commit to this */
+##         set lockmode session where readlock = system
            if (journal) {
                char buf[1024], *bp;
                int i;
@@ -310,7 +316,7 @@ out:
            }
        } else {
            if (status != SMS_DEADLOCK) {
-##             abort           /* it never happened */
+##             abort           /* it never happened */
            }
        }
     }
@@ -408,6 +414,8 @@ sms_verify_query(cl, q, argc, argv_ro)
     register int privileged = 0;
 
     /* copy the arguments into a local argv that we can modify */
+    if (argc >= QMAXARGS)
+      return(SMS_ARGS);
     for (i = 0; i < argc; i++) {
        if (strlen(argv_ro[i]) < ARGLEN)
            strcpy(Argv[i], argv_ro[i]);
@@ -781,7 +789,6 @@ set_next_object_id(object, table)
     if (LOG_RES)
         com_err(whoami, 0, "setting ID %s to %d", name, value);
 ##  repeat replace v (#value = @value) where v.#name = @name
-    if (ingres_errno != 0) return(ingres_errno);
     return(SMS_SUCCESS);
 ##}
 
@@ -811,16 +818,3 @@ sanity_check_queries()
        exit(1);
     }
 }
-
-
-/*
- * Local Variables:
- * mode: c
- * c-indent-level: 4
- * c-continued-statement-offset: 4
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * End:
- */
-
This page took 0.104558 seconds and 4 git commands to generate.