Skip to content

Instantly share code, notes, and snippets.

@joshknutson
Created April 25, 2010 20:06
Show Gist options
  • Save joshknutson/378677 to your computer and use it in GitHub Desktop.
Save joshknutson/378677 to your computer and use it in GitHub Desktop.
<cfsetting requesttimeout="9999999" />
<cfsetting showdebugoutput="false" />
<cfoutput>
starting<br />
<cfset theFile = "c:\someVeryVeryLargeFile.sql" />
<cfset from= 1 />
<cfset to = 300500 />
from #from#<br />
to #to#<br />
<cfset tick = GetTickCount()>
<cfset counter = from />
<!--- from="#from#" to="#to#" --->
<cfloop file="#theFile#" index="line" charset="UTF-16">
<cfif line contains "insert">
<!---#line#<br />--->
<cflog file="db_copy" application="no" text="LINE: #counter# started" />
<cftry>
<cfquery name="try" datasource="#application.dsn#">
#preservesinglequotes(line)#
</cfquery>
<cfcatch type="database">
<!---do nothing--->
</cfcatch>
</cftry>
<cflog file="db_copy" application="no" text="LINE: #counter# finished" />
</cfif>
<cfset counter++ />
</cfloop>
done<br />
<cfset tock = GetTickCount()>
<cfset time = tock-tick>
it took #time#ms
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment