Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: MySQL blob



Permlink Replies: 1 - Last Post: Oct 22, 2015 7:16 AM Last Post By: Marko Ravnik
Marko Ravnik

Posts: 23
Registered: 12/8/13
MySQL blob
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 22, 2015 6:35 AM
Ok I have 2 application first is in intraweb second VCL, in both i use FireDAC components and i want to read XML file wich is saved in BLOB field in MySQL database and both application uses same principe to get that XML file.

    try
      xml_stream:=  FDQuery.CreateBlobStream(FDQuery.FieldByName('XML_blob'), TBlobStreamMode.bmRead);
    finally
      if xml_stream.Size <> 0 then
        LoadXMLPPToForm(True,xml_stream,FDQuery.FieldByName('ID_sequence').AsInteger);
    end;


Then i want to parse that stream with TXMLDocument in VCL

procedure TPPXMLDocument.GetXMLPPFromStream( XMLDocFileStream : Tstream );
var i  : integer;
    teststr : string;
begin
              XMLDocument:=TXMLDocument.Create(nil);
              XMLDocument.DOMVendor := GetDOMVendor('ADOM XML v4');
              teststr:=StreamToString(XMLDocFileStream);
              XMLDocument.LoadFromStream(XMLDocFileStream);
....


And intraweb version

procedure TPPXMLDocument.GetXMLPP( XMLstream : Tstream);
var i  : integer;
 
 
begin
              XMLDocument:=TXMLDocument.Create(IWServerController);
              XMLDocument.DOMVendor := GetDOMVendor('ADOM XML v4');
              *teststr*:=StreamToString(XMLstream);              
              XMLDocument.LoadFromStream(XMLstream);
...

in case of VCL teststr got value:

'4>˛'#0'4>˛'#0'rsion="1.0" encoding="utf-8"?> ....

in case of Intraweb teststr got value:
<?xml version="1.0" encoding="utf-8"?>...

Why do i get strange values at the beggining of XML document ?
I am really fustrated over this, why would this happen?

Edited by: Marko Ravnik on Oct 22, 2015 6:37 AM

Marko Ravnik

Posts: 23
Registered: 12/8/13
Re: MySQL blob
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 22, 2015 7:16 AM   in response to: Marko Ravnik in response to: Marko Ravnik
I made sample application jut to read blob and show it in memo and guess what it correct. Strange

Marko Ravnik wrote:
Ok I have 2 application first is in intraweb second VCL, in both i use FireDAC components and i want to read XML file wich is saved in BLOB field in MySQL database and both application uses same principe to get that XML file.

    try
      xml_stream:=  FDQuery.CreateBlobStream(FDQuery.FieldByName('XML_blob'), TBlobStreamMode.bmRead);
    finally
      if xml_stream.Size <> 0 then
        LoadXMLPPToForm(True,xml_stream,FDQuery.FieldByName('ID_sequence').AsInteger);
    end;


Then i want to parse that stream with TXMLDocument in VCL

procedure TPPXMLDocument.GetXMLPPFromStream( XMLDocFileStream : Tstream );
var i  : integer;
    teststr : string;
begin
              XMLDocument:=TXMLDocument.Create(nil);
              XMLDocument.DOMVendor := GetDOMVendor('ADOM XML v4');
              teststr:=StreamToString(XMLDocFileStream);
              XMLDocument.LoadFromStream(XMLDocFileStream);
....


And intraweb version

procedure TPPXMLDocument.GetXMLPP( XMLstream : Tstream);
var i  : integer;
 
 
begin
              XMLDocument:=TXMLDocument.Create(IWServerController);
              XMLDocument.DOMVendor := GetDOMVendor('ADOM XML v4');
              *teststr*:=StreamToString(XMLstream);              
              XMLDocument.LoadFromStream(XMLstream);
...

in case of VCL teststr got value:

'4>˛'#0'4>˛'#0'rsion="1.0" encoding="utf-8"?> ....

in case of Intraweb teststr got value:
<?xml version="1.0" encoding="utf-8"?>...

Why do i get strange values at the beggining of XML document ?
I am really fustrated over this, why would this happen?

Edited by: Marko Ravnik on Oct 22, 2015 6:37 AM

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02