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);