#include <moira.h>
#include "query.h"
#include "mr_server.h"
-EXEC SQL INCLUDE sqlca
+EXEC SQL INCLUDE sqlca;
extern char *whoami;
char *malloc();
#define MAXARGC 15
+EXEC SQL WHENEVER SQLERROR CALL ingerr;
+
/* structures to save before args */
static char beforeb[MAXARGC][ARGLEN];
static char *before[MAXARGC];
incremental_before(table, qual, argv)
char *table;
+EXEC SQL BEGIN DECLARE SECTION;
char *qual;
+EXEC SQL END DECLARE SECTION;
char **argv;
{
EXEC SQL BEGIN DECLARE SECTION;
* barg7 = u.mit_id, barg8 = u.mit_year)
* where qual
*/
- EXEC SQL SELECT login, uid, shell, last, first, middle,
- text(u.status), mit_id, mit_year
+ EXEC SQL SELECT login, CHAR(uid), shell, last, first, middle,
+ CHAR(status), clearid, type
INTO :barg0, :barg1, :barg2, :barg3, :barg4, :barg5, :barg6,
:barg7, :barg8
FROM users WHERE :qual;
* retrieve (barg0 = c.name, barg1 = c.desc, barg2 = c.location)
* where qual
*/
- EXEC SQL SELECT name, desc, location INTO :barg0, :barg1, :barg2
+ EXEC SQL SELECT name, description, location
+ INTO :barg0, :barg1, :barg2
FROM cluster WHERE :qual;
beforec = 3;
} else if (!strcmp(table, "mcmap")) {
* barg10 = fs.lockertype)
* where qual
*/
- EXEC SQL SELECT label, type, text(mach_id), name, mount, access,
- comments, text(owner), text(owners), text(createflag), lockertype
+ EXEC SQL SELECT label, type, CHAR(mach_id), name, mount, access,
+ comments, CHAR(owner), CHAR(owners), CHAR(createflag), lockertype
INTO :barg0, :barg1, :barg2, :barg3, :barg4, :barg5, :barg6,
:barg7, :barg8, :barg9, :barg10
FROM filesys WHERE :qual;
* barg8 = text(l.acl_id), barg9 = l.desc)
* where qual
*/
- EXEC SQL SELECT name, text(active), text(public), text(hidden),
- text(maillist), text(grouplist), text(gid), acl_type,
- text(acl_id), desc
+ EXEC SQL SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
+ CHAR(maillist), CHAR(grouplist), CHAR(gid), acl_type,
+ CHAR(acl_id), description
INTO :barg0, :barg1, :barg2, :barg3, :barg4, :barg5, :barg6,
:barg7, :barg8, :barg9
FROM list WHERE :qual;
/*
* retrieve (barg3 = text(list.group)) where list.list_id = id
*/
- EXEC SQL SELECT text(list.group) INTO :barg3 FROM list
+ EXEC SQL SELECT CHAR(grouplist) INTO :barg3 FROM list
WHERE list_id = :id;
name = malloc(0);
id_to_name(id, "LIST", &name);
incremental_after(table, qual, argv)
-EXEC SQL BEGIN DECLARE SECTION;
char *table;
+EXEC SQL BEGIN DECLARE SECTION;
char *qual;
EXEC SQL END DECLARE SECTION;
char **argv;
* aarg7 = u.mit_id, aarg8 = u.mit_year)
* where qual
*/
- EXEC SQL SELECT login, uid, shell, last, first, middle,
- text(status), mit_id, mit_year
+ EXEC SQL SELECT login, CHAR(uid), shell, last, first, middle,
+ CHAR(status), clearid, type
INTO :aarg0, :aarg1, :aarg2, :aarg3, :aarg4, :aarg5,
:aarg6, :aarg7, :aarg8
FROM users WHERE :qual;
* retrieve (aarg0 = c.name, aarg1 = c.desc, aarg2 = c.location)
* where qual
*/
- EXEC SQL SELECT name, desc, location INTO :aarg0, :aarg1, :aarg2
+ EXEC SQL SELECT name, description, location
+ INTO :aarg0, :aarg1, :aarg2
FROM cluster WHERE :qual;
afterc = 3;
} else if (!strcmp(table, "mcmap")) {
* aarg10 = fs.lockertype)
* where qual
*/
- EXEC SQL SELECT label, type, text(mach_id), name, mount, access,
- comments, text(owner), text(owners), text(createflag), lockertype
+ EXEC SQL SELECT label, type, CHAR(mach_id), name, mount, access,
+ comments, CHAR(owner), CHAR(owners), CHAR(createflag), lockertype
INTO :aarg0, :aarg1, :aarg2, :aarg3, :aarg4, :aarg5, :aarg6,
:aarg7, :aarg8, :aarg9, :aarg10
FROM filesys fs WHERE :qual;
* range of q is quota
* retrieve (aarg3 = text(q.quota), aarg4 = filesys.name) where qual
*/
- EXEC SQL SELECT text(q.quota), fs.name INTO :aarg3, :aarg4
+ EXEC SQL SELECT CHAR(q.quota), fs.name INTO :aarg3, :aarg4
FROM quota q, filesys fs WHERE :qual;
afterc = 5;
} else if (!strcmp(table, "list")) {
* aarg8 = text(l.acl_id), aarg9 = l.desc)
* where qual
*/
- EXEC SQL SELECT name, text(active), text(public), text(hidden),
- text(maillist), text(grouplist), text(gid), acl_type,
- text(acl_id), desc
+ EXEC SQL SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
+ CHAR(maillist), CHAR(grouplist), CHAR(gid), acl_type,
+ CHAR(acl_id), description
INTO :aarg0, :aarg1, :aarg2, :aarg3, :aarg4, :aarg5, :aarg6,
:aarg7, :aarg8, :aarg9
FROM list WHERE :qual;
/*
* retrieve (aarg3 = text(list.group)) where list.list_id = id
*/
- EXEC SQL SELECT text(list.group) INTO :aarg3 FROM list
+ EXEC SQL SELECT CHAR(grouplist) INTO :aarg3 FROM list
WHERE list_id = :id;
name = malloc(0);
id_to_name(id, "LIST", &name);
if (!inited) {
inited++;
- EXEC SQL DECLARE inc CURSOR FOR SELECT table, service FROM incremental;
+ EXEC SQL DECLARE inc CURSOR FOR SELECT tablename, service FROM incremental;
EXEC SQL OPEN inc;
while (1) {
EXEC SQL FETCH inc INTO :tab, :serv;
#define INGRES_BAD_DATE1 41206
#define INGRES_BAD_DATE2 40207
#define INGRES_DEADLOCK 49900
+
+#define INGRES_BAD_COLUMN 30110
+#define INGRES_ASGN_ERR 40204
+#define INGRES_NO_CURSOR 30120
+#define INGRES_NO_STMT 30130
+
/*
#define INGRES_BAD_INT
#define INGRES_TIMEOUT
void ingerr()
{
+ EXEC SQL BEGIN DECLARE SECTION;
+ char err_msg[256];
+ EXEC SQL END DECLARE SECTION;
ingres_errno = -sqlca.sqlcode;
switch (ingres_errno) {
* com_err(whoami, 0, "INGRES missing range statement");
* break;
*/
+#ifdef NEVER
+ /* #ifdef-ing these out lets default: give me the INGRES text */
+ case INGRES_BAD_COLUMN:
+ mr_errcode = MR_INTERNAL;
+ com_err(whoami, 0, "Bad column name in query table");
+ break;
+ case INGRES_ASGN_ERR:
+ mr_errcode = MR_INTERNAL;
+ com_err(whoami, 0, "Error in SQL assignment statement");
+ break;
+ case INGRES_NO_CURSOR:
+ mr_errcode = MR_INTERNAL;
+ com_err(whoami, 0, "Cursor not opened");
+ break;
+ case INGRES_NO_STMT:
+ mr_errcode = MR_INTERNAL;
+ com_err(whoami, 0, "Statement not declared");
+ break;
+#endif
default:
/** Add the INGRES error_text to the alert message ??? **/
mr_errcode = MR_INGRES_ERR;
- com_err(whoami, MR_INGRES_ERR, " code %d\n", sqlca.sqlcode);
+ com_err(whoami, MR_INGRES_ERR, " code %d\n", ingres_errno);
+ EXEC SQL INQUIRE_SQL(:err_msg = errortext);
+ com_err(whoami, 0, "SQL error text = %s", err_msg);
critical_alert("MOIRA", "Moira server encountered INGRES ERROR %d", ingres_errno);
}
}
-/* This is declarative, not executed. Applies from here on, in the file */
+/* This is declarative, not executed. Applies from here on, in this file. */
EXEC SQL WHENEVER SQLERROR CALL ingerr;
int mr_open_database()
if (status != MR_NO_MATCH) break;
}
+#ifdef NEVER
+ /* This is now done by a valobj, which also fetches the id value */
+
/* increment id number if necessary */
if (v->object_id) {
status = set_next_object_id(v->object_id, q->rtable, 0);
if (status != MR_SUCCESS) break;
}
+#endif
/* build "where" clause if needed */
if (q->qual) {
status = do_append(q, &Argv[q->argc], pqual, action, actarg);
if (status != MR_SUCCESS) break;
if (v && v->object_id) {
- sprintf(qual, "%s.%s = values.value and values.name = '%s'",
- q->rtable, v->object_id, v->object_id);
+ sprintf(qual, "%s.%s = %s",q->rtable, v->object_id,
+ Argv[q->argc+q->vcnt]);
incremental_after(q->rtable, qual, argv_ro);
} else
incremental_after(q->rtable, pqual, argv_ro);
com_err(whoami, MR_NO_MEM, "setting up static argv");
exit(1);
}
- for (i = 0; i < QMAXARGS; i++) {
+ for (i = 0; i < QMAXARGS; i++) {
vaddrs[i]=SQLDA->sqlvar[i].sqldata;
}
}
-/*
- * if (psort) {
- * csort = psort;
- * if (pqual) {
- * cqual = pqual;
- * retrieve unique (param (q->tlist, vaddrs)) where cqual
- * sort by csort
- * {
- * (*action)(q->vcnt, vaddrs, actarg);
- * }
- * } else {
- * retrieve unique (param (q->tlist, vaddrs))
- * sort by csort
- * {
- * (*action)(q->vcnt, vaddrs, actarg);
- * }
- * }
- *
- * } else {
- * if (pqual) {
- * cqual = pqual;
- * retrieve unique (param (q->tlist, vaddrs)) where cqual
- * {
- * (*action)(q->vcnt, vaddrs, actarg);
- * }
- * } else {
- * retrieve unique (param (q->tlist, vaddrs))
- * {
- * (*action)(q->vcnt, vaddrs, actarg);
- * }
- * }
- * }
- */
-
build_sql_stmt(stmt_buf,"SELECT",q->tlist,vaddrs,pqual);
if(psort) { strcat(stmt_buf," ORDER BY "); strcat(stmt_buf,psort); }
EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
+ if(ingres_errno)
+ return(mr_errcode);
if((mr_errcode=mr_check_SQLDA(SQLDA)) != MR_SUCCESS)
return(mr_errcode);
EXEC SQL DECLARE csr001 CURSOR FOR stmt;
while(1) {
EXEC SQL FETCH csr001 USING DESCRIPTOR :SQLDA;
if(sqlca.sqlcode != 0) break;
- mr_fix_nulls_in_SQLDA(SQLDA);
(*action)(q->vcnt, vaddrs, actarg);
rowcount++;
}
{
char fmt_buf[MR_STMTBUF_LEN];
char tmp_buf[16];
- char *res=result_buf, *tmp=tmp_buf, *fmt=fmt_buf;
- int state;
+ register char *res=result_buf, *tmp=tmp_buf, *fmt=fmt_buf;
+ register int state;
sprintf(fmt_buf,"%s %s",cmd,targetlist);
if(qual) { strcat(fmt_buf," WHERE "); strcat(fmt_buf,qual); }
if(*fmt=='%') { /* formatting -> tmp */
*tmp++ = *fmt;
state=1;
- } else *res++ = *fmt; /* text -> res */
+ } else *res++ = *fmt; /* text -> res */
break;
case 1:
if((*fmt=='%') && (tmp==tmp_buf+1)) { /* %% -> % */
*tmp='\0';
tmp=tmp_buf;
sprintf(res,tmp_buf,*argv++); /* print to result buffer */
- while(*res++) ;
+ while(*++res) ;
state=0;
} else *tmp++ = *fmt; /* keep copying the formatting to tmp */
break;
EXEC SQL BEGIN DECLARE SECTION;
int value;
EXEC SQL END DECLARE SECTION;
- int rowcount=0;
-
+ int starting_value;
+
EXEC SQL SELECT value INTO :value FROM numvalues WHERE name = :object;
if (sqlca.sqlerrd[2] != 1)
return(MR_NO_ID);
-/*
- * retrieve (exists = any(tbl.name where tbl.name = value))
- */
- sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s=:value",object,table_name,object); /** Will this work??? */
- EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
- EXEC SQL DECLARE csr002 CURSOR FOR stmt;
-
- EXEC SQL OPEN csr002;
- EXEC SQL FETCH csr002 USING DESCRIPTOR :SQLDA;
- if(sqlca.sqlcode == 0) {
- rowcount++;
- EXEC SQL FETCH csr002 USING DESCRIPTOR :SQLDA;
- if(sqlca.sqlcode == 0) rowcount++;
- }
- EXEC SQL CLOSE csr002;
-
- if (rowcount != 1)
- return(MR_NO_ID);
+ starting_value=value;
while (1) {
- value++;
- if (limit && value > MAX_ID_VALUE) /* Potential infinite loop */
- value = MIN_ID_VALUE;
-/*
- * retrieve (exists = any(tbl.name where tbl.name = value))
- */
-
- /** Does the following work like I think it should ??? */
+ if (limit && value > MAX_ID_VALUE)
+ value = MIN_ID_VALUE;
+
+ sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s=%d",object,table_name,object,value);
+ EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
+ EXEC SQL DECLARE csr002 CURSOR FOR stmt;
EXEC SQL OPEN csr002;
- EXEC SQL FETCH csr002 USING DESCRIPTOR :SQLDA;
- if(sqlca.sqlcode == 100) break;
+ EXEC SQL FETCH csr002 USING DESCRIPTOR :SQLDA;
+ if (sqlca.sqlcode < 0) return(mr_errcode);
+ if (sqlca.sqlcode == 100) break;
+
EXEC SQL CLOSE csr002;
+ value++;
+ if (limit && value == starting_value) {
+ com_err(whoami,0,"All id values have been used");
+ return(MR_NO_ID);
+ }
}
EXEC SQL CLOSE csr002;
EXEC SQL BEGIN DECLARE SECTION;
int idummy;
-extern char *cdummy, *stmt_buf;
+extern char cdummy[];
+extern char stmt_buf[];
EXEC SQL END DECLARE SECTION;
/* Specialized Access Routines */
int client_id, status;
list_id = *(int *)argv[0];
- EXEC SQL SELECT acl_id, acl_type, gid, public
+ EXEC SQL SELECT acl_id, acl_type, gid, publicflg
INTO :acl_id, :acl_type, :gid, :flags
FROM list
WHERE list_id = :list_id;
sprintf(argv[0], "#%s", argv[row]);
}
+ if((mr_errcode=prefetch_value(q,argv,cl))!=MR_SUCCESS)
+ return(mr_errcode);
+
return(MR_SUCCESS);
}
id = *(int *)argv[0];
- /*? Can this get wildcarded users? What happens then?! */
- /*? How does the REPEATED keyword work? */
/* For now, only allow users to be deleted if their status is 0 */
EXEC SQL REPEATED SELECT status INTO :flag FROM users
- WHERE user_id = :id;
+ WHERE users_id = :id;
if (flag != 0 && flag != 4)
return(MR_IN_USE);
if (sqlca.sqlerrd[2] > 0)
return(MR_IN_USE);
EXEC SQL REPEATED SELECT acl_id INTO :idummy FROM hostaccess
- WHERE acl_d = :id AND acl_type = 'USER';
+ WHERE acl_id = :id AND acl_type = 'USER';
if (sqlca.sqlerrd[2] > 0)
return(MR_IN_USE);
if (ingres_errno)
* at 6 & 7.
*/
-int setup_alis(q, argv)
+int setup_alis(q, argv, cl)
struct query *q;
- char **argv;
+ char *argv[];
+ client *cl;
{
EXEC SQL BEGIN DECLARE SECTION;
int ngid;
}
}
+ if((mr_errcode=prefetch_value(q,argv,cl))!=MR_SUCCESS)
+ return(mr_errcode);
+
return(MR_SUCCESS);
}
-/* setup_dlist - verify that the list is no longer being referenced
+/* setup_dlis - verify that the list is no longer being referenced
* and may safely be deleted.
*/
int setup_dlis(q, argv)
struct query *q;
- char **argv;
+ char *argv[];
{
EXEC SQL BEGIN DECLARE SECTION;
int flag, id;
static int var_phys_id;
EXEC SQL END DECLARE SECTION;
-setup_afil(q, argv)
+setup_afil(q, argv, cl)
struct query *q;
char *argv[];
+ client *cl;
{
char *type, *name;
int mach_id;
if (!strcmp(type, "NFS"))
return (check_nfs(mach_id, name, access));
- else
- return(MR_SUCCESS);
+
+ if((mr_errcode=prefetch_value(q,argv,cl))!=MR_SUCCESS)
+ return(mr_errcode);
+
+ return(MR_SUCCESS);
}
#ifdef GDSS
EXEC SQL REPEATED UPDATE users
SET modtime='now', modby=:who, modwith = :entity,
- fullname = :fullname, mit_affil = mit_year,
+ fullname = :fullname, affiliation = type,
signature = :rawsig,
fmodtime='now', fmodby = :who, fmodwith = :entity,
potype='NONE', pmodtime='now', pmodby = :who, pmodwith = :entity
#else /* GDSS */
EXEC SQL REPEATED UPDATE users
SET modtime='now', modby=:who, modwith = :entity,
- fullname = :fullname, mit_affil = mit_year,
+ fullname = :fullname, affiliation = type,
fmodtime='now', fmodby = :who, fmodwith = :entity,
potype='NONE', pmodtime='now', pmodby = :who, pmodwith = :entity
WHERE login = :login;
* modwith =l.#modwith)
* where l.list_id = :id
*/
- EXEC SQL REPEATED SELECT name, text(active), text(public),
- text(hidden), hidden, text(maillist), text(grouplist), text(gid),
- trim(acl_type), acl_id, desc, modtime, modby, modwith
+ /** Won't the TRIM() die a horrible INGRES death? **/
+ EXEC SQL REPEATED SELECT name, CHAR(active), CHAR(publicflg),
+ CHAR(hidden), hidden, CHAR(maillist), CHAR(grouplist), CHAR(gid),
+ TRIM(acl_type), acl_id, description, CHAR(modtime), modby, modwith
INTO :listname, :active, :public, :hidden, :hid, :maillist,
:grouplist, :gid_str, :acl_type, :acl_id, :desc,
:modtime, :modby_id, :modwith
* m.member_type = :atype and m.member_id = :aid
*/
EXEC SQL DECLARE csr117a CURSOR FOR
- SELECT name, text(active), text(public), text(hidden),
- text(maillist), text(grouplist)
+ SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
+ CHAR(maillist), CHAR(grouplist)
FROM list l, imembers m
WHERE l.list_id = m.list_id AND m.direct = 1
AND m.member_type = :atype AND m.member_id = :aid;
EXEC SQL CLOSE csr117a;
} else {
EXEC SQL DECLARE csr117b CURSOR FOR
- SELECT name, text(active), text(public), text(hidden),
- text(maillist), text(grouplist)
+ SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
+ CHAR(maillist), CHAR(grouplist)
FROM list l, imembers m
WHERE l.list_id = m.list_id
AND m.member_type = :atype AND m.member_id = :aid;
* where clause based on the arguments, then doing a retrieve.
*/
-static char *lflags[5] = { "active", "public", "hidden", "maillist", "group" };
+static char *lflags[5] = { "active", "publicflg", "hidden", "maillist", "group" };
int qualified_get_lists(q, argv, cl, action, actarg)
struct query *q;
}
rargv[0] = SQLDA->sqlvar[0].sqldata;
- sprintf(stmt_buf,"SELECT %s.%s FROM %s WHERE %s",q->rtable,field,q->rtable,qual);
+ sprintf(stmt_buf,"SELECT %s.%s FROM %s %s WHERE %s",q->rtable,field,q->rtable,q->rvar,qual);
EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
if((mr_errcode=mr_check_SQLDA(SQLDA)) != MR_SUCCESS)
return(mr_errcode);
while(1) {
EXEC SQL FETCH csr123 USING DESCRIPTOR :SQLDA;
if(sqlca.sqlcode != 0) break;
- mr_fix_nulls_in_SQLDA(SQLDA);
rowcount++;
(*action)(1, rargv, actarg);
}
incremental_clear_before();
EXEC SQL SELECT value INTO :gidval FROM numvalues WHERE name = 'gid';
EXEC SQL REPEATED INSERT INTO list
- (name, list_id, active, public, hidden, maillist, grouplist,
- gid, desc, acl_type, acl_id,
+ (name, list_id, active, publicflg, hidden, maillist, grouplist,
+ gid, description, acl_type, acl_id,
modtime, modby, modwith)
VALUES (:login, :list_id, 1, 0, 0, 0, 1,
:gidval, 'User Group', 'USER', :users_id,
com_err(whoami, 0, "validating row: %s", qual);
/* look for the record */
-/*
- * range of rvar is table
- * retrieve (rowcount = count(rvar.name where qual))
- */
- sprintf(stmt_buf,"SELECT COUNT (*) FROM %s %s WHERE %s",q->rtable,q->rvar,qual);
+ sprintf(stmt_buf,"SELECT COUNT (*) FROM %s WHERE %s",q->rtable,qual);
EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
EXEC SQL DECLARE csr126 CURSOR FOR stmt;
EXEC SQL OPEN csr126;
EXEC SQL FETCH csr126 USING DESCRIPTOR :SQLDA;
EXEC SQL CLOSE csr126;
- rowcount=*(int *)SQLDA->[0].sqldata;
+ rowcount = *(int *)SQLDA->sqlvar[0].sqldata;
if (ingres_errno) return(mr_errcode);
if (rowcount == 0) return(MR_NO_MATCH);
}
if (!strcmp(namefield, "uid")) {
-/*
- * retrieve (id = table.idfield) where table.namefield = int4(name)
- */
- sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s.%s = %s",idfield,tbl,tbl,namefield,name);
- if (ingres_errno) return(mr_errcode);
+ sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s = %s",idfield,tbl,namefield,name);
} else {
-/*
- * retrieve (id = table.idfield) where table.namefield = name
- */
- sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s.%s = '%s'",idfield,tbl,tbl,namefield,name);
- if (ingres_errno) return(mr_errcode);
+ sprintf(stmt_buf,"SELECT %s FROM %s WHERE %s = '%s'",idfield,tbl,namefield,name);
}
EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
EXEC SQL DECLARE csr127 CURSOR FOR stmt;
if(sqlca.sqlcode == 0) {
rowcount++;
EXEC SQL FETCH csr127 USING DESCRIPTOR :SQLDA;
- if(sqlca.sqlcode == 0) rowcount++
+ if(sqlca.sqlcode == 0) rowcount++;
}
EXEC SQL CLOSE csr127;
+ if (ingres_errno)
+ return(mr_errcode);
if (rowcount != 1) return(vo->error);
- *argv[vo->index] = *SQLDA->sqlvar[0]->sqldata;
+ *argv[vo->index] = *SQLDA->sqlvar[0].sqldata;
return(MR_EXISTS);
}
if (islower(*c))
*c = toupper(*c);
}
-/*
- * retrieve (rowcount = countu(table.namefield
- * where table.namefield = name))
- */
- sprintf(stmt_buf,"SELECT COUNT (DISTINCT *) FROM %s WHERE %s.%s = '%s'",
+ sprintf(stmt_buf,"SELECT DISTINCT COUNT(*) FROM %s WHERE %s.%s = '%s'",
tbl,tbl,namefield,name);
EXEC SQL PREPARE stmt INTO :SQLDA USING NAMES FROM :stmt_buf;
EXEC SQL DECLARE csr128 CURSOR FOR stmt;
EXEC SQL OPEN csr128;
EXEC SQL FETCH csr128 USING DESCRIPTOR :SQLDA;
- rowcount=*(int *)SQLDA->sqlvar[0]->sqldata;
+ rowcount = *(int *)SQLDA->sqlvar[0].sqldata;
EXEC SQL CLOSE csr128;
if (ingres_errno) return(mr_errcode);
{
EXEC SQL BEGIN DECLARE SECTION;
char *typename;
- char *value;
+ char *val;
EXEC SQL END DECLARE SECTION;
register char *c;
typename = vo->table;
- c = value = argv[vo->index];
+ c = val = argv[vo->index];
while (*c) {
- if (illegalchars[*c])
+ if (illegalchars[*c++])
return(MR_BAD_CHAR);
}
/* uppercase type fields */
- for (c = value; *c; c++) if (islower(*c)) *c = toupper(*c);
+ for (c = val; *c; c++) if (islower(*c)) *c = toupper(*c);
EXEC SQL SELECT trans INTO :cdummy FROM alias
- WHERE name = :typename AND type='TYPE' AND trans = :value;
+ WHERE name = :typename AND type='TYPE' AND trans = :val;
if (ingres_errno) return(mr_errcode);
return (sqlca.sqlerrd[2] ? MR_EXISTS : vo->error);
}
return(MR_SUCCESS);
}
+/* Use this after FETCH USING DESCRIPTOR one or more
+ * result columns may contain NULLs. This routine is
+ * not currently needed, since db/schema creates all
+ * columns with a NOT NULL WITH DEFAULT clause.
+ */
mr_fix_nulls_in_SQLDA(da)
MR_SQLDA_T *da;
{
*intp=0;
}
break;
- } /** I believe that these two are the only types Moira encounters */
+ }
}
}
+
+/* prefetch_value():
+ * This routine fetches an appropriate value from the numvalues table.
+ * It is a little hack to get around the fact that SQL doesn't let you
+ * do something like INSERT INTO table (foo) VALUES (other_table.bar).
+ *
+ * It is called from the query table as (*v->pre_rtn)(q,Argv,cl) or
+ * from within a setup_...() routine with the appropriate arguments.
+ *
+ * Correct functioning of this routine may depend on the assumption
+ * that this query is an APPEND.
+ */
+
+prefetch_value(q,argv,cl)
+ struct query *q;
+ char **argv;
+ client *cl;
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *name = q->validate->object_id;
+ int value;
+ EXEC SQL END DECLARE SECTION;
+ int status, limit, argc;
+
+ /* set next object id, limiting it if necessary */
+ if(!strcmp(name, "uid") || !strcmp(name, "gid"))
+ limit = 1; /* So far as I know, this isn't needed. Just CMA. */
+ else
+ limit = 0;
+ if((status = set_next_object_id(name, q->rtable, limit)) != MR_SUCCESS)
+ return(status);
+
+ /* fetch object id */
+ EXEC SQL SELECT value INTO :value FROM numvalues WHERE name=:name;
+ if(ingres_errno) return(mr_errcode);
+ if(sqlca.sqlerrd[2] != 1) return(MR_INTERNAL);
+
+ argc = q->argc + q->vcnt; /* end of Argv for APPENDs */
+ sprintf(argv[argc],"%d",value);
+
+ return(MR_SUCCESS);
+}
+
+/* eof:qsupport.dc */
int access_filesys();
/* Query Setup Routines */
+int prefetch_value();
int setup_ausr();
int setup_dusr();
int setup_spop();
amac_valobj,
3,
NAME,
- "imembers.name = uppercase('%s')",
+ "machine.name = uppercase('%s')",
1,
MACH_ID,
0,
- 0,
+ prefetch_value,
set_uppercase_modtime,
};
aclu_valobj,
2,
NAME,
- "clusters.name = '%s'",
+ "cluster.name = '%s'",
1,
CLU_ID,
0,
- 0,
+ prefetch_value,
set_modtime,
};
amtc_valobj,
2,
MACH_ID,
- "imembers.mach_id = %d and imembers.clu_id = %d",
+ "mcmap.mach_id = %d and mcmap.clu_id = %d",
2,
0,
0,
};
static struct validate anfp_validate = {
+ anfp_valobj,
+ 2,
+ DIR,
+ "nfsphys.mach_id = %d and nfsphys.dir = '%s'",
+ 2,
+ "nfsphys_id",
+ 0,
+ prefetch_value,
+ set_nfsphys_modtime,
+};
+
+static struct validate unfp_validate = {
anfp_valobj,
2,
DIR,
static char *glin_fields[] = {
NAME,
- NAME, "active", "public", "hidden", "maillist", "grouplist", "gid",
+ NAME, "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
ACE_TYPE, ACE_NAME, DESC, MOD1, MOD2, MOD3,
};
};
static char *alis_fields[] = {
- NAME, "active", "public", "hidden", "maillist", "grouplist", "gid",
+ NAME, "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
ACE_TYPE, ACE_NAME, DESC,
};
static char *ulis_fields[] = {
NAME,
- "newname", "active", "public", "hidden", "maillist", "grouplist", "gid",
+ "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
ACE_TYPE, ACE_NAME, DESC,
};
};
static char *qgli_fields[] = {
- "active", "public", "hidden", "maillist", "grouplist",
+ "active", "publicflg", "hidden", "maillist", "grouplist",
"list",
};
static char *glom_fields[] = {
"member_type", "member_name",
- "list_name", "active", "public", "hidden", "maillist", "grouplist",
+ "list_name", "active", "publicflg", "hidden", "maillist", "grouplist",
};
static struct valobj glom_valobj[] = {
};
static char *gats_fields[] = {
- "table_name", "retrieves", "appends", "updates", "deletes", MOD1, MOD2, MOD3,
+ "table_name", "appends", "updates", "deletes", MOD1, MOD2, MOD3,
};
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle FROM users",
+ "login, CHAR(uid), shell, last, first, middle FROM users",
galo_fields,
6,
"users_id != 0",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle FROM users",
+ "login, CHAR(uid), shell, last, first, middle FROM users",
galo_fields,
6,
"status = 1",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle, text(status), clearid, type, modtime, text(modby), modwith FROM users",
+ "login, CHAR(uid), shell, last, first, middle, CHAR(status), clearid, type, CHAR(modtime), CHAR(modby), modwith FROM users",
gubl_fields,
12,
"login = '%s' AND users_id != 0",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle, text(status), clearid, type, modtime, text(modby), modwith FROM users",
+ "login, CHAR(uid), shell, last, first, middle, CHAR(status), clearid, type, CHAR(modtime), CHAR(modby), modwith FROM users",
gubu_fields,
12,
"uid = %s AND users_id != 0",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle, text(status), clearid, type, modtime, text(modby), modwith FROM users",
+ "login, CHAR(uid), shell, last, first, middle, CHAR(status), clearid, type, CHAR(modtime), CHAR(modby), modwith FROM users",
gubn_fields,
12,
"first = '%s' AND last = '%s' AND users_id != 0",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle, text(status), clearid, type, modtime, text(modby), modwith FROM users",
+ "login, CHAR(uid), shell, last, first, middle, CHAR(status), clearid, type, CHAR(modtime), CHAR(modby), modwith FROM users",
gubc_fields,
12,
"type = uppercase('%s') AND users_id != 0",
RETRIEVE,
"u",
USERS,
- "login, text(uid), shell, last, first, middle, text(status), clearid, type, modtime, text(modby), modwith FROM users",
+ "login, CHAR(uid), shell, last, first, middle, CHAR(status), clearid, type, CHAR(modtime), CHAR(modby), modwith FROM users",
gubm_fields,
12,
"clearid = '%s' AND users_id != 0",
&VDsortf,
},
+
{
- /* Q_AUSR - ADD_USER */ /** Needs subselect */
+ /* Q_AUSR - ADD_USER */ /* uses prefetch_value() for users_id */
"add_user",
"ausr",
APPEND,
"u",
USERS,
- "INTO users (login, users_id, uid, shell, last, first, middle, status, clearid, type) VALUES ( '%s', numvalues.value, %s, '%s', '%s', '%s', '%s', %s, '%s', '%s')",
+ "INTO users (login, uid, shell, last, first, middle, status, clearid, type, users_id) VALUES ( '%s', %s, '%s', '%s', '%s', '%s', %s, '%s', '%s', %s)",
ausr_fields,
9,
- "numvalues.name = 'users_id'",
+ 0,
0,
&ausr_validate,
},
RETRIEVE,
"u",
USERS,
- "login, fullname, nickname, home_addr, home_phone, office_addr, office_phone, department, affiliation, fmodtime, text(fmodby), fmodwith FROM users",
+ "login, fullname, nickname, home_addr, home_phone, office_addr, office_phone, department, affiliation, CHAR(fmodtime), CHAR(fmodby), fmodwith FROM users",
gfbl_fields,
12,
"users_id = %d",
RETRIEVE,
"u",
USERS,
- "login, potype, text(pop_id) + ':' + text(box_id), pmodtime, text(pmodby), pmodwith FROM users",
+ "login, potype, CHAR(pop_id) + ':' + CHAR(box_id), CHAR(pmodtime), CHAR(pmodby), pmodwith FROM users",
gpob_fields,
6,
"users_id = %d",
RETRIEVE,
"u",
USERS,
- "login, potype, text(pop_id) + ':' + text(box_id) FROM users",
+ "login, potype, CHAR(pop_id) + ':' + CHAR(box_id) FROM users",
gpox_fields,
3,
"potype != 'NONE'",
RETRIEVE,
"u",
USERS,
- "login, potype, text(pop_id) + ':' + text(box_id) FROM users",
+ "login, potype, CHAR(pop_id) + ':' + CHAR(box_id) FROM users",
gpox_fields,
3,
"potype = 'POP'",
RETRIEVE,
"u",
USERS,
- "login, potype, text(pop_id) + ':' + text(box_id) FROM users",
+ "login, potype, CHAR(pop_id) + ':' + CHAR(box_id) FROM users",
gpox_fields,
3,
"potype = 'SMTP'",
RETRIEVE,
"m",
MACHINE,
- "name, type, modtime, text(modby), modwith FROM machine",
+ "name, type, CHAR(modtime), CHAR(modby), modwith FROM machine",
gmac_fields,
5,
"name = uppercase('%s') AND mach_id != 0",
+/* "name LIKE '%s' ESCAPE '\\' AND mach_id != 0", */ /* Pattern matching */
1,
&VDsortf,
},
{
- /* Q_AMAC - ADD_MACHINE */ /** Needs subselect */
+ /* Q_AMAC - ADD_MACHINE */ /* uses prefetch_value() for mach_id */
"add_machine",
"amac",
APPEND,
"m",
MACHINE,
- "INTO machine (name, mach_id, type) VALUES (uppercase('%s'),numvalues.value,'%s')",
+ "INTO machine (name, type, mach_id) VALUES (uppercase('%s'),'%s',%s)",
amac_fields,
2,
- "numvalues.name = 'mach_id'",
+ 0,
0,
&amac_validate,
},
RETRIEVE,
"c",
CLUSTER,
- "name, desc, location, modtime, text(modby), modwith FROM cluster",
+ "name, description, location, CHAR(modtime), CHAR(modby), modwith FROM cluster",
gclu_fields,
6,
"name = '%s' AND clu_id != 0",
},
{
- /* Q_ACLU - ADD_CLUSTER */ /** Needs subselect */
+ /* Q_ACLU - ADD_CLUSTER */ /* uses prefetch_value() for clu_id */
"add_cluster",
"aclu",
APPEND,
"c",
CLUSTER,
- "INTO cluster (name, clu_id, desc, location) VALUES ('%s',numvalues.value,'%s','%s')",
+ "INTO cluster (name, description, location, clu_id) VALUES ('%s','%s','%s',%s)",
aclu_fields,
3,
- "numvalues.name = 'clu_id'",
+ 0,
0,
&aclu_validate,
},
UPDATE,
"c",
CLUSTER,
- "cluster SET name = '%s', desc = '%s', location = '%s'",
+ "cluster SET name = '%s', description = '%s', location = '%s'",
uclu_fields,
3,
"clu_id = %d",
RETRIEVE,
"s",
"servers",
- "name, text(update_int), target_file, script, text(dfgen), text(dfcheck), type, text(enable), text(inprogress), text(harderror), errmsg, acl_type, text(acl_id), modtime, text(modby), modwith FROM servers",
+ "name, CHAR(update_int), target_file, script, CHAR(dfgen), CHAR(dfcheck), type, CHAR(enable), CHAR(inprogress), CHAR(harderror), errmsg, acl_type, CHAR(acl_id), CHAR(modtime), CHAR(modby), modwith FROM servers",
gsin_fields,
16,
"name = uppercase('%s')",
RETRIEVE,
"sh",
"serverhosts",
- "sh.service, m.name, text(sh.enable), text(sh.override), text(sh.success), text(sh.inprogress), text(sh.hosterror), sh.hosterrmsg, text(sh.ltt), text(sh.lts), text(sh.value1), text(sh.value2), sh.value3, sh.modtime, text(sh.modby), sh.modwith FROM serverhosts sh, machine m",
+ "sh.service, m.name, CHAR(sh.enable), CHAR(sh.override), CHAR(sh.success), CHAR(sh.inprogress), CHAR(sh.hosterror), sh.hosterrmsg, CHAR(sh.ltt), CHAR(sh.lts), CHAR(sh.value1), CHAR(sh.value2), sh.value, CHAR(sh.modtime), CHAR(sh.modby), sh.modwith FROM serverhosts sh, machine m",
gshi_fields,
16,
"sh.service = uppercase('%s') AND m.name = uppercase('%s') AND m.mach_id = sh.mach_id",
RETRIEVE,
"ha",
"hostaccess",
- "m.name, ha.acl_type, text(ha.acl_id), ha.modtime, text(ha.modby), ha.modwith FROM hostaccess ha, machine m",
+ "m.name, ha.acl_type, CHAR(ha.acl_id), CHAR(ha.modtime), CHAR(ha.modby), ha.modwith FROM hostaccess ha, machine m",
gsha_fields,
6,
"m.name = uppercase('%s') AND ha.mach_id = m.mach_id",
RETRIEVE,
"fs",
FILESYS,
- "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, l.name, text(fs.createflg), fs.lockertype, fs.modtime, text(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+ "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, 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 = '%s' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
RETRIEVE,
"fs",
FILESYS,
- "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, l.name, text(fs.createflg), fs.lockertype, fs.modtime, text(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+ "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, 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",
RETRIEVE,
"fs",
FILESYS,
- "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, l.name, text(fs.createflg), fs.lockertype, fs.modtime, text(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l, nfsphys np",
+ "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, 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 = '%s' AND fs.type = 'NFS'",
RETRIEVE,
"fs",
FILESYS,
- "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, l.name, text(fs.createflg), fs.lockertype, fs.modtime, text(fs.modby), fs.modwith FROM filesys fs, machine m, users u, list l",
+ "fs.label, fs.type, m.name, fs.name, fs.mount, fs.access, fs.comments, u.login, 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",
},
{
- /* Q_AFIL - ADD_FILESYS */ /** Need subselect */
+ /* Q_AFIL - ADD_FILESYS */ /* uses prefetch_value() for filsys_id */
"add_filesys",
"afil",
APPEND,
"fs",
FILESYS,
- "INTO filesys (filsys_id, label, type, mach_id, name, mount, access, comments, owner, owners, createflg, lockertype) VALUES (numvalues.value,'%s','%s',%d,'%s','%s','%s','%s',%d,%d,%s,'%s')",
+ "INTO filesys (label, type, mach_id, name, mount, access, comments, owner, owners, createflg, lockertype, filsys_id) VALUES ('%s','%s',%d,'%s','%s','%s','%s',%d,%d,%s,'%s',%s)",
afil_fields,
11,
- "numvalues.name = 'filsys_id'",
+ 0,
0,
&afil_validate,
},
RETRIEVE,
"np",
"nfsphys",
- "m.name, np.dir, np.device, text(np.status), text(np.allocated), text(np.size), np.modtime, text(np.modby), np.modwith FROM nfsphys np, machine m",
+ "m.name, np.dir, np.device, CHAR(np.status), CHAR(np.allocated), CHAR(np.size), CHAR(np.modtime), CHAR(np.modby), np.modwith FROM nfsphys np, machine m",
ganf_fields,
9,
"m.mach_id = np.mach_id",
RETRIEVE,
"np",
"nfsphys",
- "m.name, np.dir, np.device, text(np.status), text(np.allocated), text(np.size), np.modtime, text(np.modby), np.modwith FROM nfsphys np, machine m",
+ "m.name, np.dir, np.device, CHAR(np.status), CHAR(np.allocated), CHAR(np.size), CHAR(np.modtime), CHAR(np.modby), np.modwith FROM nfsphys np, machine m",
gnfp_fields,
9,
"np.mach_id = %d AND np.dir = '%s' AND m.mach_id = np.mach_id",
},
{
- /* Q_ANFP - ADD_NFSPHYS */ /** Needs subselect */
+ /* Q_ANFP - ADD_NFSPHYS */ /* uses prefetch_value() for nfsphys_id */
"add_nfsphys",
"anfp",
APPEND,
"np",
"nfsphys",
- "INTO nfsphys (nfsphys_id, mach_id, dir, device, status, allocated, size) VALUES (numvalues.value, %d, '%s', '%s', %s, %s, %s)",
+ "INTO nfsphys (mach_id, dir, device, status, allocated, size, nfsphys_id) VALUES (%d, '%s', '%s', %s, %s, %s, %s)",
ganf_fields,
6,
- "numvalues.name = 'nfsphys_id'",
+ 0,
0,
&anfp_validate,
},
4,
"mach_id = %d AND dir = '%s'",
2,
- &anfp_validate,
+ &unfp_validate,
},
{
1,
"mach_id = %d AND dir = '%s'",
2,
- &anfp_validate,
+ &unfp_validate,
},
{
RETRIEVE,
"q",
QUOTA,
- "fs.label, q.type, text(q.entity_id), text(q.quota), text(q.phys_id), m.name, q.modtime, text(q.modby), q.modwith FROM quota q, filesys fs, machine m",
+ "fs.label, q.type, CHAR(q.entity_id), CHAR(q.quota), CHAR(q.phys_id), m.name, CHAR(q.modtime), CHAR(q.modby), q.modwith FROM quota q, filesys fs, machine m",
gqot_fields,
9,
"fs.label = '%s' AND q.type = '%s' AND q.entity_id = %d AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
RETRIEVE,
"q",
QUOTA,
- "fs.label, q.type, text(q.entity_id), text(q.quota), text(q.phys_id), m.name, q.modtime, text(q.modby), q.modwith FROM quota q, filesys fs, machine m",
+ "fs.label, q.type, CHAR(q.entity_id), CHAR(q.quota), CHAR(q.phys_id), m.name, CHAR(q.modtime), CHAR(q.modby), q.modwith FROM quota q, filesys fs, machine m",
gqbf_fields,
9,
"fs.label = '%s' AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
RETRIEVE,
"q",
QUOTA,
- "fs.label, u.login, text(q.quota), text(q.phys_id), m.name, q.modtime, text(q.modby), q.modwith FROM quota q, filesys fs, users u, machine m",
+ "fs.label, u.login, CHAR(q.quota), CHAR(q.phys_id), m.name, CHAR(q.modtime), CHAR(q.modby), q.modwith FROM quota q, filesys fs, users u, machine m",
gnfq_fields,
8,
"fs.label = '%s' AND q.type = 'USER' AND q.entity_id = u.users_id AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id AND u.login = '%s'",
RETRIEVE,
"q",
QUOTA,
- "fs.label, u.login, text(q.quota), np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
+ "fs.label, u.login, CHAR(q.quota), np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
gnqp_fields,
5,
"np.mach_id = %d AND np.dir = '%s' AND q.phys_id = np.nfsphys_id AND fs.filsys_id = q.filsys_id AND q.type = 'USER' AND u.users_id = q.entity_id AND m.mach_id = np.mach_id",
},
{
- /* Q_ALIS - ADD_LIST */ /** Needs numvalues subselect */
+ /* Q_ALIS - ADD_LIST */ /* uses prefetch_value() for list_id */
"add_list",
"alis",
APPEND,
"l",
LIST,
- "INTO list (list_id, name, active, public, hidden, maillist, grouplist, gid, acl_type, acl_id, desc) VALUES (numvalues.value,'%s',%s,%s,%s,%s,%s,%s,'%s',%d,'%s')",
+ "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, list_id) VALUES ('%s',%s,%s,%s,%s,%s,%s,'%s',%d,'%s',%s)",
alis_fields,
10,
- "numvalues.name = 'list_id'",
+ 0,
0,
&alis_validate,
},
UPDATE,
"l",
LIST,
- "list SET name='%s', active=%s, public=%s, hidden=%s, maillist=%s, grouplist=%s, gid=%s, acl_type='%s', acl_id=%d, desc='%s'",
+ "list SET name='%s', active=%s, publicflg=%s, hidden=%s, maillist=%s, grouplist=%s, gid=%s, acl_type='%s', acl_id=%d, description='%s'",
ulis_fields,
10,
"list.list_id = %d",
RETRIEVE,
"z",
"zephyr",
- "class, xmt_type, text(xmt_id),sub_type, text(sub_id),iws_type, text(iws_id),iui_type, text(iui_id), modtime, text(modby), modwith FROM zephyr",
+ "class, xmt_type, CHAR(xmt_id),sub_type, CHAR(sub_id),iws_type, CHAR(iws_id),iui_type, CHAR(iui_id), CHAR(modtime), CHAR(modby), modwith FROM zephyr",
gzcl_fields,
12,
"class = '%s'",
RETRIEVE,
"s",
"services",
- "name, protocol, text(port), desc, modtime, text(modby), modwith FROM services",
+ "name, protocol, CHAR(port), description, CHAR(modtime), CHAR(modby), modwith FROM services",
gsvc_fields,
7,
"name = '%s'",
APPEND,
"s",
"services",
- "INTO services (name, protocol, port, desc) VALUES ('%s','%s',%s,'%s')",
+ "INTO services (name, protocol, port, description) VALUES ('%s','%s',%s,'%s')",
asvc_fields,
4,
(char *)0,
RETRIEVE,
"p",
"printcap",
- "p.name, m.name, p.dir, p.rp, text(p.quotaserver), text(p.auth), text(p.price), p.comments, p.modtime, text(p.modby), p.modwith FROM printcap p, machine m",
+ "p.name, m.name, p.dir, p.rp, CHAR(p.quotaserver), CHAR(p.auth), CHAR(p.price), p.comments, CHAR(p.modtime), CHAR(p.modby), p.modwith FROM printcap p, machine m",
gpce_fields,
11,
"p.name = '%s' AND m.mach_id = p.mach_id",
RETRIEVE,
"p",
"printcap",
- "p.name, m.name, p.dir, p.rp, p.comments, p.modtime, text(p.modby), p.modwith FROM printcap p, machine m",
+ "p.name, m.name, p.dir, p.rp, p.comments, CHAR(p.modtime), CHAR(p.modby), p.modwith FROM printcap p, machine m",
gpcp_fields,
8,
"p.name = '%s' AND m.mach_id = p.mach_id",
RETRIEVE,
"p",
"palladium",
- "p.name, text(p.ident), m.name, p.modtime, text(p.modby), p.modwith FROM palladium p, machine m",
+ "p.name, CHAR(p.ident), m.name, CHAR(p.modtime), CHAR(p.modby), p.modwith FROM palladium p, machine m",
gpdm_fields,
6,
"p.name = '%s' AND m.mach_id = p.mach_id",
RETRIEVE,
"v",
"numvalues",
- "text(value) FROM numvalues",
+ "CHAR(value) FROM numvalues",
gval_fields,
1,
"name = '%s'",
RETRIEVE,
"tbs",
"tblstats",
- "tbs.table_name, text(tbs.retrieves), text(tbs.appends), text(tbs.updates), text(tbs.deletes), tbs.modtime FROM tblstats tbs",
+ "tbs.table_name, CHAR(tbs.appends), CHAR(tbs.updates), CHAR(tbs.deletes), CHAR(tbs.modtime) FROM tblstats tbs",
gats_fields,
- 6,
+ 5,
(char *)0,
0,
0,