Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-09

"Invalid field size" when using UIB with fpc 2.3.1

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lukas Gradl

Hi!

Just had to upgrade to fpc 2.3.1 for some reason.
But using fpc 2.3.1 UIB produces an "Invalid field size" error when trying to open a UIBDataset.

The same program works when using fpc 2.2.3.

For demonstrating the problem I created the following program:

When trying to open an UIBDataset I get an error: "EDatabaseError : Invalid field size : 4828"
Failes with: FPC 2.3.1 svn, UIB latest svn, Firebird 2.0, OS Ubuntu 8.04 Works with: FPC 2.2.3, UIB latest svn, Firebird 2.0, OS Ubuntu 8.04

program Project1;
{$mode Delphi}{$H+}
uses
   Classes, SysUtils, UIB, UIBLib, UIBDataset;
var IDB: TUIBDataBase;
     ITrans: TUIBTransaction;
     IQuery: TUIBDataSet;
begin
   IDB:=TUIBDataBase.Create(nil);
   ITrans:=TUIBTransaction.Create(nil);
   IQuery:=TUIBDataSet.Create(nil);
   IDB.DatabaseName:='DB.fdb';
   IDB.CharacterSet:=csISO8859_1;
   IDB.LibraryName:='libfbclient.so';
   IDB.UserName:='User';
   IDB.PassWord:='Pass';
   ITrans.DataBase:=IDB;
   ITrans.AutoStart:=false;
   ITrans.AutoStop:=false;
   IDB.Connected:=True;
   ITrans.StartTransaction;
   IQuery.DataBase:=IDB;
   IQuery.Transaction:=ITrans;
   IQuery.SQL.Text:='SELECT "DocID" FROM "Docs";';
   try
     IQuery.Open;
   finally
     if IQuery.Active then IQuery.Close;
     if ITrans.InTransaction then ITrans.RollBack;
     IDB.Connected:=False;
   end;
end.

Database-DDL:

CREATE DOMAIN "dm_Key" AS Integer
DEFAULT 0
NOT NULL
CHECK (VALUE>=0)
;
CREATE DOMAIN "dm_TypID" AS Smallint
DEFAULT 0
NOT NULL
;

CREATE TABLE "Docs"(
"DocID" "dm_Key" DEFAULT 0,
"DocType" "dm_TypID" DEFAULT 0,
PRIMARY KEY ("DocID")
);

anyone an idea how to proceed? Is this a bug somewhere? In UIB? In fpc? In my code?

Regards
Lukas

-------------------------- software security networks Lukas Gradl <fpc#ssn.at> Eduard-Bodem-Gasse 9 A - 6020 Innsbruck Tel: +43-512-214040-0 Fax: +43-512-214040-21 --------------------------

Reply by email

Joost van der Sluis
to Lukas Gradl

Op maandag 08-09-2008 om 16:13 uur [tijdzone +0200], schreef Lukas Gradl:

Just had to upgrade to fpc 2.3.1 for some reason. But using fpc 2.3.1 UIB produces an "Invalid field size" error when trying to open a UIBDataset.

It's a bug in UIB. But it's a bug that most TDataset-descendents suffer from. That's because the bug is hidden in Delphi. It is also hidden in fpc's released versions, because it causes too much trouble. But this "bug" does pop-ups in the development version. Until all TDataset-descendents I know of have fixed it, it will be hidden in released versions, though.

Show quoted text 6 lines
The same program works when using fpc 2.2.3. For demonstrating the problem I created the following program: When trying to open an UIBDataset I get an error: "EDatabaseError : Invalid field size : 4828"

Which is true, 4828 is an invalid field-size for an integer-field. I guess that UIB doesn't set the field-size properly. In fact, the 'field-size' property should contain the amount of decimals in this case. So the field-size should be set to 0.

Maybe you can look it up in UIB where it's set?

Joost

Reply by email

Lukas Gradl
to Joost van der Sluis

Joost,

Thanks for your help.
I could find the problem in uibdataset.pas and fix it. Already sent a Bugreport and a fix to the UIB-Forum.

Thanks
Lukas

Show quoted text 33 lines
Op maandag 08-09-2008 om 16:13 uur [tijdzone +0200], schreef Lukas Gradl: > Just had to upgrade to fpc 2.3.1 for some reason. > But using fpc 2.3.1 UIB produces an "Invalid field size" error when > trying to open a UIBDataset. It's a bug in UIB. But it's a bug that most TDataset-descendents suffer from. That's because the bug is hidden in Delphi. It is also hidden in fpc's released versions, because it causes too much trouble. But this "bug" does pop-ups in the development version. Until all TDataset-descendents I know of have fixed it, it will be hidden in released versions, though. > The same program works when using fpc 2.2.3. > > For demonstrating the problem I created the following program: > > When trying to open an UIBDataset I get an error: "EDatabaseError : > Invalid field size : 4828" Which is true, 4828 is an invalid field-size for an integer-field. I guess that UIB doesn't set the field-size properly. In fact, the 'field-size' property should contain the amount of decimals in this case. So the field-size should be set to 0. Maybe you can look it up in UIB where it's set? Joost _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------------------- software security networks Lukas Gradl <fpc#ssn.at> Eduard-Bodem-Gasse 9 A - 6020 Innsbruck Tel: +43-512-214040-0 Fax: +43-512-214040-21 --------------------------

Reply by email