[Mydatabasepilot-cvs] MyDatabasePilot/Query recordCount.cfm,1.1,1.2
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-05-16 02:39:10
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/Query In directory sc8-pr-cvs1:/tmp/cvs-serv3954/Query Modified Files: recordCount.cfm Log Message: Internal Structure Changed: [ 738602 ] Converted Query/recordCount.cfm to a CUSTOM TAG Index: recordCount.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/Query/recordCount.cfm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** recordCount.cfm 8 May 2003 02:51:21 -0000 1.1 --- recordCount.cfm 16 May 2003 02:39:06 -0000 1.2 *************** *** 1,18 **** <!---******************************************************************************************* * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: Query/recordCount.cfm * * Purpose: Creates a Record Set with the number of records in the requested table * ! * Requiremets: - Connection Variables must already be set * ! * - Name of the table for which record count is needed must be passed * ********************************************************************************************---> ! <!---||| Find out the number of records in the current table |||---> ! <!--- Initiate a Read Only lock to ensure the integrity of session variables ---> ! <cflock timeout=20 throwontimeout="no" type="readonly" scope="session"> ! <!--- Create Recordset with a row count ---> ! <cfquery name="recordCount" datasource="#session.dataSource#" username="#session.userName#" password="#session.password#"> ! <!--- Use numOrRows as the alias for the column, ---> ! <!--- because ColdFusion does not allow special chars like * in variables ---> ! SELECT COUNT(*) AS numOfRows FROM #table#; ! </cfquery> ! </cflock> \ No newline at end of file --- 1,27 ---- <!---******************************************************************************************* * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: Query/recordCount.cfm (CUSTOM TAG) * * Purpose: Creates a Record Set with the number of records in the requested table * ! * Inputs: - queryName (Required) * ! * - dataSource (Required) * ! * - userName (Required) * ! * - password (Required) * ! * - table (Required) * ! * Outputs: - queryName * ********************************************************************************************---> ! <!---||| Check for existence of Required Attributes |||---> ! <!---||| More user friendly error checking will be introduced in the BETA releases |||---> ! <cfif NOT IsDefined("ATTRIBUTES.queryName")><CFABORT showerror="The queryName attribute is required when calling recordCount custom tag."></cfif> ! <cfif NOT IsDefined("ATTRIBUTES.dataSource")><CFABORT showerror="The dataSource attribute is required when calling recordCount custom tag."></cfif> ! <cfif NOT IsDefined("ATTRIBUTES.userName")><CFABORT showerror="The userName attribute is required when calling recordCount custom tag."></cfif> ! <cfif NOT IsDefined("ATTRIBUTES.password")><CFABORT showerror="The password attribute is required when calling recordCount custom tag."></cfif> ! <cfif NOT IsDefined("ATTRIBUTES.table")><CFABORT showerror="The table attribute is required when calling recordCount custom tag."></cfif> ! ! <!---||| Find out the number of records in the Passed table |||---> ! <!--- Create Recordset with a row count ---> ! <cfquery name="CALLER.#ATTRIBUTES.queryName#" datasource="#ATTRIBUTES.dataSource#" username="#ATTRIBUTES.userName#" password="#ATTRIBUTES.password#"> ! <!--- Use numOfRows as the alias for the column, ---> ! <!--- because ColdFusion does not allow special chars like * in variables ---> ! SELECT COUNT(*) AS numOfRows FROM #ATTRIBUTES.table#; ! </cfquery> \ No newline at end of file |