View Issue Details

IDProjectCategoryView StatusLast Update
0013652FPCDatabasepublic2010-12-04 13:01
ReporterClaudio Romero Assigned ToJoost van der Sluis  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
Product Version2.2.4 
Summary0013652: TIBConnection show error in select numeric(10,5) fields
DescriptionFor example:

CREATE TABLE EJEMPLO(NUMERIC_10_5 Numeric(10,5));

With SQLQuery
select numeric_10_5 from ejemplo

show error:

Unknown field type : NUMERIC_10_5

Insert SQL works fine.
With Delphi5 and Flamerobin SELECT works fine.

Tested in
Windows Xp sp3
Firebird 2.1.1
Lazarus 0.9.26.3 fpc 2.2.4 (04/23/2009)

Thanks
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Mario Bonati

2009-05-05 06:54

reporter   ~0027314

I found this:
http://www.mail-archive.com/lazarus@lazarus.freepascal.org/msg02092.html

Hi, Mario

Felipe Monteiro de Carvalho

2010-07-21 09:15

developer   ~0039531

Please provide a compilable example with database if necessary

LacaK

2010-07-21 11:13

developer   ~0039550

Last edited: 2010-07-21 11:17

Problem is in fact, that procedure TIBConnection.TranslateFldType translates NUMERIC, DECIMAL datatypes with scale > 4 to ftFMTBcd, which is not implemented yet (see also http://bugs.freepascal.org/view.php?id=16924), so exception is raised in TFieldDef.CreateField(...)

Please look also at function TIBConnection.LoadField. There is BUG IMHO:
        ftBCD :
          begin
            case SQLDA^.SQLVar[x].SQLLen of
              2 : begin
                  Move(CurrBuff^, smalli, 2);
- c := longi*intpower(10,SQLDA^.SQLVar[x].SQLScale);
+ c := smalli*intpower(10,SQLDA^.SQLVar[x].SQLScale);
                  end;

Claudio Romero

2010-07-24 15:53

reporter   ~0039662

Last edited: 2010-07-24 15:56

Upload an example

Tested in
Windows Xp sp3
Firebird 2.1.3 / 2.1.4
Lazarus 0.9.29 fpc 2.3.1 svn 13383 and fpc 2.5.1 svn 15622.

Upload Firebird database example (parameters in p_13652.ini)
or SQL DDL

CREATE TABLE EJEMPLO
( NUMERIC_10_2 NUMERIC(10,2),NUMERIC_10_3 NUMERIC(10,3),NUMERIC_10_4 NUMERIC(10,4),
 NUMERIC_10_5 NUMERIC(10,5),CLAVE INTEGER NOT NULL, PRIMARY KEY (CLAVE));

Work with Firebird Server or Firebird Embedded
http://sourceforge.net/projects/firebird/files/firebird-win32/2.1.3-Release/Firebird-2.1.3.18185-0_Win32_embed.zip/download


But under fpc 2.5.1 svn 15622 with Firebird Embedded sometimes show an error
"unavaible database" in IBConnection.Open (I will do more test later about this)

With fpc 2.3.1 svn 13383 and Firebird Embedded connect fine.

As post Mario Bonati and Lacak2, Joost confirm this issue in

frepascal list.

>Re: [Lazarus] Trouble with TIBConnection and Numeric (N,6) fields.

>Joost van der Sluis
>Sun, 25 May 2008 06:19:59 -0700

>Op vrijdag 23-05-2008 om 11:17 uur [tijdzone +0200], schreef Gerard N/A:
>> Hi all,
>>
>> I've got a problem acessing a Firebird DB (2.0) with TIBConnection +
>> TSQLQuery.
>> I get 'Unkonwn field type <FieldName>' when opening querys wich do
>> selects to tables having NUMERIC fields with 6 decimals.
>>
>> Any idea on how to fix this?

>Yes, implement TFmtBCDField. At this moment, fpc doesn't support decimal
>fields with more then 4 decimals.

>Joost.

Regards

2010-07-24 15:53

 

pro13652.zip (44,918 bytes)

LacaK

2010-11-29 07:23

developer   ~0043699

Another off-topic code cleanup (sorry to report here, but I want not open separate bug report):

-databaseerror('Field type '+getenumname(typeinfo(tfieldtype),ord(FieldDef.DataType))+' not supported.');

+databaseerrorfmt(SUnknownFieldType, [Fieldtypenames[FieldDef.DataType], Self]);

Then we can get rid of typinfo in uses clause.

Joost van der Sluis

2010-12-04 13:00

manager   ~0043978

As I said a few times earlier, this is because of the missing fmt-support. More then 4 decimals is not possible in fpc. So I close this bug.
All other off-topic things in this report can be reported elsewhere, in the right location.

Issue History

Date Modified Username Field Change
2009-05-05 00:59 Claudio Romero New Issue
2009-05-05 00:59 Claudio Romero Status new => assigned
2009-05-05 00:59 Claudio Romero Assigned To => Joost van der Sluis
2009-05-05 06:54 Mario Bonati Note Added: 0027314
2010-07-21 09:15 Felipe Monteiro de Carvalho Note Added: 0039531
2010-07-21 09:15 Felipe Monteiro de Carvalho Status assigned => feedback
2010-07-21 11:13 LacaK Note Added: 0039550
2010-07-21 11:17 LacaK Note Edited: 0039550
2010-07-24 15:53 Claudio Romero Note Added: 0039662
2010-07-24 15:53 Claudio Romero File Added: pro13652.zip
2010-07-24 15:54 Claudio Romero Note Edited: 0039662
2010-07-24 15:56 Claudio Romero Note Edited: 0039662
2010-11-29 07:23 LacaK Note Added: 0043699
2010-12-04 13:00 Joost van der Sluis Note Added: 0043978
2010-12-04 13:01 Joost van der Sluis Status feedback => closed
2010-12-04 13:01 Joost van der Sluis Resolution open => duplicate