]> andersk Git - moira.git/commitdiff
Modify queries that effect the services table (asvc, dsvc, gvc).
authorzacheiss <zacheiss>
Thu, 10 Aug 2000 02:03:58 +0000 (02:03 +0000)
committerzacheiss <zacheiss>
Thu, 10 Aug 2000 02:03:58 +0000 (02:03 +0000)
Uniquify based on both name and protocol.

Don't bother incrementing the query version because there are no
clients that support these queries.

server/mr_server.h
server/qfollow.pc
server/queries2.c

index 10b2cec97ad3b3fcfef676b4a79e33d8615a0fec..60cf0e1497d657bb05acb940bc37d7f68ca17997 100644 (file)
@@ -199,6 +199,7 @@ int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
 int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
 int set_filesys_modtime(struct query *q, char *argv[], client *cl);
 int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
+int set_service_modtime(struct query *q, char *argv[], client *cl);
 int _sdl_followup(struct query *q, char *argv[], client *cl);
 int trigger_dcm(struct query *q, char *argv[], client *cl);
 
index 6bfee37ce458a4e5532143a9691f11086f94037e..ef387eaea5ae8c20fb104ae2abcb271d5e904587 100644 (file)
@@ -280,6 +280,28 @@ int set_zephyr_modtime(struct query *q, char *argv[], client *cl)
   return MR_SUCCESS;
 }
 
+/* sets the modtime on an entry in services table, where argv[0] contains
+ * the service name.
+ */
+
+int set_service_modtime(struct query *q, char *argv[], client *cl)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  char *service, *protocol, *entity;
+  int who;
+  EXEC SQL END DECLARE SECTION;
+
+  entity = cl->entity;
+  who = cl->client_id; 
+
+  service = argv[0];
+  protocol = argv[1];
+
+  EXEC SQL UPDATE services SET modtime = SYSDATE, modby = :who,
+    modwith = :entity WHERE name = :service AND protocol = :protocol;
+
+  return MR_SUCCESS;
+}
 
 /* fixes the modby field.  This will be the second to last thing in the
  * argv, the argv length is determined from the query structure.  It is
index e95279f5536b726bd6359f29d59bb0eba22bfc3d..e7c8f218432e02b0687f925ee237d40ccf343e18 100644 (file)
@@ -2438,7 +2438,7 @@ static struct validate aacl_validate =
 };
 
 static char *gsvc_fields[] = {
-  "service",
+  "service", "protocol",
   "service", "protocol", "port", "description", "modtime", "modby", "modwith",
 };
 
@@ -2446,6 +2446,10 @@ static char *asvc_fields[] = {
   "service", "protocol", "port", "description",
 };
 
+static char *dsvc_fields[] = {
+  "service", "protocol",
+};
+
 static struct valobj asvc_valobj[] = {
   {V_CHAR, 0, SERVICES_TABLE, "name"},
   {V_CHAR, 1, SERVICES_TABLE, "protocol"},
@@ -2457,12 +2461,24 @@ static struct validate asvc_validate = {
   asvc_valobj,
   4,
   "name",
-  "name = '%s'",
-  1,
+  "name = '%s' AND protocol = '%s'",
+  2,
+  0,
+  0,
+  0,
+  set_service_modtime,
+};
+
+static struct validate dsvc_validate = {
+  asvc_valobj,
+  2,
+  "name",
+  "name = '%s' AND protocol = '%s'",
+  2,
+  0,
   0,
   0,
   0,
-  set_modtime,
 };
 
 static char *gprn_fields[] = {
@@ -5406,8 +5422,8 @@ struct query Queries[] = {
     "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
     gsvc_fields,
     7,
-    "name LIKE '%s'",
-    1,
+    "name LIKE '%s' AND protocol LIKE '%s'",
+    2,
     "name",
     &VDfix_modby,
   },
@@ -5438,12 +5454,12 @@ struct query Queries[] = {
     "ss",
     SERVICES_TABLE,
     0,
-    asvc_fields,
+    dsvc_fields,
     0,
-    "name = '%s'",
-    1,
+    "name = '%s' AND protocol = '%s'",
+    2,
     NULL,
-    &asvc_validate,
+    &dsvc_validate,
   },
 
   {
This page took 0.047748 seconds and 5 git commands to generate.