[Mydatabasepilot-cvs] MyDatabasePilot MyDatabasePilot.cfm,1.16,1.17
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-05-22 01:49:36
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot In directory sc8-pr-cvs1:/tmp/cvs-serv12542 Modified Files: MyDatabasePilot.cfm Log Message: Internal Structure Changed: [ 741461 ] Updated <CFSWITCH> statement in MyDatabasePilot.cfm to reflect the current development plan Index: MyDatabasePilot.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/MyDatabasePilot.cfm,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MyDatabasePilot.cfm 20 May 2003 04:22:10 -0000 1.16 --- MyDatabasePilot.cfm 22 May 2003 01:49:33 -0000 1.17 *************** *** 1,175 **** ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: MyDatabasePilot.cfm * ! * Purpose: DataBase Administrator Page, this is where the bulk of the processing * ! * calls are made from * ! * Requiremets: The database connection variables must either be configured in the * ! * Aplication.cfm file, or passed to this template via FORM_LogintoDB * ! ********************************************************************************************---> ! ! <!------------------------------------------------------------------------------> ! <!--- Process User Request Input Variables and Initialize Internal Variables ---> ! <!------------------------------------------------------------------------------> ! <!---||| Reset session variables if new database was requested |||---> ! <!--- Check to see if this template was called by FORM_LogintoDB with a new dataSource ---> ! <cfif IsDefined("FORM.dataSource")> ! <!--- Initiate an Exclusive lock to ensure the integrity of session variables ---> ! <cflock timeout = "30" throwontimeout="no" type = "exclusive" scope = "SESSION"> ! <!--- Using the values submitted by the login in form, ---> ! <!--- trim leading and trailing white spaces and ---> ! <!--- overwrite the session variables used for database connection ---> ! <cfset SESSION.dataSource = #Trim(FORM.dataSource)#> <!--- Data Source ---> ! <cfset SESSION.userName = #Trim(FORM.userName)#> <!--- User Name ---> ! <cfset SESSION.password = #Trim(FORM.password)#> <!--- Password ---> ! <!--- Set the loggedIn Flag to True ---> ! <cfset SESSION.loggedIn = 1> ! <!--- Get Database Name ---> ! <cfmodule template="Query/thisDatabaseName.cfm" ! queryName="thisDatabaseName" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#"> ! <!--- Overwrite dbName Variable ---> ! <cfset SESSION.dbName = "#thisDatabaseName.databaseName#"> ! </cflock> ! </cfif> ! ! <!-----------------------------------------------> ! <!--- Run Requested Database Command or Query ---> ! <!-----------------------------------------------> ! <!--- Which dbProcess was requested? ---> ! <cfswitch expression="#dbProcess#"> ! <!---||| If ShowTables ... |||---> ! <cfcase value="ShowTables"> ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!--- Get List of Table Names ---> ! <cfmodule template="Query/tableList.cfm" ! queryName="tableList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#"> ! </cflock> ! </cfcase> ! ! <!---||| If ShowFields ... |||---> ! <cfcase value="ShowFields"> ! <!--- 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#"> ! </cflock> ! </cfcase> ! ! <!---||| If ShowRecords ... |||---> ! <cfcase value="ShowRecords"> ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!--- Get Record Count ---> ! <cfmodule template="Query/recordCount.cfm" ! queryName="recordCount" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#"> ! </cflock> ! ! <!---||| Determine if any of the navigation buttons were used to request a set of records and set set limit variables accordingly |||---> ! <!--- If First button was clicked ... ---> ! <cfif IsDefined("FORM.First")> ! <!--- Set initial record limit to Zero ---> ! <cfset initialRecord = 0> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Previous button was clicked ... ---> ! <cfelseif IsDefined("FORM.Previous")> ! <!--- Set initial record limit to the difference of the first record used on the previous request and number of new records requested ---> ! <cfset initialRecord = FORM.firstRecord - FORM.numberOfRecords> ! <!--- Make sure that initial record is not a negative number, the first record in MySQL is always 0 ---> ! <cfif initialRecord LT 0><cfset initialRecord = 0></cfif> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Next button was clicked ... ---> ! <cfelseif IsDefined("FORM.Next")> ! <!--- Set initial record limit to one more than the last record used on the previous request ---> ! <cfset initialRecord = FORM.lastRecord + 1> ! <!--- Make sure that initial record is no greater than the record count minus number of records ---> ! <cfif initialRecord GT recordCount.numOfRows - FORM.numberOfRecords> ! <cfset initialRecord = recordCount.numOfRows - FORM.numberOfRecords> ! </cfif> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Last button was clicked ... ---> ! <cfelseif IsDefined("FORM.Last")> ! <!--- Set initial record limit to the difference between available records and requested number of records ---> ! <cfset initialRecord = recordCount.numOfRows - FORM.numberOfRecords> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- Otherwise if none of the navigation buttons were clicked than this must be the first requeste for a set of reccords in this table ... ---> ! <cfelse> ! <!--- Set initial record limit to Zero ---> ! <cfset initialRecord = 0> ! <!--- Initiate a readonly lock to ensure the integrity of default client settings ---> ! <cflock name="clientDefaultSettings" timeout = "30" throwontimeout="no" type = "readonly"> ! <!--- Set total number of records limit to the defaultMaxRows client setting ---> ! <cfset numberOfRecords = client.defaultMaxRows> ! </cflock> ! </cfif> ! ! <!--- 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 ---> ! <cfmodule template="Query/fieldList.cfm" ! queryName="fieldList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#"> ! <!--- Get Requested Records ---> ! <cfmodule template="Query/SELECT.cfm" ! queryName="selectedData" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! tables="#URL.table#" ! initialRecord="#initialRecord#" ! numberOfRecords="#numberOfRecords#"> ! </cfmodule> ! </cflock> ! </cfcase> ! <cfcase value="CreateTable_Step1"></cfcase> ! <cfcase value="CreateTable_Step2"></cfcase> ! <cfcase value="SelectRecords"></cfcase> ! <cfdefaultcase>Error: No dbProcess was Specified</cfdefaultcase> ! </cfswitch> ! ! <!-----------------------------------------> ! <!--- Output the Result of User Request ---> ! <!-----------------------------------------> ! <!---||| Include Header |||---> ! <cfinclude template="Include/Header.cfm"> ! ! <!---||| Show Current Database |||---> ! <!--- Initiate a readonly lock to ensure the integrity of session variables ---> ! <cflock timeout = "30" throwontimeout="no" type = "readonly" scope = "session"> ! <h2>Current Database: <cfoutput>#session.dbName#</cfoutput></h2> ! </cflock> ! ! <!---||| Output the Result of User Requested dbProcess |||---> ! <cfswitch expression="#dbProcess#"> ! <cfcase value="ShowTables"><cfinclude template="dbProcessBody/ShowTables.cfm"></cfcase> ! <cfcase value="ShowFields"><cfinclude template="dbProcessBody/ShowFields.cfm"></cfcase> ! <cfcase value="ShowRecords"><cfinclude template="dbProcessBody/ShowRecords.cfm"></cfcase> ! <cfcase value="CreateTable_Step1"><cfinclude template="dbProcessBody/CreateTable_Step1.cfm"></cfcase> ! <cfcase value="CreateTable_Step2">Create Table Step two</cfcase> ! <cfcase value="SelectRecords"><cfinclude template="dbProcessBody/SelectRecords.cfm"></cfcase> ! <cfdefaultcase>Error: No dbProcess was Specified</cfdefaultcase> ! </cfswitch> ! ! <!---||| Include Footer |||---> <cfinclude template="Include/Footer.cfm"> --- 1,194 ---- ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: MyDatabasePilot.cfm * ! * Purpose: DataBase Administrator Page, this is where the bulk of the processing * ! * calls are made from * ! * Requiremets: The database connection variables must either be configured in the * ! * Aplication.cfm file, or passed to this template via FORM_LogintoDB * ! ********************************************************************************************---> ! ! <!------------------------------------------------------------------------------> ! <!--- Process User Request Input Variables and Initialize Internal Variables ---> ! <!------------------------------------------------------------------------------> ! <!---||| Reset session variables if new database was requested |||---> ! <!--- Check to see if this template was called by FORM_LogintoDB with a new dataSource ---> ! <cfif IsDefined("FORM.dataSource")> ! <!--- Initiate an Exclusive lock to ensure the integrity of session variables ---> ! <cflock timeout = "30" throwontimeout="no" type = "exclusive" scope = "SESSION"> ! <!--- Using the values submitted by the login in form, ---> ! <!--- trim leading and trailing white spaces and ---> ! <!--- overwrite the session variables used for database connection ---> ! <cfset SESSION.dataSource = #Trim(FORM.dataSource)#> <!--- Data Source ---> ! <cfset SESSION.userName = #Trim(FORM.userName)#> <!--- User Name ---> ! <cfset SESSION.password = #Trim(FORM.password)#> <!--- Password ---> ! <!--- Set the loggedIn Flag to True ---> ! <cfset SESSION.loggedIn = 1> ! <!--- Get Database Name ---> ! <cfmodule template="Query/thisDatabaseName.cfm" ! queryName="thisDatabaseName" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#"> ! <!--- Overwrite dbName Variable ---> ! <cfset SESSION.dbName = "#thisDatabaseName.databaseName#"> ! </cflock> ! </cfif> ! ! <!-----------------------------------------------> ! <!--- Run Requested Database Command or Query ---> ! <!-----------------------------------------------> ! <!--- Which dbProcess was requested? ---> ! <cfswitch expression="#dbProcess#"> ! <!---||| If ShowTables ... |||---> ! <cfcase value="ShowTables"> ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!--- Get List of Table Names ---> ! <cfmodule template="Query/tableList.cfm" ! queryName="tableList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#"> ! </cflock> ! </cfcase> ! ! <!---||| If ShowFields ... |||---> ! <cfcase value="ShowFields"> ! <!--- 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#"> ! </cflock> ! </cfcase> ! ! <!---||| If ShowRecords ... |||---> ! <cfcase value="ShowRecords"> ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="SESSION"> ! <!--- Get Record Count ---> ! <cfmodule template="Query/recordCount.cfm" ! queryName="recordCount" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#"> ! </cflock> ! ! <!---||| Determine if any of the navigation buttons were used to request a set of records and set set limit variables accordingly |||---> ! <!--- If First button was clicked ... ---> ! <cfif IsDefined("FORM.First")> ! <!--- Set initial record limit to Zero ---> ! <cfset initialRecord = 0> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Previous button was clicked ... ---> ! <cfelseif IsDefined("FORM.Previous")> ! <!--- Set initial record limit to the difference of the first record used on the previous request and number of new records requested ---> ! <cfset initialRecord = FORM.firstRecord - FORM.numberOfRecords> ! <!--- Make sure that initial record is not a negative number, the first record in MySQL is always 0 ---> ! <cfif initialRecord LT 0><cfset initialRecord = 0></cfif> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Next button was clicked ... ---> ! <cfelseif IsDefined("FORM.Next")> ! <!--- Set initial record limit to one more than the last record used on the previous request ---> ! <cfset initialRecord = FORM.lastRecord + 1> ! <!--- Make sure that initial record is no greater than the record count minus number of records ---> ! <cfif initialRecord GT recordCount.numOfRows - FORM.numberOfRecords> ! <cfset initialRecord = recordCount.numOfRows - FORM.numberOfRecords> ! </cfif> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- If Last button was clicked ... ---> ! <cfelseif IsDefined("FORM.Last")> ! <!--- Set initial record limit to the difference between available records and requested number of records ---> ! <cfset initialRecord = recordCount.numOfRows - FORM.numberOfRecords> ! <!--- Set total number of records limit to the value passed by the form ---> ! <cfset numberOfRecords = FORM.numberOfRecords> ! <!--- Otherwise if none of the navigation buttons were clicked than this must be the first requeste for a set of reccords in this table ... ---> ! <cfelse> ! <!--- Set initial record limit to Zero ---> ! <cfset initialRecord = 0> ! <!--- Initiate a readonly lock to ensure the integrity of default client settings ---> ! <cflock name="clientDefaultSettings" timeout = "30" throwontimeout="no" type = "readonly"> ! <!--- Set total number of records limit to the defaultMaxRows client setting ---> ! <cfset numberOfRecords = client.defaultMaxRows> ! </cflock> ! </cfif> ! ! <!--- 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 ---> ! <cfmodule template="Query/fieldList.cfm" ! queryName="fieldList" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! table="#URL.table#"> ! <!--- Get Requested Records ---> ! <cfmodule template="Query/SELECT.cfm" ! queryName="selectedData" ! datasource="#SESSION.dataSource#" ! username="#SESSION.userName#" ! password="#SESSION.password#" ! tables="#URL.table#" ! initialRecord="#initialRecord#" ! numberOfRecords="#numberOfRecords#"> ! </cfmodule> ! </cflock> ! </cfcase> ! ! <!---||| If AddField ... |||---> ! <cfcase value="AddField"></cfcase> ! ! <!---||| If AlterField ... |||---> ! <cfcase value="AlterField"></cfcase> ! <cfcase value="DropField"></cfcase> ! <cfcase value="CreateTable"></cfcase> ! <cfcase value="AlterTable"></cfcase> ! <cfcase value="RenameTable"></cfcase> ! <cfcase value="DropTable"></cfcase> ! <cfcase value="Select"></cfcase> ! <cfcase value="Insert"></cfcase> ! <cfcase value="Update"></cfcase> ! <cfcase value="Delete"></cfcase> ! </cfswitch> ! ! <!-----------------------------------------> ! <!--- Output the Result of User Request ---> ! <!-----------------------------------------> ! <!---||| Include Header |||---> ! <cfinclude template="Include/Header.cfm"> ! ! <!---||| Show Current Database |||---> ! <!--- Initiate a readonly lock to ensure the integrity of session variables ---> ! <cflock timeout = "30" throwontimeout="no" type = "readonly" scope = "session"> ! <h2>Current Database: <cfoutput>#session.dbName#</cfoutput></h2> ! </cflock> ! ! <!---||| Output the Result of User Requested dbProcess |||---> ! <cfswitch expression="#dbProcess#"> ! <cfcase value="ShowTables"><cfinclude template="dbProcessBody/ShowTables.cfm"></cfcase> ! <cfcase value="ShowFields"><cfinclude template="dbProcessBody/ShowFields.cfm"></cfcase> ! <cfcase value="ShowRecords"><cfinclude template="dbProcessBody/ShowRecords.cfm"></cfcase> ! <cfcase value="AddField">Add Field</cfcase> ! <cfcase value="AlterField">Alter Field</cfcase> ! <cfcase value="DropField">Drop Field</cfcase> ! <cfcase value="CreateTable">Create Table</cfcase> ! <cfcase value="AlterTable">Alter Table</cfcase> ! <cfcase value="RenameTable">Rename Table</cfcase> ! <cfcase value="DropTable">Drop Table</cfcase> ! <cfcase value="Select">Select</cfcase> ! <cfcase value="Insert">Insert</cfcase> ! <cfcase value="Update">Update</cfcase> ! <cfcase value="Delete">Delete</cfcase> ! <cfdefaultcase>Error: No dbProcess was Specified</cfdefaultcase> ! </cfswitch> ! ! <!---||| Include Footer |||---> <cfinclude template="Include/Footer.cfm"> |