Using BLOBs in Stored Procedures through the BDE

By: Borland Staff

Abstract: Example using Blobs in Stored Procedures, then accessing them via BDE and Delphi

Problem:
Example using Blobs in Stored Procedures, then accessing them via BDE and Delphi

Solution:
Test case done with

 IB V5.0
 Delphi 3.0
 BDE 4.51

--------- IB CODE ----------

/* start procedure */
set term ^^;

create procedure t2_get_call_details_proc(call_no integer)
returns (customer_no integer, 
  phone_no varchar(20),
  ib_version char(20),
  os_version varchar(20), 
  problem blob sub_type text segment size 80,
  comment blob sub_type text segment size 100) 
as
begin

 begin
  for select customer_no,
       phone_no,
       gds_version,
       operating_sys_version,
       problem_description,
       comment
      from call_logs
      where call_log_no = :call_no
      into :customer_no, 
           :phone_no,
           :ib_version,
           :os_version, 
           :problem,
           :comment
  do 
  suspend;
 end

end^^
commit^^

set term ;^^
/* end procedure */

commit;

--------- DELPHI CODE ----------

procedure TfrmMain.cmdGetDetailsClick(Sender: TObject);
begin
  // Close details
  begin
    qyGetDataCallLog_2.Close;
    qyGetDataCallLog_2.UnPrepare;
  end;
  // Get Call Details
  begin
    db1.StartTransaction;
    qyGetDataCallLog_2.SQL.Clear;
    qyGetDataCallLog_2.SQL.Add
      ('select * from t2_get_call_details_proc(:call_no);');
    qyGetDataCallLog_2.Prepare;
    qyGetDataCallLog_2.Params[0].AsInteger := StrToInt(edtCall_No.Text);
    qyGetDataCallLog_2.Open;
    db1.Commit;
  end;
end;

Server Response from: ETNASC04