[fpc-pascal] UIB on Linux X86_64
Lukas Gradl
lazarus at ssn.at
Thu Sep 11 11:15:06 CEST 2008
Solved the problem:
Its in uiblib.pas and uibase.pas:
{$IFNDEF CPU64}
{$ALIGN ON}
{$MINENUMSIZE 4}
{$ENDIF}
The MINENUMSIZE should be set always and not only for non-64bit CPUs as
the source is compiled using {$mode delphi} - MINENUMSIZE is 1 by
default for delphi.
So it should read:
{$IFNDEF CPU64}
{$ALIGN ON}
{$ENDIF}
{$MINENUMSIZE 4}
Regards
Lukas
(already posted to the UIB-Forum, just for information here...)
Lukas Gradl schrieb:
> Another problem occured:
>
> When using UIB with fpc on X86_64 field values are always empty (for
> strings) or 0 (for integers).
>
> For demonstrating the problem I created the following program:
> Failes with: FPC 2.3.1 svn, UIB latest svn, Firebird 2.0, OS Ubuntu 8.04
> X86_64
> OK with: FPC 2.3.1 svn, UIB latest svn, Firebird 2.0, OS Ubuntu 8.04 i386
>
>
>
> 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","DocName" FROM "Docs";';
> try
> IQuery.Open;
> IQuery.First;
> while not IQuery.EOF do begin
> Writeln('Line found:'+IQuery.Fields[0].AsString+'
> '+IQuery.Fields[1].AsString);
> IQuery.Next;
> end;
> finally
> if IQuery.Active then IQuery.Close;
> if ITrans.InTransaction then ITrans.RollBack;
> IDB.Connected:=False;
> end;
> end.
>
>
> The DB-definition in Firebird 2.0 is as follows:
>
> CREATE DOMAIN "dm_Key" AS Integer
> DEFAULT 0
> NOT NULL
> CHECK (VALUE>=0)
> ;
> CREATE DOMAIN "dm_TypID" AS Smallint
> DEFAULT 0
> NOT NULL
> ;
> CREATE DOMAIN "dm_Text" AS
> VARCHAR(80) CHARACTER SET ISO8859_1
> DEFAULT ''
> COLLATE DE_DE
> ;
>
> CREATE TABLE "Docs"(
> "DocID" "dm_Key" DEFAULT 0,
> "DocType" "dm_TypID" DEFAULT 0,
> "DocName" "dm_Text",
> PRIMARY KEY ("DocID")
> );
>
> INSERT INTO "Docs" ("DocID","DocType","DocName") VALUES
> (1,2,'DocNameTest');
>
>
> When executed the output should be:
>
> Line found: 1 DocNameTest
>
>
> but instead you will get:
>
> Line found: 0
>
>
> Anyone an idea how to proceed?
>
> regards
> Lukas
>
--
----------------------------
software security networks
Lukas Gradl <lazarus#ssn.at>
Eduard-Bodem-Gasse 9
A - 6020 Innsbruck
Tel: +43-512-214040-0
Fax: +43-512-214040-21
----------------------------
More information about the fpc-pascal
mailing list