Table structure?

Joakim Schramm joakim at astrocalc.com
Sat Apr 29 23:06:12 CDT 2006


 

> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Ruslan Zasukhin
> Sent: 29 April 2006 21:30
> To: valentina at lists.macserve.net
> Subject: Re: Table structure?
> 
> On 4/29/06 9:56 PM, "Joakim Schramm" <joakim at astrocalc.com> wrote:
> 
> Hi Joakim, 
> 
>  
> So if needed you can send to us this file and VB project to 
> test here..
> 
Not yet, error gone so no reason and I can sure slim both my code and
structure probably.

> > I expet this to be more then the text files, as when 
> imoprting to my 
> > old db it takes 46Mb - 333 sounds rediculus much and the 
> import isn't even ready!
> 
> Show please your table structure.
> May be you use String[N] fields?
> 
Hard for me though to see what creates such big size in in structure, here
it is:

Private Sub CreateStructure()
Dim mTblCountry As VTable
Dim mTblPlaces As VTable
Dim mTblZones As VTable
Dim blink As VLink

Set mTblCountry = mDatabase.CreateTable(tblCountry + sLang)
mTblCountry.CreateVarCharField "CName", 1022, fIndexed
mTblCountry.CreateVarCharField "CID", 1022, fIndexed
'
Set mTblCountry = mDatabase.CreateTable(tblCountryAlias)
mTblCountry.CreateVarCharField "CName", 1022, fIndexed
mTblCountry.CreateVarCharField "CID", 1022, fIndexed
'
Set mTblPlaces = mDatabase.CreateTable(tblPlaces)
mTblPlaces.CreateVarCharField "PName", 1022, fIndexed
mTblPlaces.CreateByteField "LongDeg"
mTblPlaces.CreateByteField "LongMin"
mTblPlaces.CreateByteField "LongSec"
mTblPlaces.CreateShortField "LongSign" 
mTblPlaces.CreateByteField "LatDeg"
mTblPlaces.CreateByteField "LatMin"
mTblPlaces.CreateByteField "LatSec"
mTblPlaces.CreateShortField "LatSign" 
mTblPlaces.CreateVarCharField "FK_CID", 1022, fIndexed
mTblPlaces.CreateShortField "ZID"
'
Set mTblZones = mDatabase.CreateTable(tblZoneData)
mTblZones.CreateDateTimeField "DateChange", fIndexed
mTblZones.CreateVarCharField "ZoneDiff", 1022, fNone
mTblZones.CreateVarCharField "FK_CID", 1022, fIndexed
mTblZones.CreateShortField "FK_ZID", fIndexed
End Sub

> Also what size of EMPTY Valentina db, after you create your tables?
> 
1,43 Mb

> > code. I was able to open the db in Vstudio and noticed that nothing 
> > had gone inte to my zone table and probably I assign value 
> to DateTime 

Coding mistake of me, now data when in and db size went up :-) Dramatically
I would say.

I belive though when after setting Binary Links and removing unnecessary key
fields it will get smaller, would prefere though not to a have db larger the
50-75Mb, old one is 46Mb

> > field wrongly (Table.Field("DateTime").SetString "1999/10/04 
> > 13:23:00") but I couldn't find anywere in the docs about 
> how to format 
> > the string to add to this field.
> 
> 1) I believe exists API function to set numeric values into 
> DateTime fields.
You mean I can use .SetDate() and .SetTime with DateTime field? I suspect
this field contribute a lot to size. But the data there is now visible as I
added it but 8 byte?

> 
> 2) Format in the string can be controlled by YOU with help 
> db.DateTimeformat

I know, I have set format.

>  
> > Does VarChar fields affect size depending on maxsize aka 
> 1022, if only 
> > 3 or
> > 4 charcters is stored in field?
> 
> No, 
OK

> 
> On disk should be used 3-4 bytes PLUS at ULONG.
> 
> Note, for such small strings ( <= 8 bytes) it can be more 
> effective to use String[4]
> 
CreateStringField( "Name", 4) ?

Joakim
> 
> --
> Best regards,
> 
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
> 
> Valentina - Joining Worlds of Information http://www.paradigmasoft.com
> 
> [I feel the need: the need for speed]
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list