V4RB - VTable class constructor oddities

Ernesto Giannotta ernestogiannotta at tiscalinet.it
Sat Aug 22 12:13:18 CDT 2009


Hi Ruslan,

I discovered something very strange.

If you use the class way to build and open a DB you must NOT call the  
designated super constructor of a VTable.

If you do so (see it in the Table_Create example) you get 1 empty  
extra table in your DB for every Super.Constructor call in a VTable  
subclass Constructor method.

Sub Constructor()
   // Calling the overridden superclass constructor.
   Super.Constructor( "Person " )

   mfFirstName = new VString( "fldFirstName", 40 )
   mfLastName = new VVarChar( "fldLastName", 2000  )
   mfBornDate = new VDate( "fldBornDate" )

End Sub

if you do so you get 2 Tables in the DB
1 called Person with all the correct fields
and 1 empty called table_3

to make it work correctly you must do;

Sub Constructor()
   // DON'T CALL the overridden superclass constructor.
   //Super.Constructor( "Person " )

   self.Name = "Person"  // set the name here!

   mfFirstName = new VString( "fldFirstName", 40 )
   mfLastName = new VVarChar( "fldLastName", 2000  )
   mfBornDate = new VDate( "fldBornDate" )

End Sub


It looks like a bug, doesn't it?




Cool Runnings,
Erne.



More information about the Valentina mailing list