OSDN Git Service

e7ffc76070256e512dcf349940bfdd4a8b53decc
[ludiafuncs/ludia_funcs.git] / input / textporter.source
1 \pset null '(null)'
2
3 -- Load ludia_funcs module
4 CREATE EXTENSION ludia_funcs;
5
6 -- DMC_GETTEXT_OPT_CRLF
7 SET ludia_funcs.textporter_option = 8;
8 SET ludia_funcs.textporter_error TO warning;
9 SET ludia_funcs.textporter_exit_on_segv TO off;
10
11 -- Test whether pgs2textporter1() can extract the contents from
12 -- various types of input files.
13 SELECT pgs2snippet1(1,300,1,'∇','∇',0,'データベース',pgs2textporter1('@abs_srcdir@/data/test.txt'));
14 SELECT pgs2textporter1('@abs_srcdir@/data/test.docx');
15 SELECT pgs2textporter1('@abs_srcdir@/data/test.xlsx');
16 SELECT pgs2textporter1('@abs_srcdir@/data/powerpoint2007_test.pptx');
17 SELECT pgs2textporter1('@abs_srcdir@/data/pdf1.5_test.pdf');
18 SELECT pgs2textporter1('@abs_srcdir@/data/csv_test.csv');
19
20 -- Test whether the setting of textporter_option affects the behavior of
21 -- pgs2textporter1() expectedly.
22
23 -- DMC_GETTEXT_OPT_CSV1 and DMC_GETTEXT_OPT_CRLF
24 SET ludia_funcs.textporter_option TO 16777224;
25 SELECT pgs2textporter1('@abs_srcdir@/data/test.xlsx');
26
27 -- DMC_GETTEXT_OPT_SHFTAG and DMC_GETTEXT_OPT_LF
28 SET ludia_funcs.textporter_option = 262160;
29 SELECT pgs2textporter1('@abs_srcdir@/data/test.xlsx');
30
31 -- Test the case where textporter_option is set to the minimum value.
32 SET ludia_funcs.textporter_option = 0;
33 SELECT pgs2textporter1('@abs_srcdir@/data/test.docx');
34
35 -- Test the case where textporter_option is set to the maximum value.
36 SET ludia_funcs.textporter_option = 4294967295;
37 SELECT pgs2textporter1('@abs_srcdir@/data/test.docx');
38
39 -- Test the cases where textporter_option is set to the invalid value.
40 SET ludia_funcs.textporter_option = -1;
41 SET ludia_funcs.textporter_option = 4294967296;
42 SET ludia_funcs.textporter_option = 'a';
43
44 -- Test whether the setting of textporter_error affects the behavior of
45 -- pgs2textporter1() expectedly.
46 SET ludia_funcs.textporter_error TO notice;
47 SELECT pgs2textporter1('@abs_srcdir@/data/noexist');
48 SET ludia_funcs.textporter_error TO error;
49 SELECT pgs2textporter1('@abs_srcdir@/data/noexist');
50
51 -- Test whether pgs2textporter1() can extract the contents
52 -- even when textporter_exit_on_segv is enabled.
53 SET ludia_funcs.textporter_exit_on_segv TO on;
54 SELECT pgs2textporter1('@abs_srcdir@/data/test.docx');
55
56 -- Clean up ludia_funcs module
57 DROP EXTENSION ludia_funcs;
58
59 -- Test the case where database encoding is not UTF8
60 \c regtest_ludia_funcs_eucjp
61 SELECT pgs2textporter1('@abs_srcdir@/data/test.docx');