<cffunction name="countLineInFile">
<cfargument name="filePath" required="yes">
<cfif NOT FileExists(filePath)>
<cfreturn 0>
</cfif>
<cfset totalLine = 0>
<cffile action="read" file="#filePath#" variable="csvInp">
<cfset totalLine = ListLen(csvInp, Chr(10))>
<!--- awkwark way --->
<!--- <cfloop file="#filePath#" index="line" charset="shift-jis">
<cfset lineData = ListToArray(#line#) >
<cfif NOT ArrayIsEmpty(lineData) >
<cfset totalLine = totalLine+1 >
</cfif>
</cfloop> --->
<cfreturn totalLine >
</cffunction>
Next Issues:
Performance import file (csv)
How to reduce query using StringBuffer query, transaction ...
Timeout suck
<cfargument name="filePath" required="yes">
<cfif NOT FileExists(filePath)>
<cfreturn 0>
</cfif>
<cfset totalLine = 0>
<cffile action="read" file="#filePath#" variable="csvInp">
<cfset totalLine = ListLen(csvInp, Chr(10))>
<!--- awkwark way --->
<!--- <cfloop file="#filePath#" index="line" charset="shift-jis">
<cfset lineData = ListToArray(#line#) >
<cfif NOT ArrayIsEmpty(lineData) >
<cfset totalLine = totalLine+1 >
</cfif>
</cfloop> --->
<cfreturn totalLine >
</cffunction>
Next Issues:
Performance import file (csv)
How to reduce query using StringBuffer query, transaction ...
Timeout suck
Comments
Post a Comment