1
1
CREATE OR REPLACE
2
2
PACKAGE BODY json_sql_UT IS
3
3
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 $
5
5
6
6
----------------------------------------------------------
7
7
-- PRIVATE TYPES
33
33
ROW_3 CONSTANT VARCHAR2(2000) := '{"ID":3,"NAME":"martin donovan","BIRTHDAY":"'||toJSON(TODAY+2)||'"}';
34
34
35
35
aSql VARCHAR2(2000);
36
- aBinding json_object := json_object ();
36
+ aBinding jsonObject := jsonObject ();
37
37
aLob CLOB := empty_clob();
38
38
BEGIN
39
39
UT_util.module('UT_object');
43
43
44
44
-- select all rows
45
45
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);
47
47
UT_util.eqLOB( theTitle => aSql,
48
48
theComputed => aLob,
49
49
theExpected => TO_CLOB('{"rows":['||ROW_1||','||ROW_2||','||ROW_3||']}'),
52
52
53
53
-- select one row
54
54
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);
56
56
UT_util.eqLOB( theTitle => aSql,
57
57
theComputed => aLob,
58
58
theExpected => TO_CLOB('{"rows":['||ROW_2||']}'),
62
62
-- select one row using bind variables
63
63
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = :id';
64
64
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);
66
66
UT_util.eqLOB( theTitle => aSql,
67
67
theComputed => aLob,
68
68
theExpected => TO_CLOB('{"rows":['||ROW_3||']}'),
71
71
72
72
-- select no row
73
73
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);
75
75
UT_util.eqLOB( theTitle => aSql,
76
76
theComputed => aLob,
77
77
theExpected => TO_CLOB('{"rows":[]}'),
93
93
ROW_3 CONSTANT VARCHAR2(2000) := '[3,"martin donovan","'||toJSON(TODAY+2)||'"]';
94
94
95
95
aSql VARCHAR2(2000);
96
- aBinding json_object := json_object ();
96
+ aBinding jsonObject := jsonObject ();
97
97
aLob CLOB := empty_clob();
98
98
BEGIN
99
99
UT_util.module('UT_array');
@@ -103,7 +103,7 @@ BEGIN
103
103
104
104
-- select all rows
105
105
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);
107
107
UT_util.eqLOB( theTitle => aSql,
108
108
theComputed => aLob,
109
109
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_1||','||ROW_2||','||ROW_3||']}'),
@@ -112,7 +112,7 @@ BEGIN
112
112
113
113
-- select one row
114
114
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);
116
116
UT_util.eqLOB( theTitle => aSql,
117
117
theComputed => aLob,
118
118
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_2||']}'),
@@ -122,7 +122,7 @@ BEGIN
122
122
-- select one row using bind variables
123
123
aSql := 'SELECT * FROM temp_json_sql_ut WHERE id = :id';
124
124
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);
126
126
UT_util.eqLOB( theTitle => aSql,
127
127
theComputed => aLob,
128
128
theExpected => TO_CLOB('{'||COLS||',"rows":['||ROW_3||']}'),
@@ -131,7 +131,7 @@ BEGIN
131
131
132
132
-- select no row
133
133
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);
135
135
UT_util.eqLOB( theTitle => aSql,
136
136
theComputed => aLob,
137
137
theExpected => TO_CLOB('{'||COLS||',"rows":[]}'),
0 commit comments