Cold Fusion String Search In Text File and insert in to database!

hi,

im trying to search in text file from CFM  and insert in to database for example

1st Text File:

True

OR

False

---------------------------------------------------------------------------------

2nd  Text File :

"A blog (a blend of the term web log)[1] is a type of website or part of a website supposed to be updated with new content from time to time. Blogs are usually maintained by an individual with regular entries of commentary, descriptions of events, or other material such as graphics or video. Entries are commonly displayed in reverse-chronological order. Blog can also be used as a verb, meaning to maintain or add content to a blog.
Although not a must, but most good quality blogs are interactive, allowing visitors to leave comments and even message each other via widgets on the blogs and it is this interactivity that distinguishes them from other static websites."


Two Thing i have to do.

: 1
I'll check in 1st file "True" or "False"  then  i'll insert in to database with date and time.

: 2
i'll start reading text file from start where ever  i'll get word "website" i'll insert in to database with location & total.


xeondxbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sandy12879Commented:
I assume you want to search through text file,the way to go would be to make a CFcollection of all the text files.and search it through verity search.
Once you retreive the file through you can have corresponding updates in data base...
0
xeondxbAuthor Commented:
Well i have one file is coming from feed coming from other system like Linux it is updating text file with true and false  status what i have to do grab the status with date and time update my system end of the month i'll generate report how many times it was true and false
0
_agx_Commented:
If you mean the 1st file contains only the word true or false, simply read the contents with cffile (or FileRead for CF9+). Parse the result and insert  it into your db.  

*Note: I'm assuming "status" is a BIT ie boolean column. Change as needed.
<cffile action = "read" file="c:\path\to\yourfile.txt" variable="content">
<cfif trim(content) eq "true">
      <cfset status = true>
<cfelse>
      <cfset status = false>
</cfif>
<cfquery ...>
    INSERT INTO YourTable ( BitStatusColumn, DateTimeStamp )
    VALUES (
         <cfqueryparam value="#status#" cfsqltype="cf_sql_bit"> 
         , <cfqueryparam value="#now()#" cfsqltype="cf_sql_timestamp"> 
    )
</cfquery>

Open in new window


> i'll insert in to database with location & total.
What do you mean by location?  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xeondxbAuthor Commented:
well yea same how i needed some think link this anyway it'll help me .....
0
_agx_Commented:
So what was the actual answer?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.