IZPreparedStatement with Blob

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

IZPreparedStatement with Blob

Post by DPStano »

i have FILE_STORE external function in FB defined as

Code: Select all

DECLARE EXTERNAL FUNCTION FILE_STORE
    BLOB,
    VARCHAR(300) BY DESCRIPTOR
RETURNS 
	INTEGER BY VALUE
ENTRY_POINT 'file_store' MODULE_NAME 'storage';
i can call it with TZQuery without problems

Code: Select all

  var Query := TZQuery.Create(nil);
    Query.Connection := FConnection;
    Query.SQL.Text := Format('SELECT FILE_STORE(:blob,''%s'') FROM rdb$database', [FileName]);
    Query.ParamByName('blob').LoadFromStream(Stream, ftBlob);
    Query.Open;
    var Error := Query.Fields[0].AsInteger;
but i cant make same call with just IZPreparedStatement (it will not call external function, i have attached VS debugger)

Code: Select all

  var Sql := Format('SELECT FILE_STORE(?, ''%s'') FROM rdb$database', [FileName]);

    Stmt := FConnection.DbcConnection.PrepareStatement(Sql);
    Stream.Position := 0;
    Stmt.SetBlob(1, stBinaryStream, TZAbstractBlob.CreateWithStream(Stream));
//    Stmt.SetBinaryStream(1, Stream); // not working as well

//    Stmt.SetResultSetConcurrency(rcUpdatable); // will make AV 
//    Stmt.SetFetchDirection(fdForward);
//    Stmt.SetResultSetType(rtScrollInsensitive);

    Rs := Stmt.ExecuteQueryPrepared;
    var Error := Rs.GetInt(1);
anybody could know what wrong, there is no documentation and i have spend like days trying to solve it :////
DPStano
Junior Boarder
Junior Boarder
Posts: 39
Joined: 16.05.2016, 09:21

Re: IZPreparedStatement with Blob

Post by DPStano »

[solved] ResultSet.Next was missing :'(
Post Reply