Batch converting Corel Paradox 4.0 Tables to CSV/SQL -- via PHP or other scripts
Recently I've begun working on exploring ways to convert about 16k Corel Paradox 4.0 database tables (my client has been using a legacy platform over 20 years mainly due to massive logistical matters) to more modern formats (i.e.CSV, SQL, etc.) en mass and so far I've been looking at PHP since it has a library devoted to Paradox data processing however while I'm fairly confident in how to write the conversion code (i.e. simply calling a few file open, close, and write functions) I'm concerned about error detection and ensuring that whe开发者_StackOverflown running the script, I don't spend hours waiting for it to run only to see 16k corrupt files exported.
Also, I'm not fully sure about the logic loop for calling the files. I'm thinking of having the program generate a list of all the files with the appropriate extension and then looping through the list, however I'm not sure if that's ideal for a directory of this size.
This is being run on a local Windows 7 x64 system with XAMPP setup (the database is all internal use) so I'm not sure if pure PHP is the best idea -- so I've been wondering if Python or some other lightweight scripting language might be better for handling this.
Thanks very much in advance for any insights and assistance,
This is doubtless far too late to help you, but for posterity...
If one has a Corel Paradox working environment, one can just use it to ease the transition.
We moved the Corel Paradox 9 tables we had into an Oracle schema we built by connecting to the schema (using an alias such as SCHEMA001) then writing this Procedure in a script from inside Paradox:
Proc writeTable(targetTable String)
errorTrapOnWarnings(Yes)
try
tc.open(targetTable)
tc.copy(":SCHEMA001:" + targetTable)
tc.close()
onFail
errorShow()
endTry
endProc
One could highly refine this with more Paradox programming, but you get the idea. One thing we discovered, though, is that Paradox uses double quotes for the column names when it creates the Oracle version, which means you can get lower-case letters in column names in Oracle, which is a pain. We corrected that by writing a quick Oracle query to upper() all the resulting column names.
We called the procedure like so:
Var
targetTable String
tc TCursor
endVar
method run(var eventInfo Event)
targetTable = "SomeTableName"
writeTable(targetTable)
msgInfo("TransferData.ssl--script finished",
"That's all, folks!" )
return
endMethod
If you intend to just convert the data which I guess is a process you do only once you will run the script locally as a command script. For that you don't need a web site and thus XAMPP. What language you take is secondary except you say that PHP has a library. Does python or others have one?
About your concern of error detection why not test your script with only one file first. If that conversion is successful you can build your loop and test this on maybe five files, i.e. have a counter that ends the process after that number. It that is still okay you can go on with the rest. You can also write log data and dump a result for every 100 files processed. This way you can see if your script is doing something or idling.
精彩评论