bah.odbc and Booleans
BlitzMax Forums/Brucey's Modules/bah.odbc and Booleans
| ||
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 |
| ||
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? |
| ||
As Homer Simpson would say "DOH !!!" To much copying and not enough modifying... Thanks |
| ||
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) :) |
| ||
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 |
| ||
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) |
| ||
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 |
| ||
In the Database mod docs, under TQueryRecord :-) |