[fpc-devel] "Invalid field size : 8"

Bogusław Brandys brandys at o2.pl
Thu Jan 10 19:46:55 CET 2008


Hello,

I'm trying to work with InstantObjects using Free Pascal but I 
encountered strange exception which is generated when I'm trying to 
retrieve persistent class from Firebird 2.0 database.

Below is and extended output of stack trace (I've also turned on dsdebug 
to watch all possible informations plus I;ve added a few lines to 
fields.inc).

As you can see problem is with setting TField.Size to 8 for ftInteger 
field , but I've also modified code to force Size of ftInteger to 4  and 
error still persisted.

I've found that exception is generated inside this method of fields.inc:

class procedure TField.CheckTypeSize(AValue: Longint);

begin
   If (AValue<>0) and Not IsBlob Then
     DatabaseErrorFmt(SInvalidFieldSize,[AValue]);
end;


questions:

Is that a bug inside fields.inc or just  a calling layer must prepare 
TFieldDef to avoid this exception ? Is that a known problem ?


Regards
Boguslaw Brandys


D:\projekty\instantobjects\svn_io\Demos\test1>flamenco
TLCLComponent.NewInstance WARNING: missing FWidgetSetClass TScreen
Before: INSERT INTO Contact (Address , CategoryClass, CategoryId , City 
, Name ,
  Phones , Class , Id , UpdateCount ) VALUES (:Address , :CategoryClass, 
:Categor
yId , :City , :Name , :Phones , :Class , :Id , :UpdateCount )
   Class: ftString = TContact
   Id: ftString = 8E41F46CE1991E459939352E950F7661
   UpdateCount: ftInteger = 1
   Address: ftMemo = <TAddress><City></City></TAddress>
   CategoryClass: ftString = TCategory
   CategoryId: ftString = CAT000
   City: ftString =
   Name: ftString = Testowy1
   Phones: ftMemo =
TInstantSQLResolver.InternalRetrieveMap Params.Count=0
TInstantSQLResolver.InternalRetrieveMap AObject.ClassName=TContact
Before: SELECT Address , CategoryClass, CategoryId , City , Name , 
Phones , Upda
teCount  FROM Contact WHERE Class = :Class AND Id = :Id
   Class: ftString = TContact
   Id: ftString = 8E41F46CE1991E459939352E950F7661
TFieldDef.Create : ADDRESS(1)
TFieldDef.Create : CATEGORYCLASS(2)
TFieldDef.Create : CATEGORYID(3)
TFieldDef.Create : CITY(4)
TFieldDef.Create : NAME(5)
TFieldDef.Create : PHONES(6)
TFieldDef.Create : UPDATECOUNT(7)
Creating fields
Count : 7
Def 0 : ADDRESS(1)
Def 1 : CATEGORYCLASS(2)
Def 2 : CATEGORYID(3)
Def 3 : CITY(4)
Def 4 : NAME(5)
Def 5 : PHONES(6)
Def 6 : UPDATECOUNT(7)
About to create fieldADDRESS
Creating field ADDRESS
1
2
3
4
5
6
7
8
FieldNo= 1
Field.Size= 8
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 1 Self : 1
Setting dataset
About to create fieldCATEGORYCLASS
Creating field CATEGORYCLASS
1
2
3
4
5
6
7
8
FieldNo= 2
Field.Size= 32
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 2 Self : 2
Setting dataset
About to create fieldCATEGORYID
Creating field CATEGORYID
1
2
3
4
5
6
7
8
FieldNo= 3
Field.Size= 32
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 3 Self : 3
Setting dataset
About to create fieldCITY
Creating field CITY
1
2
3
4
5
6
7
8
FieldNo= 4
Field.Size= 30
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 4 Self : 4
Setting dataset
About to create fieldNAME
Creating field NAME
1
2
3
4
5
6
7
8
FieldNo= 5
Field.Size= 50
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 5 Self : 5
Setting dataset
About to create fieldPHONES
Creating field PHONES
1
2
3
4
5
6
7
8
FieldNo= 6
Field.Size= 8
Attempt to SetFieldType
After SetFieldType
TFieldDef.CReateField : Trying to set dataset
TFieldDef.CReateField : Result Fieldno : 6 Self : 6
Setting dataset
About to create fieldUPDATECOUNT
Creating field UPDATECOUNT
1
2
3
SetBufListSize: -1
    Freeing buffers :1
    SetBufListSize: Final FBufferCount=0
TApplication.HandleException Error retrieving object 
TContact('8E41F46CE1991E459
939352E950F7661'): "Invalid field size : 8"
   Stack trace:
   $0050DBB1  TINSTANTOBJECTSTORE__RETRIEVEOBJECT,  line 7413 of 
D:/projekty/inst
antobjects/svn_io/Source/Core/InstantPersistence.pas
   $0050BDC3  TINSTANTOBJECT__RETRIEVE,  line 6614 of 
D:/projekty/instantobjects/
svn_io/Source/Core/InstantPersistence.pas
   $0041C165  TMAIN__TEST,  line 184 of mainunit.pas
   $0041BA94  TMAIN__BUTTON2CLICK,  line 58 of mainunit.pas
   $0047E394  TCONTROL__CLICK,  line 2024 of ./include/control.inc
   $0048CEDF  TBUTTONCONTROL__CLICK,  line 57 of ./include/buttoncontrol.inc
   $0048D495  TCUSTOMBUTTON__CLICK,  line 185 of ./include/buttons.inc
   $0048D931  TBUTTON__CLICK,  line 326 of ./include/buttons.inc
   $0048D64A  TCUSTOMBUTTON__WMDEFAULTCLICKED,  line 240 of 
./include/buttons.inc

   $004099B2
   $004759E2  TWINCONTROL__WNDPROC,  line 4696 of ./include/wincontrol.inc
   $004EDA2B  DELIVERMESSAGE,  line 614 of win32proc.pp
   $004D7C90  WINDOWPROC,  line 2310 of win32callback.inc
   $7E368734
   $7E368816
   $7E36B89B
   $7E36B903

D:\projekty\instantobjects\svn_io\Demos\test1>












More information about the fpc-devel mailing list