IZPreparedStatement with Blob
Posted: 11.11.2020, 12:25
i have FILE_STORE external function in FB defined as
i can call it with TZQuery without problems
but i cant make same call with just IZPreparedStatement (it will not call external function, i have attached VS debugger)
anybody could know what wrong, there is no documentation and i have spend like days trying to solve it :////
Code: Select all
DECLARE EXTERNAL FUNCTION FILE_STORE
BLOB,
VARCHAR(300) BY DESCRIPTOR
RETURNS
INTEGER BY VALUE
ENTRY_POINT 'file_store' MODULE_NAME 'storage';
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;
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);