Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help! cursortoXML() and binary data
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00588195
Message ID:
00588522
Views:
52
Hi John,

XML doesn't allow binary data to be directly embedded. It has to be encoded one way or another. Below you'll find the code that I got work in VFP.
classname = "myoleclass"
SELECT * FROM c:\test\test.vcx ;
  WHERE objname == ?classname ;
  INTO CURSOR class_def READWRITE 
* Change the type of the 'ole' column to memo/binary. 
*   I think it's a bug that it doesn't marked as such in VCX
* The 'objcode' column is already memo/binary
ALTER TABLE class_def ALTER COLUMN ole M NOCPTRANS
* Convert cursor to XML with inline schema
*  It'll allow base64 encoding of binary data in the 'objcode' and 'ole' fields
CURSORTOXML("class_def","_classdef",1,0,0,"1")
* Convert it back to cursor for testing
XMLTOCURSOR(_classdef,"NewClass" )
>am trying to get a class definition to be returned by a webservice. Before I got that far, I ran into issues with the vfp XML functions and attempting to do it within VFP.
>
>here is my code to get the class:
>
>FUNCTION Checkout(classname AS STRING)
>SELECT * FROM c:\test\test.vcx WHERE objname == ?classname INTO CURSOR class_def
>CURSORTOXML("class_def","_classdef",1,4096)
>RETURN _classdef
>
>
>upon getting the string back, I try to "unpack" it with xmltocursor()
>
>XMLTOCURSOR(o.Checkout(),"NewClass" ,4096)
>
>the class is an olebound control and it always blows up on the ole field of the xml string
>
>Obviously I have no freaking idea what I am doing, but I do (Wayne) seem to be holding my mouth right.
>
>
>Any suggestions?
>
>Thanks!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform