Subject How to store a string in Firebird which includes #0's in it?
Author Chuck Belanger
Hello:

I have been using a string of '0000's and '11111's to indicate access to
the underlying position in a database. I have been storing this string
of '000111' combinations by converting to a set of characters
representing each 8 "bits" of the actual 0s and 1s.

The problem I am facing is how to store those occasional strings that
look like this:

'ΓΌ@'#0'0'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0


It is not so much all the null characters after the '0', but that null
character between the '@' and the '0'. The above string is created and
stored in a string just as you see it, but how do I store it in Firebird
, preferably as-is in a table field?

I have tried rawbytestring but that truncates the string at the first #0
character, thus losing the information in the '0' (or some other
character) that follows.

I have not run across this issue before, but as my list of possible user
access groups grows, it is apparent that some users have 8 positions
without having access to any of the related groups, thus the #0 in the
string. And that would be OK, except that they do have access to some
group or groups after those 8 positions. Right now, the access code
truncates that part of the access code information because of the #0.

My only solution right now is to create a new table in a one:many
relation, such that I can have more than one record per Access code.
Each record would hold the characters up to the first #0 character
behind the character set. I would then store the number of #0 characters
that follow the string. That way I can iterate through the records and
reconstruct the original '0000's and '11111's string.

Any thoughts?

Thank you,

Chuck

I did post this on IBObject forum, too. I do use IBO for my database
access. I use Firebird 3.0 on WIndows, mainly desktop. I use NONE as my
default Character Set.



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus