Hello and apologies in advance if this is a bit of a novel.
I have the task of migrating my organization off Paradox, which I've been able to do successfully for some years mostly using pypxlib.
I'm stuck on a table that has a Graphical Blob field in it. It has 14k records, about 11k of which have a small drawing stored in a Blob field. I need to export these and tie them back to the records they were stored with in my new database (in postgresql).
I quickly learned that pyxplib can't handle Graphic Blobs in any useful way. Both it and pxlib seem to be dead development-wise, so that's not going to work.
My next solution was to export to HTML. This appeared to work, though the blobs were written out to jpg files with arbitrary names. I wrote a scraper to grab the filename and identifying data from each record to tie the filename back to a record in the new database.
One problem though: Paradox exports the table incorrectly. Seemingly at random, the wrong image shows up with the wrong record. I tried the process using Paradox 11 on Windows 10, Paradox 11 on W10 with Windows 7 compatibility mode, Paradox 11 on Windows XP, and Paradox 9 on Windows XP. All were wrong in varying degrees. XP was by far the most wrong, it didn't even export 1/3 of the files.
So I have given up on the HTML export route.
My last hope is ObjectPAL. I do not grok ObjectPAL, but I gleaned enough of it off some web searches to cobble a script that would scan the table and write out the image to a file with a name containing the fields I'd need to tie it into the new database. AND IT WORKED.... for a little bit. At precisely 882 records into the scan, it started putting out empty image files (even though I am only writing if there is image data in the record).
I updated my script to allow me to start at an arbitray record and go for a specified number of records, so I could export in batches. THIS WORKED.... for a little longer. I got as far as 2000 records and after that it will only spit out blank files.
Anyone have advice? Something I can do to help this run reliably? Any issues with my ObjectPAL code? (see below)
method run(var eventInfo Event)
var
tc tcursor
diagram graphic
gis_no String
skipto number
run_for number
endvar
skipto = 2000
run_for = 500
if tc.open("\\Path\\to\\my.DB") then
scan tc:
if tc.recNo() < skipto then loop endif
if (tc.recNo() - skipto) > run_for then
quitLoop
endif
tc.fieldValue("Gis_no", gis_no)
tc.fieldValue("Diagram", diagram)
if NOT (diagram.isBlank()) then
diagram.writeToFile("\\Path\\to\\output\\" + String(tc.recNo()) + "-" + gis_no + ".jpg")
endif
endscan
tc.close()
endif
endMethod