summaryrefslogtreecommitdiff
path: root/src/test/mb
diff options
context:
space:
mode:
authorBruce Momjian1999-02-02 18:51:40 +0000
committerBruce Momjian1999-02-02 18:51:40 +0000
commita7ad43cd18ebadf8c3d9cb117ff82ff4077a2986 (patch)
treea8eb845cbea1db7a0a4917063a465f64f272326a /src/test/mb
parent8358a8f6a0cd5700c1aa60f75023f957e8535c83 (diff)
Included patches make some enhancements to the multi-byte support.
o allow to use Big5 (a Chinese encoding used in Taiwan) as a client encoding. In this case the server side encoding should be EUC_TW o add EUC_TW and Big5 test cases to the regression and the mb test (contributed by Jonah Kuo) o fix mistake in include/mb/pg_wchar.h. An encoding id for EUC_TW was not correct (was 3 and now is 4) o update documents (doc/README.mb and README.mb.jp) o update psql helpfile (bin/psql/psqlHelp.h) -- Tatsuo Ishii t-ishii@sra.co.jp
Diffstat (limited to 'src/test/mb')
-rw-r--r--src/test/mb/expected/big5.out84
-rw-r--r--src/test/mb/mbregress.sh9
-rw-r--r--src/test/mb/sql/big5.sql20
3 files changed, 111 insertions, 2 deletions
diff --git a/src/test/mb/expected/big5.out b/src/test/mb/expected/big5.out
new file mode 100644
index 00000000000..0ca86167ece
--- /dev/null
+++ b/src/test/mb/expected/big5.out
@@ -0,0 +1,84 @@
+QUERY: drop table 廠商資料;
+QUERY: create table 廠商資料 (行業別 text, 公司抬頭 varchar, 地址 varchar(16));
+QUERY: create index 廠商資料index1 on 廠商資料 using btree (行業別);
+QUERY: create index 廠商資料index2 on 廠商資料 using hash (公司抬頭);
+QUERY: insert into 廠商資料 values ('電腦業', '達達科技', '北A01仁');
+QUERY: insert into 廠商資料 values ('製造業', '財源有限公司', '中B10中');
+QUERY: insert into 廠商資料 values ('餐飲業', '美味股份有限公司', '高Z01九');
+QUERY: vacuum 廠商資料;
+QUERY: select * from 廠商資料;
+行業別|公司抬頭 |地址
+------+----------------+-------
+電腦業|達達科技 |北A01仁
+製造業|財源有限公司 |中B10中
+餐飲業|美味股份有限公司|高Z01九
+(3 rows)
+
+QUERY: select * from 廠商資料 where 地址 = '高Z01九';
+行業別|公司抬頭 |地址
+------+----------------+-------
+餐飲業|美味股份有限公司|高Z01九
+(1 row)
+
+QUERY: select * from 廠商資料 where 地址 ~* '高z01九';
+行業別|公司抬頭 |地址
+------+----------------+-------
+餐飲業|美味股份有限公司|高Z01九
+(1 row)
+
+QUERY: select * from 廠商資料 where 地址 like '_Z01_';
+行業別|公司抬頭 |地址
+------+----------------+-------
+餐飲業|美味股份有限公司|高Z01九
+(1 row)
+
+QUERY: select * from 廠商資料 where 地址 like '_Z%';
+行業別|公司抬頭 |地址
+------+----------------+-------
+餐飲業|美味股份有限公司|高Z01九
+(1 row)
+
+QUERY: select * from 廠商資料 where 公司抬頭 ~ '達達科[寄記技]';
+行業別|公司抬頭|地址
+------+--------+-------
+電腦業|達達科技|北A01仁
+(1 row)
+
+QUERY: select * from 廠商資料 where 公司抬頭 ~* '達達科[寄記技]';
+行業別|公司抬頭|地址
+------+--------+-------
+電腦業|達達科技|北A01仁
+(1 row)
+
+QUERY: select *, character_length(行業別) from 廠商資料;
+行業別|公司抬頭 |地址 |length
+------+----------------+-------+------
+電腦業|達達科技 |北A01仁| 3
+製造業|財源有限公司 |中B10中| 3
+餐飲業|美味股份有限公司|高Z01九| 3
+(3 rows)
+
+QUERY: select *, octet_length(行業別) from 廠商資料;
+行業別|公司抬頭 |地址 |octet_length
+------+----------------+-------+------------
+電腦業|達達科技 |北A01仁| 6
+製造業|財源有限公司 |中B10中| 6
+餐飲業|美味股份有限公司|高Z01九| 6
+(3 rows)
+
+QUERY: select *, position('有限' in 公司抬頭) from 廠商資料;
+行業別|公司抬頭 |地址 |strpos
+------+----------------+-------+------
+電腦業|達達科技 |北A01仁| 0
+製造業|財源有限公司 |中B10中| 3
+餐飲業|美味股份有限公司|高Z01九| 5
+(3 rows)
+
+QUERY: select *, substring(公司抬頭 from 3 for 6 ) from 廠商資料;
+行業別|公司抬頭 |地址 |substr
+------+----------------+-------+------------
+電腦業|達達科技 |北A01仁|科技
+製造業|財源有限公司 |中B10中|有限公司
+餐飲業|美味股份有限公司|高Z01九|股份有限公司
+(3 rows)
+
diff --git a/src/test/mb/mbregress.sh b/src/test/mb/mbregress.sh
index 2ef2eb04124..9216d3c58be 100644
--- a/src/test/mb/mbregress.sh
+++ b/src/test/mb/mbregress.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $Header: /cvsroot/pgsql/src/test/mb/mbregress.sh,v 1.2 1998/07/26 04:31:38 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/test/mb/mbregress.sh,v 1.3 1999/02/02 18:51:32 momjian Exp $
if echo '\c' | grep -s c >/dev/null 2>&1
then
@@ -15,7 +15,7 @@ if [ ! -d results ];then
fi
PSQL="psql -n -e -q"
-tests="euc_jp sjis euc_kr euc_cn unicode mule_internal"
+tests="euc_jp sjis euc_kr euc_cn euc_tw big5 unicode mule_internal"
unset PGCLIENTENCODING
for i in $tests
do
@@ -26,6 +26,11 @@ do
export PGCLIENTENCODING
$PSQL euc_jp < sql/sjis.sql > results/sjis.out 2>&1
unset PGCLIENTENCODING
+ elif [ $i = big5 ];then
+ PGCLIENTENCODING=BIG5
+ export PGCLIENTENCODING
+ $PSQL euc_tw < sql/big5.sql > results/big5.out 2>&1
+ unset PGCLIENTENCODING
else
destroydb $i >/dev/null 2>&1
createdb -E `echo $i|tr "[a-z]" "[A-Z]"` $i
diff --git a/src/test/mb/sql/big5.sql b/src/test/mb/sql/big5.sql
new file mode 100644
index 00000000000..4e2d1001996
--- /dev/null
+++ b/src/test/mb/sql/big5.sql
@@ -0,0 +1,20 @@
+drop table 廠商資料;
+create table 廠商資料 (行業別 text, 公司抬頭 varchar, 地址 varchar(16));
+create index 廠商資料index1 on 廠商資料 using btree (行業別);
+create index 廠商資料index2 on 廠商資料 using hash (公司抬頭);
+insert into 廠商資料 values ('電腦業', '達達科技', '北A01仁');
+insert into 廠商資料 values ('製造業', '財源有限公司', '中B10中');
+insert into 廠商資料 values ('餐飲業', '美味股份有限公司', '高Z01九');
+vacuum 廠商資料;
+select * from 廠商資料;
+select * from 廠商資料 where 地址 = '高Z01九';
+select * from 廠商資料 where 地址 ~* '高z01九';
+select * from 廠商資料 where 地址 like '_Z01_';
+select * from 廠商資料 where 地址 like '_Z%';
+select * from 廠商資料 where 公司抬頭 ~ '達達科[寄記技]';
+select * from 廠商資料 where 公司抬頭 ~* '達達科[寄記技]';
+
+select *, character_length(行業別) from 廠商資料;
+select *, octet_length(行業別) from 廠商資料;
+select *, position('有限' in 公司抬頭) from 廠商資料;
+select *, substring(公司抬頭 from 3 for 6 ) from 廠商資料;