himik has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks. I have some difficulties so i call on you.
So i have at about 100 checkboxes. And every one is different extra for a car ( ABS,ASR,ESP and the list goes on .... until 64 for now, but it will be bigger then 100 ).
So what have i done for now. Every extra abs has decimal number like abs is 1, ASR is 2, ESP is 3 .... This numbers represent the n-th bit of the number of all extras.
explanation if ABS is checked i put 1 only in the field extri on the data base if ABS, ASP are checked i put 3 on my data base. if ABS, ASP, ESP are checked i put 7 on my data base.
so 7 is 0b111? right? And this is my flags for all the extras.
if i have 3 on my field extri then i know (0b11) the first bit and the second one is up then i know that this extras are ABS ASP
Here is the problem
My field extras is big int and it is 64 bits long .... that means i have only 64 extras. so i start to look for solution and i'm thinking for bit var.
but ..... is this the best way to make that?
could you tell me some other solution that is better for the DB, because with this way my searching is so easy just put where clause with
select * from table where (table.extri & b'$extribin_perl')=b'$extribiin_perl'
i do not use any joins
Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Check boxes
by BrowserUk (Patriarch) on May 28, 2012 at 17:35 UTC | |
|
Re: Check boxes
by mbethke (Hermit) on May 28, 2012 at 17:18 UTC | |
by bitingduck (Deacon) on May 29, 2012 at 05:50 UTC | |
by mbethke (Hermit) on May 29, 2012 at 06:15 UTC | |
|
Re: <strike>Check boxes</strike> SQL Boolean arrays
by NetWallah (Canon) on May 28, 2012 at 17:27 UTC | |
|
Re: Check boxes
by flexvault (Monsignor) on May 28, 2012 at 17:53 UTC |