So, I have a question after playing around with this (wow is it much faster
than the easycfm way!):

I read up a little on cfscript, is it really true that there is no way to
use SQL queries inside a cfscript block?  I am VERY new to cfscript, but I
thought that there was a way that has been mentioned in here before.  This
method is not going to do me much good if I can't parse out and put vals in
the DB...

Thanks Dick, this is pretty cool...

Ray

At 03:50 PM 8/18/2004, you wrote:
>Ray, here's the line reader that Joe Rinehart suggested (with a slight
>mod).
>
>Enjoy!
>
>Dick
>
>   Hey Joe
>
>   Your No Class Reader Works Great!
>
>   much faster than the other! (almost as fast as a cffile read of
>   the
>   entire file).
>
>   I simplified the EOF test so I could use a While loop.
>
>   Thanks
>
>   Dick
>
>   Here's the revised code:
>
>   <cfsetting enableCFOutputOnly="yes" />
>   <cfset lineCount = 0 />
>
>   <cfset timer = GetTickCount() />
>
>   <cfscript>
>      filename = "/Users/Richard/Music/iTunes/iTunes Music Library.xml";
>      fileReader = createObject("java", "java.io.FileReader");
>      fileReader = fileReader.init(filename);
>      lineReader = createObject("java","java.io.LineNumberReader");
>      lineReader = lineReader.init(fileReader);
>
>      thisLine = true;
>      while (isDefined("thisLine")) {
>        thisLine = lineReader.readLine();
>        lineCount = LineCount + 1; // do any processing of the line here
>      }
>
>   </cfscript>
>
>   <cfoutput>
>   <br>count = #lineCount# | #GetTickCount() - timer#
>   </cfoutput>
>   <cfsetting enableCFOutputOnly="no" />
>
>   I always forget to kill blank lines  on this sort of thing --
>   very
>   important
>
>   On Jun 16, 2004, at 6:28 AM, Joe Rinehart wrote:
>
>   > Hey Dick,
>   >
>   >  I've done a similar thing, but didn't create the external
>   >  CFBufferedReader class. Do you see any reason why the
>   following
>   > wouldn't
>   >  provide the same?
>   >
>   >  <cfscript>
>   >    filename = "c:\cfusionmx\wwwroot\lineNumberReader.cfm";
>   >  fileReader = createObject("java", "java.io.FileReader");
>   >  fileReader = fileReader.init(filename);
>   >  lineReader = createObject("java","java.io.LineNumberReader");
>   >  lineReader = lineReader.init(fileReader);
>   >  </cfscript>
>   >
>   >  <cfset eof = false>
>   >  <cfloop condition="not eof">
>   >    <cfset thisLine = lineReader.readLine()>
>   >    <cfif not isDefined("thisLine")>
>   >      <cfset eof = true>
>   >    <cfelse>
>   >      <cfoutput>#htmlEditFormat(thisLine)#<br></cfoutput>
>   >    </cfif>
>   >  </cfloop>
>   >
>   >  (when  lineReader instance hits the end of the file,
>   readLine()
>   > returns
>   >  a result that causes thisLine to become undefined in the eyes
>   of  CF)
>   >
>   >  -joe
>   >
>     _____
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to