Subject | Field type for Binary Short Strings? |
---|---|
Author | Hugo |
Post date | 2003-08-07T07:30:08Z |
Hi everybody.
I need to create a table to save some device commands my app must know in
order to issue it to printer, cashdrawer, POS-display, etc.
I'm thinking about which kind of datatype I should define to store those
"sequence of codes" (say Binary Short Strings).
You know, typically commands ESC/P2 like:
27,112,0,100,250
27,64
or, to open a serial drawer:
0,0,0,0,0,0,0,0,0,0
It's to say, a concatenation of bytes, usually between 2 and 10 characters.
I want to avoid BLOB SUBTYPE 0, because Binary_LARGE_object it's not the
case, and BLOB field requires more management.
So, first, I've tryed:
CREATE TABLE POS_CODES(
ID SMALLINT NOT NULL PRIMARY KEY,
THE_COMMAND CHAR(10));
assigning field with ASCII_CHAR UDF:
UPDATE POS_CODES
SET THE_COMMAND=ASCII_CHAR(27)||ASCII_CHAR(64)
...
but I can't include the character 0 binary ! And sometimes I need it.
In fact, this SQL sentence:
UPDATE POS_CODES
SET
THE_COMMAND=ASCII_CHAR(77)||ASCII_CHAR(73)||ASCII_CHAR(0)||ASCII_CHAR(83)||A
SCII_CHAR(83);
stores THE_COMMAND='MISS'.
The ASCII_CHAR(0) it's ignored.
Which solution do you suggest?
Many thanks in advance,
Hugo.
I need to create a table to save some device commands my app must know in
order to issue it to printer, cashdrawer, POS-display, etc.
I'm thinking about which kind of datatype I should define to store those
"sequence of codes" (say Binary Short Strings).
You know, typically commands ESC/P2 like:
27,112,0,100,250
27,64
or, to open a serial drawer:
0,0,0,0,0,0,0,0,0,0
It's to say, a concatenation of bytes, usually between 2 and 10 characters.
I want to avoid BLOB SUBTYPE 0, because Binary_LARGE_object it's not the
case, and BLOB field requires more management.
So, first, I've tryed:
CREATE TABLE POS_CODES(
ID SMALLINT NOT NULL PRIMARY KEY,
THE_COMMAND CHAR(10));
assigning field with ASCII_CHAR UDF:
UPDATE POS_CODES
SET THE_COMMAND=ASCII_CHAR(27)||ASCII_CHAR(64)
...
but I can't include the character 0 binary ! And sometimes I need it.
In fact, this SQL sentence:
UPDATE POS_CODES
SET
THE_COMMAND=ASCII_CHAR(77)||ASCII_CHAR(73)||ASCII_CHAR(0)||ASCII_CHAR(83)||A
SCII_CHAR(83);
stores THE_COMMAND='MISS'.
The ASCII_CHAR(0) it's ignored.
Which solution do you suggest?
Many thanks in advance,
Hugo.