Toggle menu

deleteOldTableData

deleteOldTableData(ctx, tablename, version, batchsize, progresscallback, progressrowcount)

Deletes old versions of imported data from a table.

Parameters

NameTypeDescription
ctxStruct, requiredDatabase details, see above
tablenameString, requiredThe name of the table to delete data from
versionInteger, requiredThe earliest version of the data to keep. Versions earlier than this will be deleted
batchsizeInteger, optionalThe number of rows to delete in each query. Defaults to 10000
progresscallbackFunction, optionalA callback function which is told how many rows have been processed. The function must not return a value. It takes one augments: nDeleted (Integer) the number of rows that have been deleted
progressrowcountInteger, optionalThe number of rows after which the progresscallback function is called. Defaults to 100000

Returns

Boolean. True when the data is deleted.

Example

<cfset ds=APPLICATION.datasource>
<cfset dt=APPLICATION.databasetype>
<cfset tablename="timstable">
<!--- get a data importer --->
<cfmodule template="/icm/admin/dataimport/importer_v1.cfm" name="di" datasource=#ds# databasetype=#dt#>
<!--- delete a solr collection --->
<cfset di.deleteOldTableData(ctx=#di#,
       tablename=#tablename#,
       version=2
       )>
<cfoutput>...Done<br></cfoutput><cfflush>

Last modified on 30 September 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon