Bugs in installer getDBTypes

Description

I'm proposing a change to install/components/farcryui.cfc
(getDBTypes). It's freaking out in two places, one being a conversion
of an array value to string, the other for the base and default DB
types. The below code worked for me after the change. Basically, I
changed the <cfset stmd> call to use a temp variable so as to pull out
the Array value correctly. The old code (on railo) was complaining
about trying to serialize and array. The other change was to put
dbType additions into a <cftry>. The base/default packages don't have
a DB type and were failing. In addition, you end up with a blank
querycell. Moving the addrow into the loop address the blank value,
and the cftry gracefully fails when there is no dbType assigned to a
gateway.

<cffunction name="getDBTypes" returntype="query" output="false"
access="public" hint="Returns the key, label, and dbowner usage of all
available database types">
<cfset var stTypes = structnew() />
<cfset var thistype = "" />
<cfset var thisitem = "" />
<cfset var qDBTypes =
querynew("key,label,usesDBOwner","varchar,varchar,bit") />
<cfset var stMD = "" />
<cfset var tmpType="" />

<cfset stTypes =
createobject("component","farcry.core.packages.lib.db").getDBTypes() /
>

<cfloop collection="#stTypes#" item="thistype">
<cfset tmpType=sttypes[thistype]>
<cfset tmpType=tmpType[1]>
<cfset stMD = getMetadata(createobject("component",tmpType)) />

<cftry>
<cfloop list="#stMD.dbType#" index="thisitem">
<cfif listfirst(thisitem,":") eq thistype>
<cfset queryaddrow(qDBTypes) />
<cfset querysetcell(qDBTypes,"label",listlast(thisitem,":")) />
</cfif>
</cfloop>
<cfset querysetcell(qDBTypes,"key",thistype) />
<cfset querysetcell(qDBTypes,"usesDBOwner",stMD.usesDBOwner) />
<cfcatch></cfcatch>
</cftry>
</cfloop>
<cfreturn qDBTypes />
</cffunction>

Environment

None

Activity

Show:

Blair McKenzie June 16, 2011 at 6:26 AM

Applied revised changes.

Fixed

Assignee

Reporter

Fix versions

Priority

Created June 16, 2011 at 6:25 AM
Updated June 16, 2011 at 6:26 AM
Resolved June 16, 2011 at 6:26 AM