<!--- INSERT INTO DB --->
<cfquery name="createLogEntry" datasource="#request.LOGdsn#">
INSERT INTO APP_LOG
(UNIQUE_ID,
APPLICATION_KEY,
EMPLOYEE_KEY,
DATESTAMP,
REMARKS,
SEVERITY_ID,
LOG_TYPE_ID)
VALUES
(#Arguments.unique_key#,
#Arguments.application_key#,
#Arguments.employee_key#,
#now()#,
'#Arguments.remarks#',
#Arguments.severity_key#,
#Arguments.log_type_key#)
</cfquery>
<cfquery name="getMax" datasource="#request.LOGdsn#">
SELECT MAX(APP_LOG_ID) AS MAX_ID
FROM APP_LOG
</cfquery>
Now I'm doing it like this:
<!--- INSERT INTO DB --->
<cfquery name="createLogEntry" datasource="#request.LOGdsn#">
INSERT INTO [Aeolus].[dbo].[APP_LOG]
(UNIQUE_ID,
APPLICATION_KEY,
EMPLOYEE_KEY,
DATESTAMP,
REMARKS,
SEVERITY_ID,
LOG_TYPE_ID)
VALUES
(#Arguments.unique_key#,
#Arguments.application_key#,
#Arguments.employee_key#,
#now()#,
'#Arguments.remarks#',
#Arguments.severity_key#,
#Arguments.log_type_key#)
SELECT APP_GROUP_KEY = SCOPE_IDENTITY()
SET NOCOUNT OFF
</cfquery>
And POOF! No more worries about locking and integrity issues... The page load should be just slightly faster not to mention less typing which is my personal favorite. =)
No comments:
Post a Comment