[patch_done] ADO - SetParams->Reopen : failure!

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
User avatar
aperger
Expert Boarder
Expert Boarder
Posts: 129
Joined: 24.08.2005, 08:24
Location: Veszprém
Contact:

[patch_done] ADO - SetParams->Reopen : failure!

Post by aperger »

Hi All,

I did some test with ADO protocol under D2010 (with the latest 7.0 testing branch).

You can see my simple example bellow.

If cbWithANSIParams.Checked is false, we got one line from the DB.
If cbWithANSIParams.Checked is true, the first execution provides empty resultset. But what about with the second:
1. if I call the "qRiportokNevTipus.ParamCheck:=true;" (at the moment in the comment) the program provides one record from the database,
2. if not I got empty resultset.

So... I should call ParamCheck:=true to refresh the params...

Can somebody help me?

Attila

Code: Select all

unit UMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ZConnection,
  ZAbstractRODataset, ZAbstractDataset, ZDataset, ZAbstractTable, ADODB;

type
  TForm2 = class(TForm)
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Panel1: TPanel;
    btnOpen: TButton;
    cbWithANSIParams: TCheckBox;
    Connection: TZConnection;
    qRiportokNevTipus: TZQuery;
    procedure btnOpenClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.btnOpenClick(Sender: TObject);
var
  datum: TDate;
begin

	Connection.Protocol:='ado';
	Connection.Database:='Provider=SQLNCLI10.1;Integrated Security="";'
                      +'Persist Security Info=False;User ID=sslogin;'
                      +'Initial Catalog=SmartStorage;Data Source=PERGERLPTW7;'
                      +'Initial File Name="";Server SPN=""';
  Connection.Connected:=false;
  Connection.Connected:=true;

  if cbWithANSIParams.Checked then  // Switch for FALSE param
  begin
    qRiportokNevTipus.Active:=false;
    qRiportokNevTipus.ParamByName('NEV').AsString:='AAA';
    qRiportokNevTipus.ParamByName('TIPUS').AsInteger:=1;
    qRiportokNevTipus.Active:=true;
  end;

  //if qRiportokNevTipus.Active then begin
  qRiportokNevTipus.Active:=false;
  //** OOOOOHHHH --- ***
  //qRiportokNevTipus.ParamCheck:=true;
  // If I do not call this line I got empty resultset
  // if I call ParamCheck I got results???
  //end;
  qRiportokNevTipus.ParamByName('NEV').AsString:='Fordított adózás - egészre kerekít';
  qRiportokNevTipus.ParamByName('TIPUS').AsInteger:=1;
  qRiportokNevTipus.ParamByName('NEV').DataType:=ftWideString;
  qRiportokNevTipus.Active:=true;
end;

end.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Attila,

What's the query you are using? Does it contain colons ( : )?

Mark
Image
User avatar
aperger
Expert Boarder
Expert Boarder
Posts: 129
Joined: 24.08.2005, 08:24
Location: Veszprém
Contact:

Parameters

Post by aperger »

Hi,

YES! :-)


The database modul what I use for my tests it is part of my D7/ZeOS 6.6.x based solution:
http://pergersoft.hu/termekek/smartstorage

Code: Select all

SELECT
  FAZONOSITO,
  FRIPORT,
  FIDO,
  FUSER
FROM
  TRIPORTOK
WHERE
  FNEV = :NEV AND
  FTIPUS = :TIPUS
It is tested and working in production with potgresql, mysql, mssql and firebird databases.

Regards
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

If I understand correctly this is only failing for ADO?
Or is it failing in zeoslib 7 only where it worked before in version 6.6?

As far as I understand ParamCheck *should* be used whenever you query contains colons to indicate parameters, this makes the library change the parameters to the right symbols for interpretation by the database server.

Or did the application work before without Paramcheck=true?

Mark
Image
User avatar
aperger
Expert Boarder
Expert Boarder
Posts: 129
Joined: 24.08.2005, 08:24
Location: Veszprém
Contact:

Post by aperger »

Hi,

This failure is only ADO related and only in ZeOS version 7.

This sample code running without problem(==without paramcheck ) under Delphi 7 + ZeOS 6.6 + ADO.

I try to move my D7 + ZeOS 6.6 based product into D2010. I have problem only with ZeOS 7.
This is the reason why I try to solve lots of problem at the same time.
If I have time I try to send pacthes and BUG reports...
User avatar
aperger
Expert Boarder
Expert Boarder
Posts: 129
Joined: 24.08.2005, 08:24
Location: Veszprém
Contact:

Post by aperger »

Hi,

Here is my small PATCH to solve reopen problem with ADO (MSSQL/OLEDB).

Please take a look into.

Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Patch done. SVN rev 854.

Mark
Image
Locked