Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Blob with MySQL
Message
 
To
01/05/2009 06:46:53
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Miscellaneous
Thread ID:
01397385
Message ID:
01397389
Views:
48
Hi Hanafi,

SQLEXEC() return -1?

Try this...
--My SQL script for table
CREATE TABLE AKTDOCX
(
   AK800  char(10)      NOT NULL,
   AK803  LONGBLOB     NULL,
   constraint PK_AKTDOC primary key (AK800)
)
DEFAULT CHARSET=cp1250
;
lihdbc=SQLSTRINGCONNECT("uid=uid;pwd=pwd;driver={MySQL ODBC 3.51 Driver};"+;
          "Database=test;SERVER=localhost;PORT=3406;OPTION=0;STMT=SET NAMES cp1250")

CREATE CURSOR xxc (xx000 W)
APPEND BLANK
REPLACE xx000 WITH filetostr("any file.doc")

?SQLEXEC(lihdbc,"INSERT INTO AKTDOCX (AK800,AK803) VALUES ('xxxxx',?xxc.xx000)")
?CURSORSETPROP("MapBinary" ,.T.,0)
?SQLEXEC(lihdbc,"SELECT AK803 FROM AKTDOCX","xxb")
?CURSORSETPROP("MapBinary" ,.F.,0)
STRTOFILE(ak803,"c:\test.doc")
=SQLDISCONNECT(lihdbc)
MartinaJ

>Hii all,
>Can anyon tell me how to store and retrieve an image in MySQL BLOB field.
>I'm already using FileToStr() and StrToFile() function which are works fine in VFP native table, but still not work when try to update MySQL table.
>This is My Code to update MySQL Table. Thanks
>
>
>Local MCommand, MPict, MPict1
>
>MPict = FiletoStr("C:\AVFP\SWIFT.JPG")
>MCarId = "SWIFT"
>MPict1 = Cast( MPict1 AS BLOB )
>
>MCommand = "Update Cars Set Pict1 = ?MPict1 Where CarId = ?MCarId"
>
>SQLEXEC(M_IdConnection, MCommand)
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform