Skip to content

Instantly share code, notes, and snippets.

@atuttle
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atuttle/e2ccaa61c243df393b54 to your computer and use it in GitHub Desktop.
Save atuttle/e2ccaa61c243df393b54 to your computer and use it in GitHub Desktop.
REPRO code for ColdFusion Bug 3525456: https://bugbase.adobe.com/index.cfm?event=bug&id=3525456

https://bugbase.adobe.com/index.cfm?event=bug&id=3525456

Here's a simple repro case. Since this test involves ORM, you'll have to create a DSN. I'm testing against MySQL but it should be DB agnostic (that's part of the draw of ORM, right?)...

Just create a database and a new DSN named "repro" (or update the code accordingly), put foo.cfc into a folder named "orm", and everything else should work as expected.

component {
this.name = 'repro2';
this.datasource = 'repro';
this.sessionManagement = false;
this.clientManagement = false;
//canonicalize mapping base path between platforms
this.mapping_base = replace(expandPath('.'), '\', '/', 'all');
this.mappings['/orm'] = this.mapping_base & '/orm';
this.ormenabled = true;
this.ormsettings = {
dbcreate='update'
, logsql=false
, cfclocation= ['/orm']
, flushAtRequestEnd=false
, useDBForMapping=false
};
}
component
persistent='true'
table='foo'
{
property name='fooId' generator='identity' fieldtype='id';
}
<!--- get rid of all of the data in the table --->
<cfquery name="cleanup">
delete from foo
</cfquery>
<!--- add 1 row to the table --->
<cftransaction>
<cfset f = entityNew('foo') />
<cfset entitySave( f ) />
</cftransaction>
<!--- show that the data can be loaded by orm --->
<cfdump var="#entityLoad( 'foo' )#" label="entityLoad" />
<!--- show that an HQL query with a space works --->
<cfdump var="#ormExecuteQuery( 'from foo' )#" label="with space" />
<!--- show that an HQL query with a tab immediately following the "from" keyword fails (an exception will be thrown) --->
<h2>It's going to error here, and that's the point: it's broken!</h2>
<cfdump var="#ormExecuteQuery( 'from foo' )#" label="with tab" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment