So, when working with oracle you need to create your IDs ahead of time? In PostgreSQL they use sequences too. However, I think you can define a default of the next value from a sequence to a column. (It's been a while, forgive me if I'm wrong.)
Is there anything like that in Oracle? What I'm really asking is, from a metadata perspective, how do you know if a particular column relies on a sequence and can you identify the particular sequence? If we can find that out, we'll edit (*cough* hack *cough*) the xsl to create the project record with the needed sequence-value-getter. It'll end up in every project record cfc, unfortunately, but it's important enough that it's probably worth the hack. Doug -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bowden, Beth (NIH/NIEHS) [E] Sent: Monday, February 20, 2006 5:33 PM To: reactor@doughughes.net; [EMAIL PROTECTED] Subject: [Reactor For CF] Oracle support for Reactor Doug, I've run into one problem migrating the Reactor blog to Oracle. Oracle doesn't have an "autonumber" or "identity" equivalent. So the function, "Convention.lastInseredIdSyntax", doesn't work. Oracle has sequences which can be used as a work-around. The code below is a modified version of the create function in EntryDAO in the blog app (the modified lines are marked w/ an "x"). This seems to require always creating a custom create function -- that seems very much against the reactor spirit. I thought about changing the XSL DAO template. Any suggestions? Thanks, Beth <cffunction name="create" access="public" hint="I create a Entry object." output="false" returntype="void"> <cfargument name="to" hint="I am the transfer object for Entry" required="yes" type="reactor.project.ReactorBlog.To.EntryTo" /> <cfset var Convention = getConventions() /> <cfset var qCreate = 0 /> x <cfset var qUniqueSeq = 0 /> <cftransaction> x <cfquery name="qUniqueSeq" datasource="#_getConfig().getDsn()#" username="#_getConfig().getUsername()#" password="#_getConfig().getPassword()#"> x select unique_seq.nextval nextSequenceValue x from dual x </cfquery> <cfquery name="qCreate" datasource="#_getConfig().getDsn()#" username="#_getConfig().getUsername()#" password="#_getConfig().getPassword()#"> INSERT INTO #Convention.FormatObjectName(getObjectMetadata(), '')# ( #Convention.formatFieldName('ENTRYID', 'Entry')# ,... ) VALUES ( <cfqueryparam cfsqltype="cf_sql_numeric" scale="22" x value="#qUniqueSeq.nextSequenceValue#" />... ) <cfif ListFindNoCase("mssql", _getConfig().getType())> #Convention.lastInseredIdSyntax(getObjectMetadata())# </cfif> </cfquery> x <cfif NOT ListFindNoCase("mssql,oracle", _getConfig().getType())> <cfquery name="qCreate" datasource="#_getConfig().getDsn()#" username="#_getConfig().getUsername()#" password="#_getConfig().getPassword()#"> #Convention.lastInseredIdSyntax(getObjectMetadata())# </cfquery> </cfif> </cftransaction> </cffunction> -- Reactor for ColdFusion Mailing List -- reactor@doughughes.net -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/ -- Reactor for ColdFusion Mailing List -- reactor@doughughes.net -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/