|
kosh Beginner
Joined: 24 Oct 2002 Posts: 14 Location: Canada
|
Posted: Mon Mar 03, 2003 8:26 pm
importing a txt file into a database |
ok I am trying to import a text file....a rather large file into a database
I have an eq database script already but I cant seem to figure out a couple of things
like how to read the file sequentially from the start of 1 record to the end of it.. I either get 1 line at a time, or I get the wrong info. Ive tried to use %read in loops and Ive tried #read in loops. Ive tried opening the file with 1 and 6 to try it under both a text file and as a structured file....
if I use #file 1 "data.txt"
and use %read I only get 1 line at a time
if I use $file 6 "data.txt"
I get part of the record but not all of it some lines are missing
and what I dont understand is that the data file is a #log file from zmud
the other problem is actually getting the data from #show into the database...
the only thing that seperates the records in the data file is a blank line
Any help would be appreciated |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Mon Mar 03, 2003 10:39 pm |
Your zMud log file is a text file so you'll want to use #FILE numbers 1 through 5.
#FILE 1 "data.txt"
#LOOP 1,%filesize(1) {#SH %read(1,%i)}
Should pull all the data onto your screen.
If you aren't gleaning the right information from it, your triggers
are probably not matching things.
I usually add a #CO 30 into the capturing triggers so I can easily
visually see what got matched and what didn't get matched. Getting
the wrong info usually means the scripts you are using to add to the eq
database from the imported text are faulty. You might also want to do a test to see
if the item already exists in the database to avoid duplicates.
Ton Diening |
|
|
|
|
|