I want to make sure that the key_value is unique for each user who accesses this application. Do I put a CFLOCK tag around the Select Query and another CFLock tag around the Update SQL statement? But I don't know what the scope should be? Application, server or Session?
<CFLOCK TIMEOUT="30"
THROWONTIMEOUT="YES"
NAME="#Session.Session_ID#> What should be the name?
TYPe="Exclusive">
<CFQUERY NAME="GETPERMIT" DATASOURCE="#DSNAME#">
SELECT key_value
FROM gen_key
WHERE table_name = 'NSR_PERMIT'
AND field_name = 'PERMIT_ID'
</CFQUERY>
<CFSET session.permit_id= GetPermit.key_value + 1>
</CFLOCK>
<CFQUERY NAME="updategenkey" DATASOURCE="#DSNAME#">
UPDATE gen_key
SET key_value = #session.permit_id#
WHERE table_name = 'NSR_PERMIT'
AND field_name = 'PERMIT_ID'
</CFQUERY>
Please help.
Longhorn
<CFLOCK TIMEOUT="30"
THROWONTIMEOUT="YES"
NAME="#Session.Session_ID#> What should be the name?
TYPe="Exclusive">
<CFQUERY NAME="GETPERMIT" DATASOURCE="#DSNAME#">
SELECT key_value
FROM gen_key
WHERE table_name = 'NSR_PERMIT'
AND field_name = 'PERMIT_ID'
</CFQUERY>
<CFSET session.permit_id= GetPermit.key_value + 1>
</CFLOCK>
<CFQUERY NAME="updategenkey" DATASOURCE="#DSNAME#">
UPDATE gen_key
SET key_value = #session.permit_id#
WHERE table_name = 'NSR_PERMIT'
AND field_name = 'PERMIT_ID'
</CFQUERY>
Please help.
Longhorn