Skip to content

Commit 2489cc9

Browse files
committed
Fixed the unit tests for converting \f and \r
1 parent 909f4cd commit 2489cc9

File tree

6 files changed

+192
-176
lines changed

6 files changed

+192
-176
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
### Changed
1919
- No longer install debug module by default.
2020
- Removed package json_cost and json_clob.
21+
- Removed the obsolete performance tests.
2122

2223

2324
### Fixed
2425
- Required naming changes to run on current Oracle versions that now also have json support.
26+
- Fixed an error when converting \f and \r.
2527

2628

2729
## [0.4.1] - 2016-12-22

json_utils.pkb

+5-5
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,11 @@ BEGIN
756756
buf := SUBSTR(theString, i, 1);
757757

758758
CASE buf
759-
WHEN CHR( 8) THEN buf := '\b'; -- backspace b = U+0008
760-
WHEN CHR( 9) THEN buf := '\t'; -- tabulator t = U+0009
761-
WHEN CHR(10) THEN buf := '\n'; -- newline n = U+000A
762-
WHEN CHR(12) THEN buf := '\f'; -- formfeed f = U+000C
763-
WHEN CHR(13) THEN buf := '\r'; -- carret r = U+000D
759+
WHEN CHR(8) THEN buf := '\b'; -- backspace b = U+0008 = chr(8)
760+
WHEN CHR(9) THEN buf := '\t'; -- tabulator t = U+0009 = chr(9)
761+
WHEN CHR(10) THEN buf := '\n'; -- newline n = U+000A = chr(10)
762+
WHEN CHR(12) THEN buf := '\f'; -- formfeed f = U+000C = chr(12)
763+
WHEN CHR(13) THEN buf := '\r'; -- carret r = U+000D = chr(13)
764764
WHEN CHR(34) THEN buf := '\"';
765765
WHEN CHR(47) THEN -- slash
766766
IF (theEscapeSolitus) THEN

unittest/json_sql_ut.pkb

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE OR REPLACE
22
PACKAGE BODY json_sql_UT IS
33

4-
-- $Id: json_sql_ut.pkb 49652 2016-12-08 18:17:30Z doberkofler $
4+
-- $Id: json_sql_ut.pkb 51368 2017-06-19 13:02:35Z doberkofler $
55

66
----------------------------------------------------------
77
-- PRIVATE TYPES
@@ -33,7 +33,7 @@ IS
3333
ROW_3 CONSTANT VARCHAR2(2000) := '{"ID":3,"NAME":"martin donovan","BIRTHDAY":"'||toJSON(TODAY+2)||'"}';
3434

3535
aSql VARCHAR2(2000);
36-
aBinding json_object := json_object();
36+
aBinding jsonObject := jsonObject();
3737
aLob CLOB := empty_clob();
3838
BEGIN
3939
UT_util.module('UT_object');
@@ -43,7 +43,7 @@ BEGIN
4343

4444
-- select all rows
4545
aSql := 'SELECT * FROM temp_json_sql_ut ORDER BY id';
46-
json_sql.get(theSqlStatement=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
46+
json_sql.get(sqlCmd=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
4747
UT_util.eqLOB( theTitle => aSql,
4848
theComputed => aLob,
4949
theExpected => TO_CLOB('{"rows":['||ROW_1||','||ROW_2||','||ROW_3||']}'),
@@ -52,7 +52,7 @@ BEGIN
5252

5353
-- select one row
5454
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = 2';
55-
json_sql.get(theSqlStatement=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
55+
json_sql.get(sqlCmd=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
5656
UT_util.eqLOB( theTitle => aSql,
5757
theComputed => aLob,
5858
theExpected => TO_CLOB('{"rows":['||ROW_2||']}'),
@@ -62,7 +62,7 @@ BEGIN
6262
-- select one row using bind variables
6363
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = :id';
6464
aBinding.put('id', 3);
65-
json_sql.get(theSqlStatement=>aSql, theBinding=>aBinding, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
65+
json_sql.get(sqlCmd=>aSql, sqlBind=>aBinding, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
6666
UT_util.eqLOB( theTitle => aSql,
6767
theComputed => aLob,
6868
theExpected => TO_CLOB('{"rows":['||ROW_3||']}'),
@@ -71,7 +71,7 @@ BEGIN
7171

7272
-- select no row
7373
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = 0';
74-
json_sql.get(theSqlStatement=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
74+
json_sql.get(sqlCmd=>aSql, format=>json_sql.FORMAT_OBJ).to_clob(theLobBuf=>aLob);
7575
UT_util.eqLOB( theTitle => aSql,
7676
theComputed => aLob,
7777
theExpected => TO_CLOB('{"rows":[]}'),
@@ -93,7 +93,7 @@ IS
9393
ROW_3 CONSTANT VARCHAR2(2000) := '[3,"martin donovan","'||toJSON(TODAY+2)||'"]';
9494

9595
aSql VARCHAR2(2000);
96-
aBinding json_object := json_object();
96+
aBinding jsonObject := jsonObject();
9797
aLob CLOB := empty_clob();
9898
BEGIN
9999
UT_util.module('UT_array');
@@ -103,7 +103,7 @@ BEGIN
103103

104104
-- select all rows
105105
aSql := 'SELECT * FROM temp_json_sql_ut ORDER BY id';
106-
json_sql.get(theSqlStatement=>aSql).to_clob(theLobBuf=>aLob);
106+
json_sql.get(sqlCmd=>aSql).to_clob(theLobBuf=>aLob);
107107
UT_util.eqLOB( theTitle => aSql,
108108
theComputed => aLob,
109109
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_1||','||ROW_2||','||ROW_3||']}'),
@@ -112,7 +112,7 @@ BEGIN
112112

113113
-- select one row
114114
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = 2';
115-
json_sql.get(theSqlStatement=>aSql).to_clob(theLobBuf=>aLob);
115+
json_sql.get(sqlCmd=>aSql).to_clob(theLobBuf=>aLob);
116116
UT_util.eqLOB( theTitle => aSql,
117117
theComputed => aLob,
118118
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_2||']}'),
@@ -122,7 +122,7 @@ BEGIN
122122
-- select one row using bind variables
123123
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = :id';
124124
aBinding.put('id', 3);
125-
json_sql.get(theSqlStatement=>aSql, theBinding=>aBinding).to_clob(theLobBuf=>aLob);
125+
json_sql.get(sqlCmd=>aSql, sqlBind=>aBinding).to_clob(theLobBuf=>aLob);
126126
UT_util.eqLOB( theTitle => aSql,
127127
theComputed => aLob,
128128
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_3||']}'),
@@ -131,7 +131,7 @@ BEGIN
131131

132132
-- select no row
133133
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = 0';
134-
json_sql.get(theSqlStatement=>aSql).to_clob(theLobBuf=>aLob);
134+
json_sql.get(sqlCmd=>aSql).to_clob(theLobBuf=>aLob);
135135
UT_util.eqLOB( theTitle => aSql,
136136
theComputed => aLob,
137137
theExpected => TO_CLOB('{'||COLS||',"rows":[]}'),

0 commit comments

Comments
 (0)