Ticket #122 (new defect)

Opened 2 years ago

Last modified 3 months ago

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.

Attachments

ObjectDao.diff (1.7 kB) - added by nmische 2 years ago.
MS SQL ObjectDao.cfc Patch
dao.project.diff (2.8 kB) - added by nmische 2 years ago.
dao.project.xsl Patch

Change History

Changed 2 years ago by nmische

MS SQL ObjectDao.cfc Patch

Changed 2 years ago by nmische

dao.project.xsl Patch

Changed 3 months ago by mark.drew@…

  • milestone set to 1.0 Release

Changed 3 months ago by TomChiverton

  • keywords spam added
Note: See TracTickets for help on using tickets.