[1695] in Moira
Re: sidhistory in moira
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Tue Oct 31 20:40:47 2000
Message-Id: <200011010140.UAA01425@riff-raff-w20.mit.edu>
To: Qing Dong <dongq@MIT.EDU>
cc: Garry Zacheiss <zacheiss@MIT.EDU>, moiradev@MIT.EDU
In-Reply-To: Your message of "Tue, 31 Oct 2000 19:33:00 EST."
<200011010031.TAA06612@melbourne-city-street.MIT.EDU>
Date: Tue, 31 Oct 2000 20:40:39 -0500
From: Garry Zacheiss <zacheiss@MIT.EDU>
>> I thought that the "field" and "qual" in the validate structure do
>> the row validation to make sure a specified row doesn't already
>> exist in the table. What do they do then?
Oh right; I always forget the nuiances of using this. You're right,
with the caveat that for the format string in the qual field of the
structure, you must use the arguments of the query in the order that
they were provided. In the code you originally sent, you were doing
"sid = '%s'", and only using one argument, which was always going to be
the users_id or list_id, since the first argument to the query is a
login name or list name.
The patch below does the correct thing, and is superior to the one I
sent earlier, even if I'm going to forget how it works again at some
point in the future.
Garry
Index: queries2.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/queries2.c,v
retrieving revision 2.79
diff -c -r2.79 queries2.c
*** queries2.c 2000/10/25 20:38:43 2.79
--- queries2.c 2000/11/01 00:52:45
***************
*** 2990,2997 ****
VOuser0,
1,
"sid",
! "sid = '%s'",
! 1,
0,
0,
0,
--- 2990,2997 ----
VOuser0,
1,
"sid",
! "users_id = %d AND sid = '%s'",
! 2,
0,
0,
0,
***************
*** 3007,3014 ****
VOlist0,
1,
"sid",
! "sid = '%s'",
! 1,
0,
0,
0,
--- 3007,3014 ----
VOlist0,
1,
"sid",
! "list_id = %d AND sid = '%s'",
! 2,
0,
0,
0,