[Mydatabasepilot-cvs] MyDatabasePilot MyDatabasePilot.cfm,1.9,1.10
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-05-09 04:08:05
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot In directory sc8-pr-cvs1:/tmp/cvs-serv21925 Modified Files: MyDatabasePilot.cfm Log Message: Functionality Added: [ 735008 ] Add Limit Rows to ShowRecords dbProcess Index: MyDatabasePilot.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/MyDatabasePilot.cfm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MyDatabasePilot.cfm 30 Apr 2003 03:39:03 -0000 1.9 --- MyDatabasePilot.cfm 9 May 2003 04:08:02 -0000 1.10 *************** *** 33,37 **** --- 33,84 ---- <cfcase value="ShowFields"><cfinclude template="Query/fieldList.cfm"></cfcase> <cfcase value="ShowRecords"> + <!--- Find out the number of records in the current table ---> + <cfinclude template="Query/recordCount.cfm"> + + <!---||| 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> + + <!--- Generate a field list for the current table ---> <cfinclude template="Query/fieldList.cfm"> + <!--- Retrieve the requested records ---> <cfset queryName = "selectedData"> <cfinclude template="Query/SELECT.cfm"> |