[V4RB] Does order in constructor make difference?

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Jan 24 20:51:41 CST 2004


on 1/24/04 8:03 PM, Christer Olsson at christer at ljusaideer.se wrote:

>>> I've spent the last five hours to hunt down a problem I've never seen
>>> before.
>>> We're adding two new tables ("Rabatter" and "Rabattrader") to our main app,
>>> and when we tried to add data to the new tables the app crashed every time
>>> on
>>> the second table.
>>> 
>>> It turned out that both tables were created just fine (i.e we could see and
>>> read them just fine with VAPP and ViSQL), but the baseObject for the second
>>> table ("Rabattrader"/"boRabattrader") had no fields...
>>> 
>>> After lot's of spellchecking, renamning and recreating of properties,
>>> methods
>>> and objects I just switched the order of the new tables in the database
>>> constructor - and suddenly everything worked just fine.
>>> 
>>> So, this didn't work:
>>> mInstallningar = new boInstallningar(self)
>>> mKunder = new boKunder(self)
>>> mArtiklar = new boArtiklar(self )
>>> mOrder = new boOrder(self)
>>> mOrderrader = new boOrderrader(self)
>>> mRabatter = new boRabatter(self)
>>> mRabattrader = new boRabattRader(self)
>>> 
>>> But this did:
>>> mInstallningar = new boInstallningar(self)
>>> mKunder = new boKunder(self)
>>> mArtiklar = new boArtiklar(self )
>>> mOrder = new boOrder(self)
>>> mOrderrader = new boOrderrader(self)
>>> mRabattrader = new boRabattRader(self)
>>> mRabatter = new boRabatter(self)
>>> 
>>> Any ideas?
>> 
>> Hi Christer,
>> 
>> Yes, order does mater. When you use classes.
>> It does not mater, if you simply use Vdatabase and SQL.
>> 
>> This is why it is danger go to VAPP, add few tables with many  fields,
>> Then jump to RB and write code.
>> 
>> Most probably in this case you will not get the same order.
>> 
>> This is why you need create db/tables programmatically.
> 
> Both db and tables are created in code. And "Rabatter" is created before
> "Rabattrader".
> 
> As order matters, please tell what rules to follow, as I can't find anything
> regariding this in the docs.

Aha, then you have other problem I think.

I have describe problem, when you in VAPP create tables,
Then try in code mirror that,

So you have change order of tables in code,
And now you can do db.create(), yes?
Before that it have crash?


Then I think in table boRabatter you have an ObjectPtr
Which points boRabattRader.
Therefore it must be AFTER you create boRabattRader object.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list