Gleb Paharenko wrote:
Hello.

Are you sure that you want to load PDF with LOAD DATA INFILE?

Well, I had been sure, but not so much anymore. <s>

Maybe LOAD_FILE is that you want:

  http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

Yup, this was the ticket. I'd seen several references to PDFs and LOAD DATA INFILE. But this works great:

I'm using FoxPro to convert DBF data to MySQL, and have PDFs in FoxPro memo fields. Here's (for the benefit of the archives) what I did (this is xbase code):

* process each record in a DBF
scan
  * job_no is a unique value for a record
  m.lcPDF = "load_file('" + curdir() + alltrim(job_no) + ".pdf" + "')"

  * convert single backslashes to doubles - else you get a
  * "Can't get stat of 'test.txt' (Errcode: 2)" error
  m.lcPDF = strtran(m.lcPDF, "\", "\\")

  * create a string that consists of the INSERT command
  m.lcStrInsert = [insert into COMPLETE (job_no, pdffile) values ] ;
    + [(']+m.lcJob_no + [',] + m.lcPDF + [)]

  * use sql passthrough to execute the command and return a code
  * indicating success or failure
  m.liSuccess = sqlexec(m.liHandle, m.lcStrInsert)

  * (more code here, but removed for clarity)
endscan

Thanks,

Whil


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to