Subject | Re: Non - printable characters in Stored Procedures |
---|---|
Author | peter_jacobi.rm |
Post date | 2003-11-05T07:55:52Z |
Hi Tim,
--- Tim Ledgerwood <tim@s...> wrote:
good idea to make CRLF a default value for col EOL?
There are about three methods to insert control characters:
1. Fetch them from a table. Make either a table of
often used special strings or simply a mapping smallint->controlchar.
This option sounds somewhat silly, as you now have the task of
inserting the control characters into this special table,
so you must use another method in addition. But nevertheless this
is a way to make the actual use of the control chars less ugly.
2. Use a UDF which maps ints to control chars
3. Use a character which has an escaping mechanism. For a
working example see the LIKEJAVA character set in
http://groups.yahoo.com/group/Firebird-Architect/files/charsets_and_collations/
Download pjcolkit_ver_0_2 and read the readme.
insert into mytable values ("Foo", _LIKEJAVA"\U000d\U000a");
If you are working with database default character set NONE
(which I as one consider a cardinal sin), automatic charset
conversion won't kick in, so you must add an "as ... charset ASCII".
Regards,
Peter Jacobi
--- Tim Ledgerwood <tim@s...> wrote:
> How would I write a query or a stored procedure to insert non -printable
> characters in a table?(Ascii 13
>
> For example, say I had a table defined as follows :
>
> CREATE TABLE MYTABLE
> (
> MYNAME CHAR(32),
> EOL CHAR(2)
> )
>
> How would I write a trigger or stored procedure to insert a CRLF
> Ascii 10) into the EOL field?Guessing from your col name, it would be perhaps a
good idea to make CRLF a default value for col EOL?
There are about three methods to insert control characters:
1. Fetch them from a table. Make either a table of
often used special strings or simply a mapping smallint->controlchar.
This option sounds somewhat silly, as you now have the task of
inserting the control characters into this special table,
so you must use another method in addition. But nevertheless this
is a way to make the actual use of the control chars less ugly.
2. Use a UDF which maps ints to control chars
3. Use a character which has an escaping mechanism. For a
working example see the LIKEJAVA character set in
http://groups.yahoo.com/group/Firebird-Architect/files/charsets_and_collations/
Download pjcolkit_ver_0_2 and read the readme.
insert into mytable values ("Foo", _LIKEJAVA"\U000d\U000a");
If you are working with database default character set NONE
(which I as one consider a cardinal sin), automatic charset
conversion won't kick in, so you must add an "as ... charset ASCII".
Regards,
Peter Jacobi