dbTalk Databases Forums  

using a set of boolean options as a bitmap

comp.databases.sybase comp.databases.sybase


Discuss using a set of boolean options as a bitmap in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lena
 
Posts: n/a

Default using a set of boolean options as a bitmap - 07-28-2004 , 02:25 AM






hi all,

where can i read about using a set of boolean options as a bitmap?
any explanations are more than appreciated.

Reply With Quote
  #2  
Old   
Rob Verschoor
 
Posts: n/a

Default Re: using a set of boolean options as a bitmap - 07-28-2004 , 04:34 AM






"Lena" <lena (AT) tippcom (DOT) co.il> wrote

Quote:
hi all,

where can i read about using a set of boolean options as a bitmap?
any explanations are more than appreciated.

It's pretty simple -- just use an int column or variable (or smallint or
tinyint), and code like this:

select @v = @v | 1 -- sets bit 0
select @v = @v | 2 -- sets bit 1

if @v & 1 = 0 ... -- bit 0 is not set
if @v & 1 = 1 ... -- bit 0 is set

(etc.)


HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5

Author of various Sybase books. New book (coming soon): "The
Complete Sybase Replication Server Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop

mailto:rob (AT) YOUR (DOT) SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.