root/coldbox/trunk/install/illidium_templates/coldbox/dao/create.cfm @ 809

Revision 809, 1.3 kB (checked in by lmajano, 6 years ago)

Illidium Scaffolding Templates

  • Property svn:executable set to *
Line 
1        <%cffunction name="create" access="public" output="false" returntype="boolean"%>
2                <%cfargument name="#root.bean.xmlAttributes.name#" type="#root.bean.xmlAttributes.path#" required="true" /%>
3
4                <%cfset var qCreate = "" /%>
5               
6                        <%cfquery name="qCreate" datasource="%variables.dsn%"%>
7                                INSERT INTO #root.bean.dbtable.xmlAttributes.name#
8                                        (
9                                        <cfloop from="1" to="#arrayLen(root.bean.dbtable.xmlChildren)#" index="i"><cfif root.bean.dbtable.xmlChildren[i].xmlAttributes.identity neq true>#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#<cfif i neq arrayLen(root.bean.dbtable.xmlChildren)>,</cfif>
10                                        </cfif></cfloop>)
11                                VALUES
12                                        (
13                                        <cfloop from="1" to="#arrayLen(root.bean.dbtable.xmlChildren)#" index="i"><cfif root.bean.dbtable.xmlChildren[i].xmlAttributes.identity neq true><%cfqueryparam value="%arguments.#root.bean.xmlAttributes.name#.get#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#()%" CFSQLType="#root.bean.dbtable.xmlChildren[i].xmlAttributes.cfSqlType#" <cfif root.bean.dbtable.xmlChildren[i].xmlAttributes.required neq "Yes"> null="%not len(arguments.#root.bean.xmlAttributes.name#.get#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#())%"</cfif> /%><cfif i neq arrayLen(root.bean.dbtable.xmlChildren)>,</cfif>
14                                        </cfif></cfloop>)
15                        <%/cfquery%>
16                <%cfreturn true /%>
17        <%/cffunction%>
Note: See TracBrowser for help on using the browser.