dbTalk Databases Forums  

Re: LOAD INFILES FROM a directory and UPDATE queries

comp.databases.mysql comp.databases.mysql


Discuss Re: LOAD INFILES FROM a directory and UPDATE queries in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Doug Miller
 
Posts: n/a

Default Re: LOAD INFILES FROM a directory and UPDATE queries - 07-09-2010 , 05:13 PM






In article <9463e76f-8938-4e62-93aa-d395f871d078 (AT) i16g2000prn (DOT) googlegroups.com>, JRough <jlrough (AT) yahoo (DOT) com> wrote:
Quote:
I have a file handle that reads all the files in a directory into an
array $file.
All the files are text files seaparated by the pipe.
Do the rows get escaped automatically with the default?
The file shouldn't be uploaded if it doesn't have the right columns.
There are 2 sql queries. One is to input the filename into the
filename column.
The other one is to parse 3 numbers out of the filename and input it
into the location_code column.
These two inputs can be input on every row. There is an auto enter
number id field.
How can I get the number of the ID's for the current file so I can do
the right UPDATES in the WHERE?
I have no idea what any of this means, nor does very much of it bear any
apparent relationship to the code you posted.

I have long held that muddled speech or writing is a clear indicator of
muddled thinking. I have also long held that if you cannot explain a subject
in terms simple enough that a person with ordinary intelligence, but no
knowledge of the subject, is able to understand the explanation, then you
don't understand the subject yourself.

Stop and think.

Write a clear and simple explanation of what you're trying to do -- *not* what
your *code* does, doesn't do, or is supposed to do. Explain the task you're
trying to accomplish in straighforward English prose.

Only then will you be able to get useful answers to your questions.

Reply With Quote
  #2  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: LOAD INFILES FROM a directory and UPDATE queries - 07-09-2010 , 06:35 PM






JRough <jlrough (AT) yahoo (DOT) com> wrote:

Quote:
I want to LOAD text files, delimited by |'s, all the rows, to a
database table.
Then start reading here:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
and make sure you understand the FIELDS TERMINATED BY clause.

Using an external scripting language to read the lines, split them
into fields and create INSERT statements, is an alternative.
However this alternatice is then not a topic of a MySQL newsgroup.
Try a PHP newsgroup instead.


XL

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.