Ticket #122 (new defect)
MS SQL uniqueidentifier field default value
| Reported by: | nmische | Owned by: | dhughes |
|---|---|---|---|
| Type: | defect | Priority: | high |
| Milestone: | 1.0 Release | Component: | Reactor - DBMS Interfaces |
| Version: | Severity: | major | |
| Keywords: | spam | Cc: |
Description
If a uniqueidentifer field has a default value of "(newid())" then the project TO should set this value. However due to a bug in the MSSQL ObjectDao.cfc the field's default value is not properly set. The problem is that the ObjectDao's getDefault method has a case statement based on the cfDataType of the field, however the case near line 128 is for the dbDataType "uniqueidentifier." I think that case should be updated to something like:
<cfcase value="guid">
<cfif ReFindNoCase("'*newId()'*", arguments.sqlDefaultValue)>
<cfreturn "##Insert(""-"",CreateUUID(),23)##" />
<cfelse>
<cfreturn "" />
</cfif>
</cfcase>
Also, given that this will create valid MS GUIDs for the TO default value and that the validator will check that TO uniqueidentifier fields match the MS GUID format, the dao.project.xsl can be simplified by removing the xls:choose statements for uniqueidentifer dbdatatypes.
I've attached patches for both the /reactor/data/mssql/ObjectDao.cfc and the /reactor/xsl/dao.project.xsl.

