Skip to content

Commit b416b7a

Browse files
committed
Merge branch 'p720'
# Conflicts: # packages/lib/cdn.cfc
2 parents ad2be86 + 3882737 commit b416b7a

31 files changed

Lines changed: 486 additions & 238 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Download the latest community build or get a "ready-to-go" express version for a
2121
- [FarCry Dev Support Forum](http://discourse.farcrycore.org/)
2222
- [Google+ Community](https://plus.google.com/communities/107650642291146266954)
2323
- [FarCry Documentation WIKI](https://farcry.jira.com/wiki/display/FCDEV60/Home)
24-
- [FarCry Committers Blog](http://blog.farcrycore.org)
24+
- [FarCry Committers Blog](http://discourse.farcrycore.org/c/blog)
2525
- [Daemon: Commercial Support/Training/Development](http://www.daemon.com.au)
2626

2727
### Code

packages/cdn/s3.cfc

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -539,56 +539,64 @@
539539
<cfset var data = "" />
540540
<cfset var tmpfile = getCachedFile(config=arguments.config,file=arguments.file) />
541541

542-
<cfif len(tmpfile)>
542+
<cftry>
543543

544-
<!--- Read cache file --->
545-
<cfswitch expression="#arguments.datatype#">
546-
<cfcase value="text">
547-
<cffile action="read" file="#tmpfile#" variable="data" />
548-
</cfcase>
544+
<cfif len(tmpfile)>
549545

550-
<cfcase value="binary">
551-
<cffile action="readBinary" file="#tmpfile#" variable="data" />
552-
</cfcase>
546+
<!--- Read cache file --->
547+
<cfswitch expression="#arguments.datatype#">
548+
<cfcase value="text">
549+
<cffile action="read" file="#tmpfile#" variable="data" />
550+
</cfcase>
551+
552+
<cfcase value="binary">
553+
<cffile action="readBinary" file="#tmpfile#" variable="data" />
554+
</cfcase>
555+
556+
<cfcase value="image">
557+
<cfset data = imageread(tmpfile) />
558+
</cfcase>
559+
</cfswitch>
553560

554-
<cfcase value="image">
555-
<cfset data = imageread(tmpfile) />
556-
</cfcase>
557-
</cfswitch>
558-
559-
<cflog file="#application.applicationname#_s3" text="Read [#arguments.config.name#] #sanitiseS3URL(arguments.file)# from local cache" />
560-
561-
<cfelse>
561+
<cflog file="#application.applicationname#_s3" text="Read [#arguments.config.name#] #sanitiseS3URL(arguments.file)# from local cache" />
562+
563+
<cfelse>
562564

563-
<cfset tmpfile = getTemporaryFile(config=arguments.config,file=arguments.file) />
564-
565-
<cfset ioCopyFile(source_config=arguments.config,source_file=arguments.file,dest_localpath=tmpfile) />
566-
567-
<!--- Read cache file --->
568-
<cfswitch expression="#arguments.datatype#">
569-
<cfcase value="text">
570-
<cffile action="read" file="#tmpfile#" variable="data" />
571-
</cfcase>
565+
<cfset tmpfile = getTemporaryFile(config=arguments.config,file=arguments.file) />
572566

573-
<cfcase value="binary">
574-
<cffile action="readBinary" file="#tmpfile#" variable="data" />
575-
</cfcase>
567+
<cfset ioCopyFile(source_config=arguments.config,source_file=arguments.file,dest_localpath=tmpfile) />
568+
569+
<!--- Read cache file --->
570+
<cfswitch expression="#arguments.datatype#">
571+
<cfcase value="text">
572+
<cffile action="read" file="#tmpfile#" variable="data" />
573+
</cfcase>
574+
575+
<cfcase value="binary">
576+
<cffile action="readBinary" file="#tmpfile#" variable="data" />
577+
</cfcase>
578+
579+
<cfcase value="image">
580+
<cfset data = imageread(tmpfile) />
581+
</cfcase>
582+
</cfswitch>
583+
584+
<cfif arguments.config.localCacheSize>
585+
<cfset addCachedFile(config=arguments.config,file=arguments.file,path=tmpfile) />
586+
<cfelse>
587+
<!--- Delete temporary file --->
588+
<cfset deleteTemporaryFile(tmpfile) />
589+
</cfif>
590+
591+
<cflog file="#application.applicationname#_s3" text="Read [#arguments.config.name#] #sanitiseS3URL(arguments.file)# from S3" />
576592

577-
<cfcase value="image">
578-
<cfset data = imageread(tmpfile) />
579-
</cfcase>
580-
</cfswitch>
581-
582-
<cfif arguments.config.localCacheSize>
583-
<cfset addCachedFile(config=arguments.config,file=arguments.file,path=tmpfile) />
584-
<cfelse>
585-
<!--- Delete temporary file --->
586-
<cfset deleteTemporaryFile(tmpfile) />
587593
</cfif>
588-
589-
<cflog file="#application.applicationname#_s3" text="Read [#arguments.config.name#] #sanitiseS3URL(arguments.file)# from S3" />
590-
591-
</cfif>
594+
595+
<cfcatch>
596+
<cflog file="#application.applicationname#_s3" text="Error reading [#arguments.config.name#] #sanitiseS3URL(arguments.file)#: #cfcatch.message#" />
597+
<cfrethrow>
598+
</cfcatch>
599+
</cftry>
592600

593601
<cfreturn data />
594602
</cffunction>

packages/coapi/coapiUtilities.cfc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,11 @@
419419
<cfif len(arguments.typename)>
420420
<!--- Just in case the whole package path has been passed in, we only need the actual typename --->
421421
<cfset arguments.typename = listLast(arguments.typename,".") />
422-
423-
<cfset oCO = createObject("component", application.stcoapi[arguments.typename].packagePath) />
424-
<cfset stResult = oCO.getData(argumentCollection="#arguments#") />
422+
423+
<cfif structKeyExists(application.stcoapi, arguments.typename)>
424+
<cfset oCO = createObject("component", application.stcoapi[arguments.typename].packagePath) />
425+
<cfset stResult = oCO.getData(argumentCollection="#arguments#") />
426+
</cfif>
425427
</cfif>
426428

427429
<cfreturn stResult />

packages/dbgateways/BaseGateway.cfc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
<cfif NOT bFirst>,</cfif><cfset bFirst = false />
276276

277277
<cfset stVal = getValueForDB(schema=arguments.schema.fields[thisfield],value=arguments.stProperties[thisfield]) />
278-
<cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" />
278+
<cfqueryparam attributeCollection="#stVal#" />
279279
</cfif>
280280
</cfloop>
281281
)
@@ -341,7 +341,7 @@
341341
<cfif NOT bFirst>AND</cfif><cfset bFirst = false />
342342

343343
<cfset stVal = getValueForDB(schema=arguments.schema.fields[thisfield],value=arguments.stProperties[thisfield]) />
344-
#thisfield#=<cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" />
344+
#thisfield#=<cfqueryparam attributeCollection="#stVal#" />
345345
</cfloop>
346346
</cfquery>
347347

@@ -362,15 +362,15 @@
362362
<cfif NOT bFirst>,</cfif><cfset bFirst = false />
363363

364364
<cfset stVal = getValueForDB(schema=arguments.schema.fields[thisfield],value=arguments.stProperties[thisfield]) />
365-
#thisfield#=<cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" />
365+
#thisfield#=<cfqueryparam attributeCollection="#stVal#" />
366366
</cfif>
367367
</cfloop>
368368
WHERE <cfset bFirst = true />
369369
<cfloop list="#arraytolist(arguments.schema.indexes.primary.fields)#" index="thisfield">
370370
<cfif NOT bFirst>AND</cfif><cfset bFirst = false />
371371

372372
<cfset stVal = getValueForDB(schema=arguments.schema.fields[thisfield],value=arguments.stProperties[thisfield]) />
373-
#thisfield#=<cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" />
373+
#thisfield#=<cfqueryparam attributeCollection="#stVal#" />
374374
</cfloop>
375375
</cfquery>
376376

packages/dbgateways/MSSQL2012Gateway.cfc

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,63 @@
348348

349349
<cfreturn stResult />
350350
</cffunction>
351-
352-
351+
352+
<cffunction name="getInsertSQL" access="public" output="false" returntype="string" hint="Returns the SQL to insert data into the table specified and used by the Farcry Content Export">
353+
<cfargument name="table" type="string" required="true" />
354+
<cfargument name="aTableColMD" type="array" required="true" />
355+
<cfargument name="orderBy" type="string" required="true" />
356+
<cfargument name="from" type="numeric" default="1" />
357+
<cfargument name="to" type="numeric" default="0" />
358+
359+
<cfset var resultSQL = "">
360+
<cfset var j = 0>
361+
<cfset var k = "">
362+
<cfset var stTableMetadata = introspectTable(arguments.table)>
363+
364+
<cfsavecontent variable="resultSQL">
365+
366+
<cfoutput>
367+
SELECT (
368+
<cfset j = 1>
369+
<cfloop list="#structKeyList(stTableMetadata.fields)#" index="k">
370+
<cfif j NEQ 1>
371+
+
372+
</cfif>
373+
374+
<cfif FindNoCase("char", stTableMetadata.fields[k].type)
375+
OR FindNoCase("unique", stTableMetadata.fields[k].type)
376+
OR FindNoCase("xml", stTableMetadata.fields[k].type)
377+
OR FindNoCase("object", stTableMetadata.fields[k].type)
378+
OR FindNoCase("string", stTableMetadata.fields[k].type)
379+
>
380+
'|---|' + COALESCE(#stTableMetadata.fields[k].Name#,'') + '|---|'
381+
<cfelseif FindNoCase("text", stTableMetadata.fields[k].type) OR FindNoCase("longchar", stTableMetadata.fields[k].type)>
382+
'|---|' + COALESCE( CONVERT( varchar(MAX) , #stTableMetadata.fields[k].Name#),'') + '|---|'
383+
<cfelseif FindNoCase("date", stTableMetadata.fields[k].type) OR FindNoCase("time", stTableMetadata.fields[k].type)>
384+
'|---|' + COALESCE( CONVERT ( varchar(25) , #stTableMetadata.fields[k].Name#, 120) ,'NULL') + '|---|'
385+
<cfelse>
386+
COALESCE( CONVERT( varchar, #stTableMetadata.fields[k].Name#),'=???=')
387+
</cfif>
388+
389+
<cfif j NEQ structCount(stTableMetadata.fields)>
390+
+ ','
391+
</cfif>
392+
393+
<cfset j++>
394+
</cfloop>
395+
) as insertValues
396+
FROM (
397+
SELECT *, ROW_NUMBER() OVER (ORDER BY #arguments.orderBy# desc) AS RowNum
398+
FROM #arguments.table#
399+
) AS MyDerivedTable
400+
WHERE MyDerivedTable.RowNum BETWEEN #arguments.from# AND #arguments.to#
401+
</cfoutput>
402+
403+
</cfsavecontent>
404+
405+
<cfreturn resultSQL>
406+
</cffunction>
407+
353408
<!--- DATABASE INTROSPECTION --->
354409
<cffunction name="introspectTable" returntype="struct" access="private" output="false" hint="Constructs a metadata struct for the table">
355410
<cfargument name="tablename" type="string" required="True" hint="The table to introspect" />

packages/dbgateways/MSSQLGateway.cfc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<cfset stResult.cfsqltype = "cf_sql_integer" />
5353
<cfelse>
5454
<cfset stResult.cfsqltype = "cf_sql_decimal" />
55+
<cfset stResult.scale = listlast(arguments.schema.precision) />
5556
</cfif>
5657
<cfif arguments.schema.nullable and (arguments.value eq "" or arguments.value eq "NULL")>
5758
<cfset stResult.value = 0 />

packages/dbgateways/MySQLGateway.cfc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<cfset stResult.cfsqltype = "cf_sql_integer" />
2828
<cfelse>
2929
<cfset stResult.cfsqltype = "cf_sql_decimal" />
30+
<cfset stResult.scale = listlast(arguments.schema.precision) />
3031
</cfif>
3132
<cfif arguments.schema.nullable and (arguments.value eq "" or arguments.value eq "NULL")>
3233
<cfset stResult.value = 0 />
@@ -216,7 +217,7 @@
216217
</cfswitch>
217218
<cfif stProp.nullable>NULL<cfelse>NOT NULL</cfif>
218219
<cfset stVal = getValueForDB(schema=stProp,value=stProp.default) />
219-
<cfif stProp.type neq "longchar">DEFAULT <cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" /></cfif>
220+
<cfif stProp.type neq "longchar">DEFAULT <cfqueryparam attributeCollection="#stVal#" /></cfif>
220221
</cfquery>
221222

222223
<cfset arrayappend(stResult.results,queryresult) />
@@ -277,7 +278,7 @@
277278
</cfswitch>
278279
<cfif stProp.nullable>NULL<cfelse>NOT NULL</cfif>
279280
<cfset stVal = getValueForDB(schema=stProp,value=stProp.default) />
280-
<cfif stProp.type neq "longchar">DEFAULT <cfqueryparam cfsqltype="#stVal.cfsqltype#" null="#stVal.null#" value="#stVal.value#" /></cfif>
281+
<cfif stProp.type neq "longchar">DEFAULT <cfqueryparam attributeCollection="#stVal#" /></cfif>
281282
</cfquery>
282283

283284
<cfset arrayappend(stResult.results,queryresult) />

0 commit comments

Comments
 (0)