[Mydatabasepilot-cvs] MyDatabasePilot/Query alterTable.cfm,1.1,1.2
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-06-12 03:49:26
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/Query In directory sc8-pr-cvs1:/tmp/cvs-serv1177/Query Modified Files: alterTable.cfm Log Message: Functionality Added: [ 753053 ] Started Alter Specification - Added "ADD COLUMN" case - Added column names Index: alterTable.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/Query/alterTable.cfm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alterTable.cfm 5 Jun 2003 03:53:57 -0000 1.1 --- alterTable.cfm 12 Jun 2003 03:49:22 -0000 1.2 *************** *** 34,64 **** <!--- 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> --- 34,96 ---- <!--- 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 Specifications |||---> ! <!--- Process each Alter Specification ----> ! <cfloop from="1" to="#arrayLen(ATTRIBUTES.alterSpec)#" index="i"> ! <!--- If this is not the first alter specification add a comma to the last alterSpec ---> ! <cfif i GT 1> ! <cfset rawSQL = "#rawSQL#,"> ! <cfset htmlSQL = "#htmlSQL#,"> ! </cfif> ! ! <!--- Determine the alterSpec format ---> ! <cfswitch expression="#ATTRIBUTES.alterSpec[i].format#"> ! <cfcase value="ADD COLUMN"> ! <!--- ADD COLUMN KeyWord ---> ! <cfset rawSQL = "#rawSQL# ADD COLUMN"> ! <cfset htmlSQL = "#htmlSQL#<br /><span class=""KeyWord"">ADD COLUMN</span>"> ! ! <!--- Column Name ---> ! <cfif ATTRIBUTES.alterSpec[i].colName IS ""> ! <cfset rawSQL = "#rawSQL# NameNotSpecified_#i#"> ! <cfset htmlSQL = "#htmlSQL# <span class=""Missing"">NameNotSpecified_#i#</span>"> ! <cfelse> ! <cfset rawSQL = "#rawSQL# #ATTRIBUTES.alterSpec[i].colName#"> ! <cfset htmlSQL = "#htmlSQL# <span class=""String"">#ATTRIBUTES.alterSpec[i].colName#</span>"> ! </cfif> ! ! <!--- Column Type ---> ! ! </cfcase> ! <!--- ToDo Cases: ---> ! <!--- 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 ---> ! </cfswitch> ! </cfloop> + <!---||| Terminate SQL Statement with Semicolon |||---> + <cfset rawSQL = "#rawSQL#;"> + <cfset htmlSQL = "#htmlSQL#;"> </cfcase> *************** *** 92,94 **** </cfif> </cfcase> ! </cfswitch> \ No newline at end of file --- 124,207 ---- </cfif> </cfcase> ! </cfswitch> ! ! <!---+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ! === MySQL CREATE TABLE Syntax === ! ! ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...] ! ! alter_specification: ! ADD [COLUMN] create_definition [FIRST | AFTER column_name ] ! or ADD [COLUMN] (create_definition, create_definition,...) ! or ADD INDEX [index_name] (index_col_name,...) ! or ADD PRIMARY KEY (index_col_name,...) ! or ADD UNIQUE [index_name] (index_col_name,...) ! or ADD FULLTEXT [index_name] (index_col_name,...) ! or ADD [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) ! [reference_definition] ! or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT} ! or CHANGE [COLUMN] old_col_name create_definition ! [FIRST | AFTER column_name] ! or MODIFY [COLUMN] create_definition [FIRST | AFTER column_name] ! or DROP [COLUMN] col_name ! or DROP PRIMARY KEY ! or DROP INDEX index_name ! or DISABLE KEYS ! or ENABLE KEYS ! or RENAME [TO] new_tbl_name ! or ORDER BY col ! or table_options ! ! create_definition: ! col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] ! [PRIMARY KEY] [reference_definition] ! or PRIMARY KEY (index_col_name,...) ! or KEY [index_name] (index_col_name,...) ! or INDEX [index_name] (index_col_name,...) ! or UNIQUE [INDEX] [index_name] (index_col_name,...) ! or FULLTEXT [INDEX] [index_name] (index_col_name,...) ! or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) ! [reference_definition] ! or CHECK (expr) ! ! type: ! TINYINT[(length)] [UNSIGNED] [ZEROFILL] ! or SMALLINT[(length)] [UNSIGNED] [ZEROFILL] ! or MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL] ! or INT[(length)] [UNSIGNED] [ZEROFILL] ! or INTEGER[(length)] [UNSIGNED] [ZEROFILL] ! or BIGINT[(length)] [UNSIGNED] [ZEROFILL] ! or REAL[(length,decimals)] [UNSIGNED] [ZEROFILL] ! or DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL] ! or FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL] ! or DECIMAL(length,decimals) [UNSIGNED] [ZEROFILL] ! or NUMERIC(length,decimals) [UNSIGNED] [ZEROFILL] ! or CHAR(length) [BINARY] ! or VARCHAR(length) [BINARY] ! or DATE ! or TIME ! or TIMESTAMP ! or DATETIME ! or TINYBLOB ! or BLOB ! or MEDIUMBLOB ! or LONGBLOB ! or TINYTEXT ! or TEXT ! or MEDIUMTEXT ! or LONGTEXT ! or ENUM(value1,value2,value3,...) ! or SET(value1,value2,value3,...) ! ! index_col_name: ! col_name [(length)] ! ! reference_definition: ! REFERENCES tbl_name [(index_col_name,...)] ! [MATCH FULL | MATCH PARTIAL] ! [ON DELETE reference_option] ! [ON UPDATE reference_option] ! ! reference_option: ! RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT ! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---> \ No newline at end of file |