Page 1 of 1

Post MyTable Integer problem ?

Posted: Fri 10 Oct 2008 10:21
by przos
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 ------------------------------------------------

Posted: Mon 13 Oct 2008 06:52
by Challenger
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.

Posted: Mon 13 Oct 2008 13:18
by przos
Thank's so much.
It's solution of my problems.