register struct valobj *vo;
{
EXEC SQL BEGIN DECLARE SECTION;
- char *name, *namefield, *idfield;
+ char *name;
int id, rowcount, tbl;
EXEC SQL END DECLARE SECTION;
int status;
name = argv[vo->index];
tbl = vo->table;
- namefield = vo->namefield;
- idfield = vo->idfield;
- if ((tbl==USERS_TABLE && !strcmp(namefield, "login")) ||
- tbl==MACHINE_TABLE || tbl==SUBNET_TABLE || tbl==FILESYS_TABLE ||
- tbl==LIST_TABLE || tbl==CLUSTER_TABLE || tbl==STRINGS_TABLE) {
- if (tbl==MACHINE_TABLE || tbl==SUBNET_TABLE)
+ if (tbl==MACHINE_TABLE || tbl==SUBNET_TABLE)
for (c = name; *c; c++) if (islower(*c)) *c = toupper(*c);
- status = name_to_id(name, tbl, &id);
- if (status == 0) {
+ status = name_to_id(name, tbl, &id);
+ if (status == 0) {
*(int *)argv[vo->index] = id;
return(MR_EXISTS);
- } else if (status == MR_NO_MATCH && tbl==STRINGS_TABLE &&
- (q->type == APPEND || q->type == UPDATE)) {
+ } else if (status == MR_NO_MATCH && tbl==STRINGS_TABLE &&
+ (q->type == APPEND || q->type == UPDATE)) {
id=add_string(name);
cache_entry(name, STRINGS_TABLE, id);
*(int *)argv[vo->index] = id;
return(MR_EXISTS);
- } else if (status == MR_NO_MATCH || status == MR_NOT_UNIQUE)
+ } else if (status == MR_NO_MATCH || status == MR_NOT_UNIQUE)
return(vo->error);
- else
+ else
return(status);
- } else {
- /* else, it's `dubu', which uses unix_uid from users */
- EXEC SQL SELECT COUNT(*) INTO :rowcount FROM users
- WHERE unix_uid = :name;
- if (dbms_errno) return(mr_errcode);
- if (rowcount != 1) return(vo->error);
- EXEC SQL SELECT users_id INTO :id FROM users
- WHERE unix_uid = :name;
- *(int *)argv[vo->index] = id;
- return(MR_EXISTS);
- }
}
int validate_name(argv, vo)