8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-28 02:43:03 +01:00
firebird-mirror/src/misc/intl.sql

77 lines
1.4 KiB
MySQL
Raw Normal View History

2005-07-05 17:25:27 +02:00
/***
*
* Usage example
* -------------
*
* input 'intl.sql';
*
* execute procedure sp_register_character_set ('CHARSET_NAME', 1);
* commit;
*
* execute procedure sp_unregister_character_set ('CHARSET_NAME');
* commit;
*
*/
set term !;
create or alter procedure sp_register_character_set
(
name char(31) character set unicode_fss,
max_bytes_per_character smallint
)
as
declare variable id smallint;
declare variable temp_id smallint;
begin
name = upper(name);
id = 255;
for select rdb$character_set_id
from rdb$character_sets
order by rdb$character_set_id desc
2005-07-06 00:39:03 +02:00
into :temp_id do
2005-07-05 17:25:27 +02:00
begin
if (temp_id = id) then
id = id - 1;
else
break;
end
insert into rdb$character_sets
(rdb$character_set_name, rdb$character_set_id, rdb$system_flag, rdb$bytes_per_character)
values (:name, :id, 0, :max_bytes_per_character);
insert into rdb$collations
(rdb$collation_name, rdb$collation_id, rdb$character_set_id, rdb$system_flag)
values (:name, 0, :id, 0);
end!
create or alter procedure sp_unregister_character_set
(
name char(31) character set unicode_fss
)
as
declare variable id smallint;
begin
name = upper(name);
select rdb$character_set_id
from rdb$character_sets
where rdb$character_set_name = :name
into :id;
delete from rdb$collations
where rdb$character_set_id = :id;
delete from rdb$character_sets
where rdb$character_set_id = :id;
end!
set term ;!
commit;