]> andersk Git - moira.git/blobdiff - server/queries2.c
Default to [ANY] for mailman_server in the ulis case if we're setting
[moira.git] / server / queries2.c
index 0814cdcdabea0f10735a46c3faab5b053798511a..634a401ee4059f7bb13d174f455c685a7dbb82b1 100644 (file)
@@ -43,7 +43,7 @@ static struct valobj VOfilesys0[] = {
 };
 
 static struct valobj VOcon0[] = {
-       {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
 };
 
 static struct valobj VOnum0[] = {
@@ -1526,13 +1526,20 @@ static char *glin3_fields[] = {
   "modwith",
 };
 
-static char *glin_fields[] = {
+static char *glin4_fields[] = {
   "name",
   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
   "description", "modtime", "modby", "modwith",
 };
 
+static char *glin_fields[] = {
+  "name",
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name", 
+  "memace_type", "memace_name", "description", "modtime", "modby", "modwith",
+};
+
 static struct validate glin_validate = {
   0,
   0,
@@ -1606,13 +1613,13 @@ static struct validate alis3_validate = {
   set_modtime,
 };
 
-static char *alis_fields[] = {
+static char *alis4_fields[] = {
   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
   "description",
 };
 
-static struct valobj alis_valobj[] = {
+static struct valobj alis4_valobj[] = {
   {V_CHAR, 0, LIST_TABLE, "name"},
   {V_NUM, 1},
   {V_NUM, 2},
@@ -1628,9 +1635,45 @@ static struct valobj alis_valobj[] = {
   {V_LEN, 12, LIST_TABLE, "description"},
 };
 
+static struct validate alis4_validate = {
+  alis4_valobj,
+  13,
+  "name",
+  "name = '%s'",
+  1,
+  "list_id",
+  0,
+  setup_alis,
+  set_modtime,
+};
+
+static char *alis_fields[] = {
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name", 
+  "memace_type", "memace_name", "description",
+};
+
+static struct valobj alis_valobj[] = {
+  {V_CHAR, 0, LIST_TABLE, "name"},
+  {V_NUM, 1},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 13, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 14, LIST_TABLE, "description"},
+};
+
 static struct validate alis_validate = {
   alis_valobj,
-  13,
+  15,
   "name",
   "name = '%s'",
   1,
@@ -1705,14 +1748,14 @@ static struct validate ulis3_validate = {
   set_modtime_by_id,
 };
 
-static char *ulis_fields[] = {
+static char *ulis4_fields[] = {
   "name",
   "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
   "description",
 };
 
-static struct valobj ulis_valobj[] = {
+static struct valobj ulis4_valobj[] = {
   {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
   {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
   {V_NUM, 2},
@@ -1729,9 +1772,47 @@ static struct valobj ulis_valobj[] = {
   {V_LEN, 13, LIST_TABLE, "description"},
 };
 
+static struct validate ulis4_validate = {
+  ulis4_valobj,
+  14,
+  "name",
+  "list_id = %d",
+  1,
+  "list_id",
+  access_list,
+  setup_alis,
+  set_modtime_by_id,
+};
+
+static char *ulis_fields[] = {
+  "name",
+  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name", 
+  "memace_type", "memace_name", "description",
+};
+
+static struct valobj ulis_valobj[] = {
+  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
+  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_NUM, 9},
+  {V_ID, 10, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 12, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 13, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 14, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 15, LIST_TABLE, "description"},
+};
+
 static struct validate ulis_validate = {
   ulis_valobj,
-  14,
+  16,
   "name",
   "list_id = %d",
   1,
@@ -3343,7 +3424,7 @@ static char *gdds_fields[] = {
   "sid",
 };
 
-static char *gcon_fields[] = {
+static char *gcon7_fields[] = {
   "name",
   "name", "description", "location", "contact",
   "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
@@ -3361,12 +3442,18 @@ static struct validate gcon_validate = {
   followup_gcon,
 };
 
-static char *acon_fields[] = {
+static char *gcon_fields[] = {
+  "name",
+  "name", "publicflg", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
+};
+
+static char *acon7_fields[] = {
   "name", "description", "location", "contact",
   "ace_type", "ace_name", "memace_type", "memace_name",
 };
 
-static struct valobj acon_valobj[] = {
+static struct valobj acon7_valobj[] = {
   {V_CHAR, 0, CONTAINERS_TABLE, "name"},
   {V_LEN, 1, CONTAINERS_TABLE, "description"},
   {V_CHAR, 2, CONTAINERS_TABLE, "location"},
@@ -3377,26 +3464,56 @@ static struct valobj acon_valobj[] = {
   {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
 };
 
+static struct validate acon7_validate =
+{
+  acon7_valobj,
+  8,
+  "name",
+  "name = '%s'",
+  1,
+  "cnt_id",
+  0,
+  setup_acon,
+  set_modtime,
+};
+
+static char *acon_fields[] = {
+  "name", "publicflg", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
+
+static struct valobj acon_valobj[] = {
+  {V_CHAR, 0, CONTAINERS_TABLE, "name"},
+  {V_NUM, 1},
+  {V_LEN, 2, CONTAINERS_TABLE, "description"},
+  {V_CHAR, 3, CONTAINERS_TABLE, "location"},
+  {V_CHAR, 4, CONTAINERS_TABLE, "contact"},
+  {V_TYPE, 5, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 6, 0, 0, 0, MR_ACE},
+  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
+};
+
 static struct validate acon_validate =
 {
   acon_valobj,
-  8,
+  9,
   "name",
   "name = '%s'",
   1,
   "cnt_id",
   0,
-  prefetch_value,
+  setup_acon,
   set_modtime,
 };
 
-static char *ucon_fields[] = {
+static char *ucon7_fields[] = {
   "name",
   "newname", "description", "location", "contact",
   "ace_type", "ace_name", "memace_type", "memace_name",
 };
 
-static struct valobj ucon_valobj[] = {
+static struct valobj ucon7_valobj[] = {
   {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
   {V_RENAME, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_NOT_UNIQUE},
   {V_LEN, 2, CONTAINERS_TABLE, "description"},
@@ -3408,10 +3525,42 @@ static struct valobj ucon_valobj[] = {
   {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
 };
 
+static struct validate ucon7_validate =
+{
+  ucon7_valobj,
+  9,
+  0,
+  0,
+  0,
+  0,
+  access_container,
+  0,
+  update_container,
+};
+
+static char *ucon_fields[] = {
+  "name",
+  "newname", "publicflg", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
+
+static struct valobj ucon_valobj[] = {
+  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+  {V_RENAME, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_LEN, 3, CONTAINERS_TABLE, "description"},
+  {V_CHAR, 4, CONTAINERS_TABLE, "location"},
+  {V_CHAR, 5, CONTAINERS_TABLE, "contact"},
+  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
+  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
+};
+
 static struct validate ucon_validate =
 {
   ucon_valobj,
-  9,
+  10,
   0,
   0,
   0,
@@ -3522,6 +3671,32 @@ static char *gtlc_fields[] = {
   "name",
 };
 
+static char *scli_fields[] = {
+  "containername",
+  "listname",
+};
+
+static struct valobj scli_valobj[] = {
+  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+  {V_ID, 1, LIST_TABLE, "name", "list_id", MR_LIST},
+};
+
+static struct validate scli_validate = {
+  scli_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  0,
+  setup_scli,
+  set_container_list,
+};
+
+static char *gcli_fields[] = {
+  "containername",
+  "containername", "listname",
+};
 
 /* Generalized Query Definitions */
 
@@ -5132,7 +5307,7 @@ struct query Queries[] = {
     "l",
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
-    glin_fields,
+    glin4_fields,
     16,
     "name LIKE '%s'",
     1,
@@ -5140,6 +5315,23 @@ struct query Queries[] = {
     &glin_validate,
   },
 
+  {
+    /* Q_GLIN - GET_LIST_INFO, v10 */
+    "get_list_info",
+    "glin",
+    10,
+    RETRIEVE,
+    "l",
+    LIST_TABLE,
+    "l.name, l.active, l.publicflg, l.hidden, l.maillist, l.grouplist, l.gid, l.nfsgroup, l.mailman, m.name, l.acl_type, l.acl_id, l.memacl_type, l.memacl_id, l.description, TO_CHAR(l.modtime, 'DD-mon-YYYY HH24:MI:SS'), l.modby, l.modwith FROM list l, machine m",
+    glin_fields,
+    18,
+    "l.name LIKE '%s' AND m.mach_id = l.mailman_id",
+    1,
+    "l.name",
+    &glin_validate,
+  },
+
   {
     /* Q_EXLN - EXPAND_LIST_NAMES */
     "expand_list_names",
@@ -5200,11 +5392,28 @@ struct query Queries[] = {
     "l",
     LIST_TABLE,
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
-    alis_fields,
+    alis4_fields,
     13,
     0,
     0,
     NULL,
+    &alis4_validate,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v10 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    10,
+    APPEND,
+    "l",
+    LIST_TABLE,
+    "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, mailman, mailman_id, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, %s, %d, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
+    alis_fields,
+    15,
+    0,
+    0,
+    NULL,
     &alis_validate,
   },
 
@@ -5251,11 +5460,28 @@ struct query Queries[] = {
     "l",
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
-    ulis_fields,
+    ulis4_fields,
     13,
     "list_id = %d",
     1,
     NULL,
+    &ulis4_validate,
+  },
+
+  {
+    /* Q_ULIS, UPDATE_LIST, v10 */
+    "update_list",
+    "ulis",
+    10,
+    UPDATE,
+    "l",
+    LIST_TABLE,
+    "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, mailman = %s, mailman_id = %d, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
+    ulis_fields,
+    15,
+    "list_id = %d",
+    1,
+    NULL,
     &ulis_validate,
   },
 
@@ -6985,9 +7211,26 @@ struct query Queries[] = {
     "c",
     CONTAINERS_TABLE,
     "name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
-    gcon_fields,
+    gcon7_fields,
     11,
-    "name LIKE '%s' AND cnt_id != 0",
+    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
+    1,
+    NULL,
+    &gcon_validate,
+  },
+
+  {
+    /* Q_GCON - GET_CONTAINER, v9 */
+    "get_container",
+    "gcon",
+    9,
+    RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
+    gcon_fields,
+    12,
+    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
     1,
     NULL,
     &gcon_validate,
@@ -7002,11 +7245,28 @@ struct query Queries[] = {
     "c",
     CONTAINERS_TABLE,
     "INTO containers (name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
-    acon_fields,
+    acon7_fields,
     8,
     0,
     0,
     NULL,
+    &acon7_validate,
+  },
+
+  {
+    /* Q_ACON - ADD_CONTAINER, v9 */ /* uses prefetch_value() for cnt_id */
+    "add_container",
+    "acon",
+    9,
+    APPEND,
+    "c",
+    CONTAINERS_TABLE,
+    "INTO containers (name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
+    acon_fields,
+    9,
+    0,
+    0,
+    NULL,
     &acon_validate,
   },
 
@@ -7019,11 +7279,28 @@ struct query Queries[] = {
     0,
     CONTAINERS_TABLE,
     0,
-    ucon_fields,
+    ucon7_fields,
     8,
     0,
     1,
     NULL,
+    &ucon7_validate,
+  },
+
+  {
+    /* Q_UCON - UPDATE_CONTAINER, v9 */
+    "update_container",
+    "ucon",
+    9,
+    UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    ucon_fields,
+    9,
+    0,
+    1,
+    NULL,
     &ucon_validate,
   },
 
@@ -7146,6 +7423,40 @@ struct query Queries[] = {
     NULL,
   },
 
+  {
+    /* Q_SCLI - SET_CONTAINER_LIST, v9 */
+    "set_container_list",
+    "scli",
+    9,
+    UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    scli_fields,
+    1,
+    0,
+    1,
+    NULL,
+    &scli_validate,
+  },
+
+  {
+    /* Q_GCLI - GET_CONTAINER_LIST, v9 */
+    "get_container_list",
+    "gcli",
+    9,
+    RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "c.name, l.name FROM containers c, list l",
+    gcli_fields,
+    2,
+    "LOWER(c.name) = LOWER('%s') AND c.list_id = l.list_id AND c.list_id != 0",
+    1,
+    NULL,
+    NULL,
+  },
+
 };
 
 int QueryCount = (sizeof(Queries) / sizeof(struct query));
This page took 0.076886 seconds and 4 git commands to generate.