Page 1 of 1

Parameters in update doesn't work

Posted: 16.10.2021, 12:17
by piotr.b.brzeski
Hi,

I have written a project that moves data from one ORACLE database to another. One of the main functions of this project is to transfer the printouts that are in the database in the BLOB column. For a long time, everything worked flawlessly, but after migrating to the latest version of Lazarus, the content of the printouts is reported via TSQL.Params is empty. Below is the code that worked fine until upgraded to the newer version. What's wrong now? As if the parameters stop working?

Code: Select all

  
                                   // wpompowanie wzorca itp z buff
                                   begin
             		             MenuGlowne.ZQueryTEST.ParamCheck:= true;

             		             ImportWdwz.ImpWdwzBufDataSet.CreateDataset;
             		             ImportWdwz.ImpWdwzBufDataSet.Edit;
             		             ImportWdwz.ImpWdwzBufDataSet.FieldByName('wydrWDWZ').AsVariant:= wydrWDWZ;
             		             ImportWdwz.ImpWdwzBufDataSet.Post;

             		             MenuGlowne.ZQueryTEST.SQL.Text:= 'begin update wdwz set wydr = :WYDRWDWZ, opis = :OPISWDWZ, opsz = :OPSZWDWZ where id = '+seqWDWZ+'; end;'+#0;
                                     aktualnySQL:= MenuGlowne.ZQueryTEST.SQL.Text;
             		             MenuGlowne.ZQueryTEST.Params[0].LoadFromStream(ImportWdwz.ImpWdwzBufDataSet.CreateBlobStream(ImportWdwz.ImpWdwzBufDataSet.FieldByName('wydrWDWZ'), bmRead), ftBlob);
             		             MenuGlowne.ZQueryTEST.Params.ParamByName('OPISWDWZ').Value:= opisWDWZ;
             		             MenuGlowne.ZQueryTEST.Params.ParamByName('OPSZWDWZ').Value:= opszWDWZ;
             		             MenuGlowne.ZQueryTEST.ExecSQL;

             		             ImportWdwz.ImpWdwzBufDataSet.Active:= false;

             		             MenuGlowne.ZQueryTEST.ParamCheck:= false;
                                   end;
 
changes are obviously committed correctly

(I have ZEOS 8.0.0 beta, but in 7.2.14 problem is the same)

Re: Parameters in update doesn't work

Posted: 16.10.2021, 12:21
by piotr.b.brzeski
To be clear, in all steps the parameter has the content, but after the update is completed and the database is entered from other applications (even SQLDeveloper, etc.), it turns out that the content of the BLOB column is empty.

Re: Parameters in update doesn't work

Posted: 16.10.2021, 21:50
by marsupilami
Hello piotr,

some questions:
  • Did the FPC version change between tests? Are you sure that the only thing that changed is Lazarus?
  • Are you sure, this isn't a problem on the TBufDataset side?
  • Could you please try to provide a complete test case? Like an short sql script that generates necessary tables and date and a small program that demonstrates the problem?
Best regards,

Jan

Re: Parameters in update doesn't work

Posted: 17.10.2021, 08:41
by piotr.b.brzeski
Did the FPC version change between tests?
Yes.
Are you sure that the only thing that changed is Lazarus?
Yes. Lazarus and version of ZEOS.
Are you sure, this isn't a problem on the TBufDataset side?
Yes.

----

I checked on the database side - parameters in v$parameters for these SQL are empty. I am talking of course about the ORACLE database

Re: Parameters in update doesn't work

Posted: 17.10.2021, 22:10
by marsupilami
Hello Piotr,

could you please try to create a small example program and SQL create table script that demonstrates the problem? This will help greatly in tracking things down.

Best regards,

Jan

Re: Parameters in update doesn't work

Posted: 04.11.2021, 11:30
by piotr.b.brzeski
Hello,
create table test_blob(
blob_column blob
);

insert into test_blob(blob_column) values(EMPTY_BLOB());
a sample program in the appendix.