bah.odbc and Booleans

BlitzMax Forums/Brucey's Modules/bah.odbc and Booleans

Glenn Dodd(Posted 2008) [#1]
Field VolumeActivity:Int
Field FrequencyUpdateable:Int
Field SpecialAllowance:Int

These are all Booleans in the database.
The queryrecordset shows the correct values of 0 or 1 (1,0,0 respectively)
but once i put them in the Activity type they all show 1.

I scanned the dbodbc.bmx file and found the valid types of value (int, float, double, string etc).
There is nothing for Boolean but i think BMax doesn't have a boolean type either.

Any idea what is wrong with my code below?

Cheer
Glenn





DavidDC(Posted 2008) [#2]
It looks like you are loading the same database value into many different Type fields? record.value(6) sure gets a workout. But perhaps this is intentional?


Glenn Dodd(Posted 2008) [#3]
As Homer Simpson would say "DOH !!!"
To much copying and not enough modifying...

Thanks


GfK(Posted 2008) [#4]
Just to clarify - Blitzmax doesn't have a Boolean type as such. You'd use a Byte.

(You could obviously store up to 8 "booleans" in a single byte, if you were feeling particularly creative) :)


Glenn Dodd(Posted 2008) [#5]
Next Question:
This is what I had above and it works.



now i am trying to put the database reads into types. I would end up with the base type of TDatabaseTables and an extended type for each table. Currently i am only getting tblActivity.

What I have is this:



I am not calling the actual opening of the database (db) but i don't know where or how to do this.
And no doubt there is much that needs to be fixed here to get it working...

Cheers
Glenn


Brucey(Posted 2008) [#6]
That's not compiling, is it? :-)

All your normal code, needs to be in a Function/Method in your types, for starters.

You might change the base type to something like :

perhaps calling Init() from your Create() in the sub-type :
Activity.Init()

You may also want to test that the db isOpen().

Also, if you want to get rid of some of the "noise", you can use these convenience methods from the query record :
Activity.ActivityID = record.GetInt(0)



Glenn Dodd(Posted 2008) [#7]
Thanks Bruce,
I knew in my mind what i needed to do but couldn't turn it into blitz code.

I assume if i looked harder i would find the "convenience" methods inside dbodbc.bmx?

Cheers


Brucey(Posted 2008) [#8]
In the Database mod docs, under TQueryRecord :-)