Page 1 of 1

Oracle / MSSQL Persistet field issue

Posted: Tue 23 Feb 2010 18:51
by rtm21us
Hello

I have issues with integer persistent fields accessing oracle / MSSQL Database

IDE: Delphi 7

ORACLE
Table Structure

CREATE TABLE TV_WORKLIST
(
WORKLIST_ID NUMBER(10),
ANALYST VARCHAR2(6 BYTE),
TASK_TYPE VARCHAR2(200 BYTE));

Persistent field added as

object qryGetExamWorklistWorklistID: TLargeintField
FieldName = 'WORKLIST_ID'
Required = True
end
object qryGetExamWorklistANALYST: TStringField
FieldName = 'ANALYST'
Size = 6
end
object qryGetExamWorklistTASK_TYPE: TStringField
FieldName = 'TASK_TYPE'
Size = 200
end

MSSQL
Table Structure

CREATE TABLE [dbo].[TV_WORKLIST](
[WORKLIST_ID] [int] NOT NULL,
[ANALYST] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TASK_TYPE] [varchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL);

Persistent field added as

object qryGetExamWorklistWORKLIST_ID: TIntegerField
FieldName = 'WORKLIST_ID'
Required = True
end
object qryGetExamWorklistANALYST: TStringField
FieldName = 'ANALYST'
Size = 6
end
object qryGetExamWorklistTASK_TYPE: TStringField
FieldName = 'TASK_TYPE'
Size = 200
End


So if you use oracle during design time it adds the field as TLargeintField and if you use MSSQL it adds as TIntegerField, during runtime it fails. Just to let you know we have one program that works for both Oracle and MSSQL.

Do you have any suggestion?

Thanks, Murugan

Posted: Wed 24 Feb 2010 15:17
by Dimon
To solve the problem set for Oracle the PrecisionInteger specific option of TUniConnection to 10 before creating fields in design time.
In run time you can use the code:

Code: Select all

UniConnection.SpecificOptions.Values['PrecisionInteger'] := '10';