>- see footer for list info -<
Thanks Charlie,

Had no idea about this little gem!! Will give it a go on a local machine
here.

Regards,

Lee

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of charlie arehart
Sent: 14 October 2010 23:49
To: 'CFML Development'
Subject: RE: [CF-Dev] Entering large CSV file into DB regularly

>- see footer for list info -<
Keep in mind, as well, that there is built-in functionality in CFHTTP to
convert a CSV
into a CF query resultset. That might prove to be easier to process than
treating each
line in the CSV as merely a string, to be parsed. Just something to think
about.

It's a little-known aspect of CFHTTP (which, yes, can of course be used to
point just
at a file on a local machine, rather than a remote one). The key is in
adding the NAME
attribute, which is what triggers CF to do the conversion of a CSV to a
query (and the
result ends up in that NAMEd variable, rather than CFHTTP.filecontent).
There are
additional attributes that can help: Delimiters, TextQualifier,
FirstRowAsHeaders, and
Columns. The feature is discussed briefly in the CFML Reference and more in
the
Developer's Guide.

(And once it's in a query, there are all sorts of pre-built user defined
functions
offered on cflib.org that might even be able to convert it into a series of
inserts to
a DB, or to convert the query to XML if you really want to go that route.)

The idea of running it on another thread isn't a bad one with this, too, of
course. Of
course, given that the CFHTTP has to read the result into memory, it's also
worth
paying attention to the total heap used for the request(s), but really the
78mb you
said the zip held isn't that much to worry about except on the most
constrained
server.

Hope that's helpful.

/charlie


> -----Original Message-----
> From: [email protected] [mailto:dev-
> [email protected]] On Behalf Of Lee Fortnam
> Sent: Thursday, October 14, 2010 5:22 AM
> To: 'CFML Development'
> Subject: RE: [CF-Dev] Entering large CSV file into DB regularly
> 
> >- see footer for list info -<
> Thanks guys,
> 
> I believe the is an option for converting the CSV to XML and passing the
who
> string into the DB as a large memo field and letting the storeproc do all
> the work of looping through the XML to do the inserts using a cursor as
> well.
> 
> Lots to think about. Russ is SISS available on the vinidrizi-h3?
> 
> Regards,
> 
> Lee



_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.862 / Virus Database: 271.1.1/3196 - Release Date: 10/14/10
07:34:00


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to