[Mydatabasepilot-cvs] MyDatabasePilot/dbProcessInit AddField.cfm,1.7,1.8
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-06-13 15:48:05
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessInit In directory sc8-pr-cvs1:/tmp/cvs-serv8443/dbProcessInit Modified Files: AddField.cfm Log Message: [ 754037 ] Moved Default FORM Values -length#i# -valueList#i# -numberOfDecimals#i# -default#i# From dbProcessBody/AddField.cfm To: dbProcessInit/AddField.cfm Index: AddField.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessInit/AddField.cfm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AddField.cfm 12 Jun 2003 04:39:50 -0000 1.7 --- AddField.cfm 13 Jun 2003 15:47:51 -0000 1.8 *************** *** 1,72 **** ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: dbProcessInit/AddField.cfm * ! * Purpose: Initialize AddField Database Process * ! ********************************************************************************************---> ! ! <!---||| Set Default Values |||---> ! <cfparam name="FORM.numberOfFields" default="1" /> ! <cfparam name="FORM.locationOfFields" default="End" /> ! ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!----------------------------------------------------> ! <!--- Get List of Field Names and Their Properties ---> ! <!----------------------------------------------------> ! <cfmodule template="../Query/fieldList.cfm" ! queryName="fieldList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#" /> ! ! <!-----------------------------------> ! <!--- Create alterSpec Definition ---> ! <!-----------------------------------> ! <!--- Create alterSpec one dimensional array ---> ! <cfset alterSpec=ArrayNew(1) /> ! ! <!---||| Loop over each new field |||---> ! <cfloop from="1" to="#FORM.numberOfFields#" index="i"> ! <!--- Create a Structure for each new field ---> ! <cfset alterSpec[i]=StructNew() /> ! <!--- Create Key "format" ---> ! <cfset alterSpec[i].format="ADD COLUMN" /> ! <!--- Create Key "colName" ---> ! <cfparam name="FORM.fieldName#i#" default="" /> ! <cfset alterSpec[i].colName="#Evaluate("FORM.fieldName#i#")#" /> ! <!--- Create Key "colType" ---> ! <cfparam name="FORM.fieldType#i#" default="" /> ! <cfset alterSpec[i].colType="#Evaluate("FORM.fieldType#i#")#" /> ! </cfloop> ! ! <!-------------------------------------------------> ! <!--- Invoke alterTable Custom Tag via CFModule ---> ! <!-------------------------------------------------> ! <!---||| If execution of Alter Table was requested by the form ... |||---> ! <cfif IsDefined("FORM.ExecuteAlterTable")> ! <!--- Get Generated SQL and execute it ---> ! <cfmodule template="../Query/alterTable.cfm" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#" ! alterSpec="#alterSpec#" ! execute="TRUE" ! sqlOutputType="BOTH" ! rawOutput="rawOutput" ! htmlOutput="htmlOutput"> ! </cfmodule> ! <!--- Otherwise ... ---> ! <cfelse> ! <!--- Get Generated SQL, but do not execute it ---> ! <cfmodule template="../Query/alterTable.cfm" ! table="#URL.table#" ! alterSpec="#alterSpec#" ! execute="FALSE" ! sqlOutputType="BOTH" ! rawOutput="rawOutput" ! htmlOutput="htmlOutput"> ! </cfmodule> ! </cfif> </cflock> --- 1,79 ---- ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: dbProcessInit/AddField.cfm * ! * Purpose: Initialize AddField Database Process * ! ********************************************************************************************---> ! ! <!---||| Set Default Values |||---> ! <cfparam name="FORM.numberOfFields" default="1" /> ! <cfparam name="FORM.locationOfFields" default="End" /> ! ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!----------------------------------------------------> ! <!--- Get List of Field Names and Their Properties ---> ! <!----------------------------------------------------> ! <cfmodule template="../Query/fieldList.cfm" ! queryName="fieldList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#" /> ! ! <!-----------------------------------> ! <!--- Create alterSpec Definition ---> ! <!-----------------------------------> ! <!--- Create alterSpec one dimensional array ---> ! <cfset alterSpec=ArrayNew(1) /> ! ! <!---||| Loop over each new field |||---> ! <cfloop from="1" to="#FORM.numberOfFields#" index="i"> ! <!---||| Set default values of empty string for FORM fields |||---> ! <cfparam name="FORM.fieldName#i#" default="" /> ! <cfparam name="FORM.fieldType#i#" default="" /> ! <cfparam name="FORM.length#i#" default="" /> ! <cfparam name="FORM.valueList#i#" default="" /> ! <cfparam name="FORM.numberOfDecimals#i#" default="" /> ! <cfparam name="FORM.default#i#" default="" /> ! ! <!---||| Create Structre and Keys |||---> ! <!--- Create a Structure for each new field ---> ! <cfset alterSpec[i]=StructNew() /> ! <!--- Create Key "format" ---> ! <cfset alterSpec[i].format="ADD COLUMN" /> ! <!--- Create Key "colName" ---> ! <cfset alterSpec[i].colName="#Evaluate("FORM.fieldName#i#")#" /> ! <!--- Create Key "colType" ---> ! <cfset alterSpec[i].colType="#Evaluate("FORM.fieldType#i#")#" /> ! </cfloop> ! ! <!-------------------------------------------------> ! <!--- Invoke alterTable Custom Tag via CFModule ---> ! <!-------------------------------------------------> ! <!---||| If execution of Alter Table was requested by the form ... |||---> ! <cfif IsDefined("FORM.ExecuteAlterTable")> ! <!--- Get Generated SQL and execute it ---> ! <cfmodule template="../Query/alterTable.cfm" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#" ! alterSpec="#alterSpec#" ! execute="TRUE" ! sqlOutputType="BOTH" ! rawOutput="rawOutput" ! htmlOutput="htmlOutput"> ! </cfmodule> ! <!--- Otherwise ... ---> ! <cfelse> ! <!--- Get Generated SQL, but do not execute it ---> ! <cfmodule template="../Query/alterTable.cfm" ! table="#URL.table#" ! alterSpec="#alterSpec#" ! execute="FALSE" ! sqlOutputType="BOTH" ! rawOutput="rawOutput" ! htmlOutput="htmlOutput"> ! </cfmodule> ! </cfif> </cflock> |