]> andersk Git - moira.git/blobdiff - server/queries2.c
First and last name in the users table now act case insensitive.
[moira.git] / server / queries2.c
index 8a45e7198979d5f835fc4e3da1ec2f6ad889400d..05fb50d9beb690735b270339d1257768deb62bb9 100644 (file)
@@ -174,6 +174,13 @@ static struct valobj VOwild01sort01[] = {
   {V_SORT, 1}, 
 };
 
+static struct valobj VOupwild01sort01[] = {
+  {V_UPWILD, 0},
+  {V_UPWILD, 1},
+  {V_SORT, 0},
+  {V_SORT, 1}, 
+};
+
 static struct valobj VOwild012sort0[] = {  /* get_alias */
   {V_WILD, 0},
   {V_WILD, 1},
@@ -291,6 +298,18 @@ static struct validate VDupwildsortf = {
     followup_fix_modby,
 };
 
+static struct validate VDupwild2sortf = { 
+    VOupwild01sort01,
+    4,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    followup_fix_modby,
+};
+
 
 \f
 /* Query data */
@@ -373,10 +392,10 @@ static char *gubn_fields[] = {
   MIT_ID, CLASS, MOD1, MOD2, MOD3,
 };
 
-static struct validate gubn_validate =
+static struct validate gubn_validate = /* Q_GUBN, Q_GUAN */
 {
-    VOwild01sort0,
-    3,
+    VOupwild01sort01,
+    4,
     0,
     0,
     0,
@@ -500,7 +519,7 @@ static struct validate uusr_validate = {
   USERS_ID,
   0,
   setup_ausr,
-  set_modtime_by_id,
+  followup_uuac,
 };
 
 static char *uush_fields[] = {
@@ -2258,7 +2277,7 @@ struct query Queries2[] = {
       "CHAR(u.login), CHAR(u.uid), u.shell, CHAR(u.last), CHAR(u.first), u.middle, CHAR(u.status), CHAR(u.clearid), u.type, str.string, CHAR(u.signature), CHAR(u.secure), CHAR(u.modtime), CHAR(u.modby), u.modwith FROM users u, strings str",
       gual_fields,
       15,
-      "u.login LIKE '%s' ESCAPE '*' AND u.users_id != 0 AND u.comment = strings.string_id",
+      "u.login LIKE '%s' ESCAPE '*' AND u.users_id != 0 AND u.comment = str.string_id",
       1,
       &gubl_validate,
   },
@@ -2288,9 +2307,9 @@ struct query Queries2[] = {
       "CHAR(u.login), CHAR(u.uid), u.shell, CHAR(u.last), CHAR(u.first), u.middle, CHAR(u.status), CHAR(u.clearid), u.type, str.string, CHAR(u.signature), CHAR(u.secure), CHAR(u.modtime), CHAR(u.modby), u.modwith FROM users u, strings str",
       guan_fields,
       15,
-      "u.first LIKE '%s' ESCAPE '*' AND u.last LIKE '%s' ESCAPE '*' AND u.users_id != 0 and u.comment = str.string_id",
+      "u.searchfirst LIKE '%s' ESCAPE '*' AND u.searchlast LIKE '%s' ESCAPE '*' AND u.users_id != 0 and u.comment = str.string_id",
       2,
-      &VDwild2sortf,
+      &gubn_validate,
   },
  
   {
@@ -2363,7 +2382,7 @@ struct query Queries2[] = {
     "CHAR(login), CHAR(uid), shell, CHAR(last), CHAR(first), middle, CHAR(status), CHAR(clearid), type, CHAR(modtime), CHAR(modby), modwith FROM users",
     gubn_fields,
     12,
-    "first LIKE '%s' ESCAPE '*' AND last LIKE '%s' ESCAPE '*' AND users_id != 0",
+    "searchfirst LIKE '%s' ESCAPE '*' AND searchlast LIKE '%s' ESCAPE '*' AND users_id != 0",
     2,
     &gubn_validate,
   },
@@ -3245,7 +3264,7 @@ struct query Queries2[] = {
     RETRIEVE,
     "fs",
     FILESYS,
-    "CHAR(fs.label), fs.type, CHAR(m.name), fs.name, fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+    "CHAR(fs.label), fs.type, CHAR(m.name), CHAR(fs.name), fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsl_fields,
     14,
     "fs.label LIKE '%s' ESCAPE '*' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
@@ -3260,7 +3279,7 @@ struct query Queries2[] = {
     RETRIEVE,
     "fs",
     FILESYS,
-    "CHAR(fs.label), fs.type, CHAR(m.name), fs.name, fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+    "CHAR(fs.label), fs.type, CHAR(m.name), CHAR(fs.name), fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsm_fields,
     14,
     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
@@ -3275,7 +3294,7 @@ struct query Queries2[] = {
     RETRIEVE,
     "fs",
     FILESYS,
-    "CHAR(fs.label), fs.type, CHAR(m.name), fs.name, fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l, nfsphys np",
+    "CHAR(fs.label), fs.type, CHAR(m.name), CHAR(fs.name), fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l, nfsphys np",
     gfsn_fields,
     14,
     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id AND np.nfsphys_id = fs.phys_id AND np.dir LIKE '%s' ESCAPE '*' AND fs.type = 'NFS'", 
@@ -3290,7 +3309,7 @@ struct query Queries2[] = {
     RETRIEVE,
     "fs",
     FILESYS,
-    "CHAR(fs.label), fs.type, CHAR(m.name), fs.name, fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+    "CHAR(fs.label), fs.type, CHAR(m.name), CHAR(fs.name), fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsg_fields,
     14,
     "fs.owners = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
@@ -3299,18 +3318,18 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GFSP - GET_FILESYS_BY_PATH */ /** Allow wildcards??? **/
+    /* Q_GFSP - GET_FILESYS_BY_PATH */
     "get_filesys_by_path",
     "gfsp",
     RETRIEVE,
     "fs",
     FILESYS,
-    "CHAR(fs.label), fs.type, CHAR(m.name), fs.name, fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CAHR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+    "CHAR(fs.label), fs.type, CHAR(m.name), CHAR(fs.name), fs.mount, fs.access, fs.comments, CHAR(u.login), CHAR(l.name), CHAR(fs.createflg), fs.lockertype, CHAR(fs.modtime), CHAR(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsp_fields,
     14,
-    "fs.name = '%s' and m.mach_id = fs.mach_id and fs.owner = u.users_id and fs.owners = list_id",
+    "fs.name LIKE '%s' ESCAPE '*' AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = list_id",
     1,
-    &VDsortf,
+    &VDwildsortf,
   },
  
   {
@@ -3374,7 +3393,7 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_AFTG - ADD_FILESYS_TO_FSGROUP */ /** Needs subselect */
+    /* Q_AFTG - ADD_FILESYS_TO_FSGROUP */
     "add_filesys_to_fsgroup",
     "aftg",
     APPEND,
@@ -3382,9 +3401,9 @@ struct query Queries2[] = {
     "fsgroup",
     "INTO fsgroup (group_id,filsys_id,key) VALUES (%d, %d, '%s')",
     gfgm_fields,
-    2,
+    3,
     (char *)0,
-    1,
+    0,
     &aftg_validate,
   },
 
@@ -3530,11 +3549,11 @@ struct query Queries2[] = {
     APPEND,
     "q",
     QUOTA,
-    "INTO quota (type, entity_id, quota, filsys_id, phys_id) VALUES (filesys.filsys_id, '%s', %d, %s, %s, %s)",
+    "INTO quota (type, entity_id, quota, filsys_id, phys_id) VALUES ('%s', %d, %s, %s, %s)",
     aqot_fields,
     3,
     (char *)0,
-    1,
+    0,
     &aqot_validate,
   },
 
@@ -3548,7 +3567,7 @@ struct query Queries2[] = {
     "quota SET quota = %s",
     aqot_fields,
     1,
-    "filsys_id = %d AND type = '%s' AND entity_id = %d",
+    "quota.filsys_id = %d AND quota.type = '%s' AND quota.entity_id = %d",
     3,
     &uqot_validate,
   },
@@ -3563,7 +3582,7 @@ struct query Queries2[] = {
     (char *)0,
     aqot_fields,
     0,
-    "filsys_id = %d AND type = '%s' AND entity_id = %d",
+    "quota.filsys_id = %d AND quota.type = '%s' AND quota.entity_id = %d",
     3,
     &dqot_validate,
   },
@@ -3609,7 +3628,7 @@ struct query Queries2[] = {
     anfq_fields,
     2,
     (char *)0,
-    1,
+    0,
     &anfq_validate,
   },
 
This page took 0.043419 seconds and 4 git commands to generate.