Subject | TiboQuery 10.3 Issue |
---|---|
Author | |
Post date | 2019-03-25T22:32:28Z |
I likely will need to upload the actual Embarcadero 10.3 Studio code for this one.
'Query' is a Tiboquery cut from Delphi 7 code compiled under 10.3. 'Query2' is newly inserted using ONLY 10.3. 'Query' will prepare through 'DB' and work properly under 10.3. 'Query2' will not prepare under 10.3. Other than the 'prepare' issue visually through the 10.3 Object Inspector, I have discerned no differences.
The DDL for the database is in a comment section of the code below. Clicking the 'Create Data' button will put 4 rows into the table 'Stuff', but that is not needed to obtain the failure of the TiboQuery to prepare. I am using ibo5_10_1_b2808_Source and Embarcadero 10.3 Studio.
[code]
unit Delete;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IB_Components, IB_Access, IBODataset,
Data.DB, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Query2: TIBOQuery;
DB: TIBODatabase;
Button2: TButton;
Query: TIBOQuery;
QueryNUMBER: TIntegerField;
QueryENTERED: TDateTimeField;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ DDL for table 'Stuff'
CREATE TABLE Stuff
(
NUMBER INTEGER NOT NULL,
ENTERED TIMESTAMP NOT NULL
);
}
procedure TForm1.Button2Click(Sender: TObject);
var Idx: integer;
TS: TDateTime;
begin
Query.Filtered := false;
Query.Open;
for Idx := 1 to 3 do
begin
Query.Append;
QueryNUMBER.Value := Idx;
QueryENTERED.Value := Now;
Query.Post;
end;
// Duplicate record
TS := QueryENTERED.Value;
Query.Append;
QueryNUMBER.Value := 3;
QueryENTERED.Value := TS;
Query.Post;
ShowMessage('Added 4 rows to table.');
end;
procedure TForm1.Button1Click(Sender: TObject);
var Last_Number: integer;
begin
Query.First;
Last_Number := 0;
while not Query.Eof do
begin
if QueryNUMBER.Value = Last_Number then
begin
ShowMessage('Deleting Duplicate #' + QueryNUMBER.AsString);
Query.Delete;
continue;
end;
ShowMessage('Deleting # ' + QueryNumber.AsString);
Query.Delete;
end;
end;
end.
[/code]
'Query' is a Tiboquery cut from Delphi 7 code compiled under 10.3. 'Query2' is newly inserted using ONLY 10.3. 'Query' will prepare through 'DB' and work properly under 10.3. 'Query2' will not prepare under 10.3. Other than the 'prepare' issue visually through the 10.3 Object Inspector, I have discerned no differences.
The DDL for the database is in a comment section of the code below. Clicking the 'Create Data' button will put 4 rows into the table 'Stuff', but that is not needed to obtain the failure of the TiboQuery to prepare. I am using ibo5_10_1_b2808_Source and Embarcadero 10.3 Studio.
[code]
unit Delete;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IB_Components, IB_Access, IBODataset,
Data.DB, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Query2: TIBOQuery;
DB: TIBODatabase;
Button2: TButton;
Query: TIBOQuery;
QueryNUMBER: TIntegerField;
QueryENTERED: TDateTimeField;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ DDL for table 'Stuff'
CREATE TABLE Stuff
(
NUMBER INTEGER NOT NULL,
ENTERED TIMESTAMP NOT NULL
);
}
procedure TForm1.Button2Click(Sender: TObject);
var Idx: integer;
TS: TDateTime;
begin
Query.Filtered := false;
Query.Open;
for Idx := 1 to 3 do
begin
Query.Append;
QueryNUMBER.Value := Idx;
QueryENTERED.Value := Now;
Query.Post;
end;
// Duplicate record
TS := QueryENTERED.Value;
Query.Append;
QueryNUMBER.Value := 3;
QueryENTERED.Value := TS;
Query.Post;
ShowMessage('Added 4 rows to table.');
end;
procedure TForm1.Button1Click(Sender: TObject);
var Last_Number: integer;
begin
Query.First;
Last_Number := 0;
while not Query.Eof do
begin
if QueryNUMBER.Value = Last_Number then
begin
ShowMessage('Deleting Duplicate #' + QueryNUMBER.AsString);
Query.Delete;
continue;
end;
ShowMessage('Deleting # ' + QueryNumber.AsString);
Query.Delete;
end;
end;
end.
[/code]