Hey everyone, I am on a month long project on a coldfusion script I have to work on. Bare with my noobness here :P Basically here is the jist of it.

-- I have a huge sql database filled with various random people information, such as their phone #"s, email addresses, name, etc...this database it might be going off from could be anywhere from 8,000-15,000 users on it that it will be going off from.

--From time to time I will get a list of say 200-300 email addresses sometimes it can go up to 3000 email addresses from the database whose emails are bounced.

--Now what I am trying to do here is ..making a script where when you input this large list of email addresses, whether it be .txt or just copying it and pasting it into a form with all the bad email addresses...you hit submit..and the system automatically would search the user from its main database to see if it finds the email address, and if it does it retrieves the phone # for that specific person that's stored on the database and outputs it back into the page so every email that's been submitted returns back with a email address and phone # right next to each other...

How complicated would this be to make such a script? ANY help / suggestions / advice / or the jist of what I'm going to be dealing with would be MUCH appreciated.


Thanks

One of the nice things that you can do with coldfusion is utilize java objects. BufferedReader is one of my favorite ones. It allows you to read extremely large files a bit at a time instead of reading in an entire file all at once. Coldfusion servers tend to choke because when you use cffile to read in a file you get all of the file's contents read into memory. This tends to suck the life out of your server when you are dealing with 50 megabyte or larger files. I suggest you look into using BufferedReader to read in the text or csv file. Here is a degraded snippet of something I wrote a while ago to import a couple hundred thousand email addresses into a database (client of a client wanted this. god knows why). Its actually taken from someone's blog so I can't take credit for parts of this code.

<cfscript>
	// large text file, 4MB, 80,000+ lines
	srcFile = "#ExpandPath('.')#/myfile.txt";
	// create a FileReader object
	fr = createObject("java","java.io.FileReader");
	// Call the constructure with the source file path
	fr.init(srcFile);
	// create a BufferedReader object
	br = createObject("java","java.io.BufferedReader");
	// call the constructor with the FileReader as the arg
	br.init(fr);
	// read the first line
	str = br.readLine();
	// loop ... str will be undefined if there are no more lines
	while (isDefined("str"))
	{
		myColdfusionFunction(str);
		// read the next line so we can continue the loop
		str = br.readLine();
	}
	// close the buffered reader object
	br.close();
</cfscript>
This article has been dead for over six months. Start a new discussion instead.