提交 1f445c27 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use >> syntax in scripts/functions/string

上级 8e262fe8
......@@ -13,10 +13,5 @@ select concat(null, null) en, concat(null, 'a') ea, concat('b', null) eb, concat
> null a b abc
> rows: 1
SELECT CONCAT('a', 'b', 'c', 'd') AS test;
> TEST
> ----
> abcd
> rows: 1
SELECT CONCAT('a', 'b', 'c', 'd');
>> abcd
......@@ -7,53 +7,29 @@ call regexp_replace('x', 'x', '\');
> exception
CALL REGEXP_REPLACE('abckaboooom', 'o+', 'o');
> 'abckabom'
> ----------
> abckabom
> rows: 1
>> abckabom
select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni') as X;
> X
> --------
> TOTOvain
> rows: 1
select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni');
>> TOTOvain
set mode oracle;
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual;
> X
> ----------
> last first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\\2 \1') as X from dual;
> X
> --------
> \2 first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\$2 \1') as X from dual;
> X
> --------
> $2 first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual;
> X
> -----
> $2 $1
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> last first
select regexp_replace('first last', '(\w+) (\w+)', '\\2 \1');
>> \2 first
select regexp_replace('first last', '(\w+) (\w+)', '\$2 \1');
>> $2 first
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> $2 $1
set mode regular;
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual;
> X
> ---
> 2 1
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual;
> X
> ----------
> last first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> 2 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> last first
......@@ -7,10 +7,7 @@ call select 1 from dual where regexp_like('x', 'x', '\');
> exception
select x from dual where REGEXP_LIKE('A', '[a-z]', 'i');
> X
> -
> 1
> rows: 1
>> 1
select x from dual where REGEXP_LIKE('A', '[a-z]', 'c');
> X
......
......@@ -10,15 +10,7 @@ INSERT INTO TEST VALUES(2, STRINGDECODE('abcsond\344rzeich\344 ') || char(22222)
> update count: 1
call STRINGENCODE(STRINGDECODE('abcsond\344rzeich\344 \u56ce \366\344\374\326\304\334\351\350\340\361!'));
> 'abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!'
> ------------------------------------------------------------------------------------------------
> abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!
> rows: 1
>> abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2'));
> 'Lines 1\nLine 2'
> -----------------
> Lines 1\nLine 2
> rows: 1
>> Lines 1\nLine 2
......@@ -4,8 +4,4 @@
--
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test'));
> 'This is a test'
> ----------------
> This is a test
> rows: 1
>> This is a test
......@@ -4,14 +4,7 @@
--
CALL XMLCDATA('<characters>');
> '<![CDATA[<characters>]]>'
> --------------------------
> <![CDATA[<characters>]]>
> rows: 1
>> <![CDATA[<characters>]]>
CALL XMLCDATA('special text ]]>');
> 'special text ]]&gt;'
> ---------------------
> special text ]]&gt;
> rows: 1
>> special text ]]&gt;
......@@ -4,14 +4,7 @@
--
CALL XMLCOMMENT('Test');
> STRINGDECODE('<!-- Test -->\n')
> -------------------------------
> <!-- Test -->
> rows: 1
>> <!-- Test -->
CALL XMLCOMMENT('--- test ---');
> STRINGDECODE('<!-- - - - test - - - -->\n')
> -------------------------------------------
> <!-- - - - test - - - -->
> rows: 1
>> <!-- - - - test - - - -->
......@@ -4,32 +4,16 @@
--
CALL XMLNODE('a', XMLATTR('href', 'http://h2database.com'));
> STRINGDECODE('<a href=\"http://h2database.com\"/>\n')
> -----------------------------------------------------
> <a href="http://h2database.com"/>
> rows: 1
>> <a href="http://h2database.com"/>
CALL XMLNODE('br');
> STRINGDECODE('<br/>\n')
> -----------------------
> <br/>
> rows: 1
>> <br/>
CALL XMLNODE('p', null, 'Hello World');
> STRINGDECODE('<p>Hello World</p>\n')
> ------------------------------------
> <p>Hello World</p>
> rows: 1
>> <p>Hello World</p>
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World') X;
> X
> ---------------------
> <p> Hello World </p>
> rows: 1
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World', false) X;
> X
> -------------------
> <p>Hello World</p>
> rows: 1
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World');
>> <p> Hello World </p>
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World', false);
>> <p>Hello World</p>
......@@ -4,8 +4,4 @@
--
CALL XMLSTARTDOC();
> STRINGDECODE('<?xml version=\"1.0\"?>\n')
> -----------------------------------------
> <?xml version="1.0"?>
> rows: 1
>> <?xml version="1.0"?>
......@@ -4,26 +4,13 @@
--
CALL XMLTEXT('test');
> 'test'
> ------
> test
> rows: 1
>> test
CALL XMLTEXT('<test>');
> '&lt;test&gt;'
> --------------
> &lt;test&gt;
> rows: 1
>> &lt;test&gt;
SELECT XMLTEXT('hello' || chr(10) || 'world') X;
> X
> -----------
> hello world
> rows: 1
SELECT XMLTEXT('hello' || chr(10) || 'world');
>> hello world
CALL XMLTEXT('hello' || chr(10) || 'world', true);
> 'hello&#xa;world'
> -----------------
> hello&#xa;world
> rows: 1
>> hello&#xa;world
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论