[Mydatabasepilot-cvs] MyDatabasePilot/Query alterTable.cfm,NONE,1.1
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-06-05 03:54:00
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/Query In directory sc8-pr-cvs1:/tmp/cvs-serv6358/Query Added Files: alterTable.cfm Log Message: Functionality Added: [ 749306 ] Added File Query/alterTable.cfm (Custom Tag) Added vars: rawSQL, htmlSQL Started generating ALTER TABLE Command Strings: - ALTER TABLE - Table Name Added "Output SQL" logic Added "Execute ALTER TABLE Command" if statment (Body still needs developing) --- NEW FILE: alterTable.cfm --- <!---******************************************************************************************* * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * * Template: Query/alterTable.cfm (Custom Tag) * * Purpose: - Executes and/or displays an ALTER TABLE command * * - In Start Mode, the alter table strings are generated and sent back to * * caller if requested * * - In End Mode, the Query is executed * * Inputs Required: - table String * * - execute Boolean * * - alterSpec Array of Structures * * Inputs Optional: - dataSource String * * - userName String * * - password String * * - sqlOutputType (RAW|HTML|BOTH) * * Outputs: - rawOutput String * * - htmlOutput String * * Other Requirements- This Custom Tag requires an end tag * ********************************************************************************************---> <!---||| Determine which execution mode this custom tag is in |||---> <cfswitch expression="#ThisTag.ExecutionMode#"> <!---||| If in start mode ... |||---> <cfcase value="start"> <!----------------------> <!--- Error Checking ---> <!----------------------> <!---||| Check for existence of Required Attributes |||---> <!--- This needs to be developed ---> <!---||| Check for proper data types, to ensure SQL syntax is correct |||---> <!--- This needs to be developed ---> <!--------------------------------------------> <!--- Generate ALTER TABLE Command Strings ---> <!--------------------------------------------> <!--- Initialize Internal Variables ---> <cfset rawSQL = "ALTER TABLE"> <cfset htmlSQL = "<span class=""KeyWord"">ALTER TABLE</span>"> <!--- Table Name ---> <cfset rawSQL = "#rawSQL# #ATTRIBUTES.table#"> <cfset htmlSQL = "#htmlSQL# <span class=""String"">#ATTRIBUTES.table#</span>"> <!--- alter_spec ---> <!--- ADD COLUMN ---> <!--- ADD INDEX ---> <!--- ADD PRIMARY KEY ---> <!--- ADD UNIQUE ---> <!--- ADD FULLTEXT ---> <!--- ADD FOREIGN KEY ---> <!--- ALTER COLUMN ---> <!--- CHANGE COLUMN ---> <!--- MODIFY COLUMN ---> <!--- DROP COLUMN ---> <!--- DROP PRIMARY KEY ---> <!--- DROP INDEX ---> <!--- DISABLE KEYS ---> <!--- ENABLE KEYS ---> <!--- RENAME TO ---> <!--- ORDER BY ---> <!--- table_options ---> </cfcase> <!---||| If in end mode ... |||---> <cfcase value="end"> <!------------------> <!--- Output SQL ---> <!------------------> <!---||| If Output was requested... |||---> <cfif IsDefined("ATTRIBUTES.sqlOutputType")> <!---||| Return RAW SQL if Requested |||---> <cfif ATTRIBUTES.sqlOutputType IS "RAW" OR ATTRIBUTES.sqlOutputType IS "BOTH"> <cfset "CALLER.#ATTRIBUTES.rawOutput#" = rawSQL> </cfif> <!---||| Return HTML display friendly SQL if Requested |||---> <cfif ATTRIBUTES.sqlOutputType IS "HTML" OR ATTRIBUTES.sqlOutputType IS "BOTH"> <cfset "CALLER.#ATTRIBUTES.htmlOutput#" = htmlSQL> </cfif> </cfif> <!-----------------------------------> <!--- Execute ALTER TABLE Command ---> <!-----------------------------------> <!--- If Execution was requested ... ---> <cfif ATTRIBUTES.execute> <!---<cfquery name="#ATTRIBUTES.queryName#" datasource="#ATTRIBUTES.dataSource#" username="#ATTRIBUTES.userName#" password="#ATTRIBUTES.password#"> <!--- Execute Generated rawSQL ---> #rawSQL# </cfquery>---> </cfif> </cfcase> </cfswitch> |