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