Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using cursor adaptor to update blob data in MySQL

DDPL

IS-IT--Management
Sep 6, 2022
40
GB
I have a MySQL database that I am uploaded data from a VFP database via a cursor adaptor, everything has been working fine, but now need a BLOB and MEMO field in one of the tables, didn't previously have any so was just do something simple like this;

Code:
SELECT &oSource
SCAN
    SELECT &oSource
    SCATTER MEMVAR
    SELECT &oTarget
    APPEND BLANK
    GATHER MEMVAR
ENDSCAN

Code still works but obviously doesn't upload the BLOB or MEMO, but changing SCATTER MEMVAR and GATHER MEMVAR to include the MEMO clause throws an error when it updates the record on the table with BLOB and MEMO fields, but is still ok on other tables that don't contain these field types.

In MySQL table the VFP BLOB field is matches with a LONGBLOB and the MEMO field with a TEXT. I have "fetch memo fields" ticked on the CursorAdaptor Builder.

The error tells me that I have an error in the SQL syntax, any ideas?
 
Hi DDPL,

Check out FILETOSTR() function. Also STRTOFILE(). You need them for Blobs.
 
Hi Dylim,

I used FILETOSTR() to get the data into the BLOB field in the VFP table, the issue I am getting is copying the table record through the CursorAdaptor into the MySQL data table.
 
Have you added the field to the updatabelfieldlist of the CA? The cursorschema? Adding a field requires several changes in an existing CA.

Sometimes it can be the simplest to redo the CA (with the CA builder, for example).
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top