Questions tagged [bit-manipulation]

9 questions
7
votes
2 answers

Hex and Binary Literals in MySQL / MariaDB?

Another question I have pertains to just the & over string types. This question is over the binary-string literals as constructed with B'' or X''. MariaDB supports binary and hex literals, SELECT X'01', B'00000001', X'01' = B'00000001'; | X'01' |…
Evan Carroll
  • 65,432
  • 50
  • 254
  • 507
2
votes
2 answers

Bit column vs relationships?

Two examples: Table users, each user may have or not have some of ~10 possible permissions (like "can login, can post, can edit, can delete" etc). Table articles, each article may have or not have some of ~10 possible attributes (like "for…
1
vote
1 answer

How to manipulate an unicode string with bitwise operators?

I wish to encrypt an Unicode string by using bitwise operators from my client (Dart) app, and send it to my PostgreSQL server where a function will decrypt it by using bitwise operators. But I don't find any info to respect, is it possible? NOTE:…
1
vote
1 answer

Posgres Row Security Policy - Why Array faster than Bitstring?

I have a question: I have two row security policies to restrict the access to a table. The first policy uses an Array-Column "rights". The "rights" column is type 16-bit bit/integer array and each user is assigned an index. If the array has the…
1
vote
1 answer

Using a 512 bit binary column as a bit field

I'm designing a table to keep track of a value that has to represent the on-off setting of several hundred states. I would expand this to 512, to give room for future growth and be a power of two. So I want a 64 byte = 512 bit column. My problem is…
0
votes
1 answer

Can someone help me with the SQL Server syntax for the my Oracle query

Oracle version: CREATE OR replace PROCEDURE Item_reco_recordset (p_depositid IN NUMBER, p_b1 IN NUMBER, p_itemset OUT SYS_REFCURSOR)…
0
votes
0 answers

PostgreSQL: double to bit conversion

I need bit(64) representation of current epoch (the operations I need should be much easier in bits), so SELECT extract('epoch' from CURRENT_TIMESTAMP)::bit(64) But this gives me ERROR: cannot cast type double precision to bit What am I doing…
Ximik
  • 155
  • 1
  • 9
0
votes
1 answer

PostgreSQL extending a variable-width bit string type?

PostgreSQL supports Bit Strings, SELECT B'01010101', B'01010101', '01010101'::bit(8), X'CC'; ?column? | ?column? | bit | ?column? ----------+----------+----------+---------- 01010101 | 01010101 | 01010101 | 11001100 SELECT…
Evan Carroll
  • 65,432
  • 50
  • 254
  • 507
0
votes
1 answer

MariaDB are bitwise operators defined on strings?

Is the behavior of BITAND, (bitwise and) defined in MariaDB over strings? SELECT '0011' & '0011', 'ff' & 'ff', 'yy' & 'YY', '5' & '5'; +-----------------+-------------+-------------+-----------+ | '0011' & '0011' | 'ff' & 'ff' | 'yy' & 'YY' | '5' &…
Evan Carroll
  • 65,432
  • 50
  • 254
  • 507