Post MyTable Integer problem ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
przos
Posts: 4
Joined: Thu 28 Aug 2008 13:45

Post MyTable Integer problem ?

Post by przos » Fri 10 Oct 2008 10:21

Hello,
I don't understand why realization of Post MySQL procedure is not valid on Integer fileds.
It is not equal to AppendRecord (correct)
See bellow examples:

------ My SQL, My Dac parameters ---------------------
MySQL server version: 5.0.51b-community-nt
MySQL client version: Direct

Data Access Components for MySQL
Standard Edition
Version 5.55.0.37 for Delhi 6
end-- My SQL, My Dac parameters ----------------------

------ Table Script -----------------------------------------
CREATE TABLE `test`.`PostTest` (
`Id` INTEGER(4) UNSIGNED NOT NULL AUTO_INCREMENT,
`Pos` INTEGER(4) UNSIGNED,
`Name` VARCHAR(45),
‘ValFloat’ Float,
PRIMARY KEY (`Id`)
)
ENGINE = InnoDB;
end-- Table Script -------------------------------------------


----- Delhi examples code-------------------------------------

ZE: TMyTable;

Example 1: Result in database table: correct - exactly the same value
procedure TForm1.Button1(Sender: TObject);
begin
ZE.AppendRecord([10,1,'Test',12.34]);
end;

Example 2: Result in database table: not correct
procedure TForm1.Button2(Sender: TObject);
ZE.Append;
Ze.Fields[0].Value:=10;
Ze.Fields[1].Value:=1;
Ze.Fields[2].Value:='Test';
Ze.Fields[3].Value:= 12.34;
ZE.Post;
end;
‘Id’ – value from Auto Increment table parametr.
‘Pos’ – null
‘Test’ – ‘Test’ – correct
‘ValFloat’ - .12.34 - correct
end-- Delhi examples code ------------------------------------------------

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Mon 13 Oct 2008 06:52

The Pos column is mapped on TLargeIntField. You cannot access these fields through the Value property. For details please see the TLargeintField.SetVarValue method in db.pas.

przos
Posts: 4
Joined: Thu 28 Aug 2008 13:45

Post by przos » Mon 13 Oct 2008 13:18

Thank's so much.
It's solution of my problems.

Post Reply