I found a bug in the file listed in the subject. The getDefault() method does not return a proper value when typeName is a string and the database actually has a default value. It was missing the cfreturn tag in the esleif statement... This new cfreturn should become line 125 of
ObjectDao.cfc in the reactor\data\mssql folder.
<!--- insure that the first and last characters are "'" --->
<cfif ReFindNoCase("'*newId()'*", arguments.sqlDefaultValue)>
<cfreturn "##CreateUUID()##" />
<!--- IS "newId()" --->
<cfelseif Left(arguments.sqlDefaultValue, 1) IS "'" AND Right(arguments.sqlDefaultValue, 1) IS "'">
<!--- mssql functions must be constants. for this reason I can convert anything quoted in single quotes safely to a string --->
<cfset arguments.sqlDefaultValue = Mid(arguments.sqlDefaultValue, 2, Len(arguments.sqlDefaultValue)-2) />
<cfset arguments.sqlDefaultValue = Replace(arguments.sqlDefaultValue, "''", "'", "All") />
<cfset arguments.sqlDefaultValue = Replace(arguments.sqlDefaultValue, """", """""", "All") />
<cfreturn arguments.sqlDefaultValue /> <!--- This line was missing!!! --->
<cfelse>
<cfreturn "" />
</cfif>
<cfif ReFindNoCase("'*newId()'*", arguments.sqlDefaultValue)>
<cfreturn "##CreateUUID()##" />
<!--- IS "newId()" --->
<cfelseif Left(arguments.sqlDefaultValue, 1) IS "'" AND Right(arguments.sqlDefaultValue, 1) IS "'">
<!--- mssql functions must be constants. for this reason I can convert anything quoted in single quotes safely to a string --->
<cfset arguments.sqlDefaultValue = Mid(arguments.sqlDefaultValue, 2, Len(arguments.sqlDefaultValue)-2) />
<cfset arguments.sqlDefaultValue = Replace(arguments.sqlDefaultValue, "''", "'", "All") />
<cfset arguments.sqlDefaultValue = Replace(arguments.sqlDefaultValue, """", """""", "All") />
<cfreturn arguments.sqlDefaultValue /> <!--- This line was missing!!! --->
<cfelse>
<cfreturn "" />
</cfif>
Without that line there, this is the error that is produced:
Element FIELD.DEFAULT is undefined in ARGUMENTS. | |
| The error occurred in D:\inetpub\daaroot\reactor\core\object.cfc: line 341 Called from D:\inetpub\daaroot\reactor\core\object.cfc: line 263 Called from D:\inetpub\daaroot\reactor\core\objectTranslator.cfc: line 22 Called from D:\inetpub\daaroot\reactor\core\objectFactory.cfc: line 121 Called from D:\inetpub\daaroot\reactor\reactorFactory.cfc: line 26 Called from D:\inetpub\daaroot\reactor\util\ReactorCompiler.cfc: line 57 Called from D:\inetpub\daaroot\compiler.cfm: line 3 | |
339 : <cfset xmlField.XmlAttributes["cfSqlType"] = arguments.field.cfSqlType /> 340 : <cfset xmlField.XmlAttributes["length"] = arguments.field.length /> 341 : <cfset xmlField.XmlAttributes["default"] = arguments.field.default /> 342 : <cfset xmlField.XmlAttributes["object"] = arguments.config.object.XmlAttributes.name /> 343 : <cfset xmlField.XmlAttributes["sequence"] = arguments.field.sequenceName /> | |
Here is a dump of the structure in which arguments.field was and the evidence that getDefault method is not returning a proper value.
| struct | |
|---|---|
| CFDATATYPE | string |
| CFSQLTYPE | cf_sql_char |
| DBDATATYPE | char |
| DEFAULT | [undefined struct element] |
| IDENTITY | false |
| LENGTH | 1 |
| NAME | pass_expires |
| NULLABLE | true |
| PRIMARYKEY | false |
| SEQUENCENAME | [empty string] |
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
