Skip to content

Commit f0e3f2d

Browse files
committed
Remove TFS Branding
Alter array JSON printing to put comma first
1 parent 7a15f81 commit f0e3f2d

5 files changed

Lines changed: 83 additions & 43 deletions

File tree

Packages/DZ_JSON_MAIN.pkb

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ AS
24032403
);
24042404

24052405
str_output := REGEXP_REPLACE(
2406-
REGEXP_REPLACE(str_output,CHR(13),'\r')
2406+
REGEXP_REPLACE(str_output,CHR(13),'')
24072407
,CHR(9)
24082408
,'\t'
24092409
);
@@ -2469,10 +2469,6 @@ AS
24692469
THEN
24702470
RETURN '0' || str_output;
24712471

2472-
ELSIF SUBSTR(str_output,1,2) = '-.'
2473-
THEN
2474-
RETURN '-0' || SUBSTR(str_output,2);
2475-
24762472
ELSE
24772473
RETURN str_output;
24782474

@@ -2543,7 +2539,7 @@ AS
25432539
);
25442540

25452541
clb_output := REGEXP_REPLACE(
2546-
REGEXP_REPLACE(clb_output,CHR(13),'\r')
2542+
REGEXP_REPLACE(clb_output,CHR(13),'')
25472543
,CHR(9)
25482544
,'\t'
25492545
);
@@ -2668,6 +2664,7 @@ AS
26682664
) RETURN CLOB
26692665
AS
26702666
clb_output CLOB;
2667+
str_pad VARCHAR2(1 Char);
26712668

26722669
BEGIN
26732670

@@ -2713,22 +2710,15 @@ AS
27132710
-- Step 40
27142711
-- Spin out the values
27152712
--------------------------------------------------------------------------
2713+
str_pad := ' ';
27162714
FOR i IN 1 .. p_input.COUNT
27172715
LOOP
2718-
IF i < p_input.COUNT
2719-
THEN
2720-
clb_output := clb_output || dz_json_util.pretty(
2721-
json_format(p_input(i)) || ','
2722-
,p_pretty_print + 1
2723-
);
2724-
2725-
ELSE
2726-
clb_output := clb_output || dz_json_util.pretty(
2727-
json_format(p_input(i))
2728-
,p_pretty_print + 1
2729-
);
2716+
clb_output := clb_output || dz_json_util.pretty(
2717+
str_pad || json_format(p_input(i))
2718+
,p_pretty_print + 1
2719+
);
27302720

2731-
END IF;
2721+
str_pad := ',';
27322722

27332723
END LOOP;
27342724

@@ -2760,6 +2750,7 @@ AS
27602750
) RETURN CLOB
27612751
AS
27622752
clb_output CLOB;
2753+
str_pad VARCHAR2(1 Char);
27632754

27642755
BEGIN
27652756

@@ -2789,39 +2780,26 @@ AS
27892780
--------------------------------------------------------------------------
27902781
IF p_pretty_print IS NULL
27912782
THEN
2792-
clb_output := clb_output || dz_json_util.pretty(
2793-
'['
2794-
,NULL
2795-
);
2783+
clb_output := clb_output || dz_json_util.pretty('[',NULL);
27962784

27972785
ELSE
2798-
clb_output := clb_output || dz_json_util.pretty(
2799-
'['
2800-
,-1
2801-
);
2786+
clb_output := clb_output || dz_json_util.pretty('[',-1);
28022787

28032788
END IF;
28042789

28052790
--------------------------------------------------------------------------
28062791
-- Step 40
28072792
-- Spin out the values
28082793
--------------------------------------------------------------------------
2794+
str_pad := ' ';
28092795
FOR i IN 1 .. p_input.COUNT
28102796
LOOP
2811-
IF i < p_input.COUNT
2812-
THEN
2813-
clb_output := clb_output || dz_json_util.pretty(
2814-
json_format(p_input(i)) || ','
2815-
,p_pretty_print + 1
2816-
);
2817-
2818-
ELSE
2819-
clb_output := clb_output || dz_json_util.pretty(
2820-
json_format(p_input(i))
2821-
,p_pretty_print + 1
2822-
);
2823-
2824-
END IF;
2797+
clb_output := clb_output || dz_json_util.pretty(
2798+
str_pad || json_format(p_input(i))
2799+
,p_pretty_print + 1
2800+
);
2801+
2802+
str_pad := ',';
28252803

28262804
END LOOP;
28272805

Packages/DZ_JSON_MAIN.pks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AS
77
header: DZ_JSON
88

99
- Build ID: DZBUILDIDDZ
10-
- TFS Change Set: DZTFSCHANGESETDZ
10+
- TFS Change Set: DZCHANGESETDZ
1111

1212
Utility for the creation of JSON and GeoJSON from Oracle data types and
1313
structures. Support for the deserialization of JSON is not implemented.

Packages/DZ_JSON_TEST.pks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CREATE OR REPLACE PACKAGE dz_json_test
22
AUTHID DEFINER
33
AS
44

5-
C_TFS_CHANGESET CONSTANT NUMBER := 0.0;
5+
C_CHANGESET CONSTANT VARCHAR2(255 Char) := 'NULL';
66
C_JENKINS_JOBNM CONSTANT VARCHAR2(255 Char) := 'NULL';
77
C_JENKINS_BUILD CONSTANT NUMBER := 0.0;
88
C_JENKINS_BLDID CONSTANT VARCHAR2(255 Char) := 'NULL';

Packages/DZ_JSON_UTIL.pkb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,59 @@ AS
506506
END IF;
507507

508508
END indent;
509+
510+
-----------------------------------------------------------------------------
511+
-----------------------------------------------------------------------------
512+
FUNCTION pretty_str(
513+
p_input IN VARCHAR2
514+
,p_level IN NUMBER
515+
,p_amount IN VARCHAR2 DEFAULT ' '
516+
,p_linefeed IN VARCHAR2 DEFAULT CHR(10)
517+
) RETURN VARCHAR2
518+
AS
519+
str_amount VARCHAR2(4000 Char) := p_amount;
520+
str_linefeed VARCHAR2(2 Char) := p_linefeed;
521+
522+
BEGIN
523+
524+
--------------------------------------------------------------------------
525+
-- Step 10
526+
-- Process Incoming Parameters
527+
--------------------------------------------------------------------------
528+
IF p_amount IS NULL
529+
THEN
530+
str_amount := ' ';
531+
532+
END IF;
533+
534+
--------------------------------------------------------------------------
535+
-- Step 20
536+
-- If input is NULL, then do nothing
537+
--------------------------------------------------------------------------
538+
IF p_input IS NULL
539+
THEN
540+
RETURN NULL;
541+
542+
END IF;
543+
544+
--------------------------------------------------------------------------
545+
-- Step 30
546+
-- Return indented and line fed results
547+
--------------------------------------------------------------------------
548+
IF p_level IS NULL
549+
THEN
550+
RETURN p_input;
551+
552+
ELSIF p_level = -1
553+
THEN
554+
RETURN p_input || str_linefeed;
555+
556+
ELSE
557+
RETURN indent(p_level,str_amount) || p_input || str_linefeed;
558+
559+
END IF;
560+
561+
END pretty_str;
509562

510563
-----------------------------------------------------------------------------
511564
-----------------------------------------------------------------------------

Packages/DZ_JSON_UTIL.pks

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ AS
5858
,p_trunc IN NUMBER DEFAULT NULL
5959
) RETURN CLOB;
6060

61+
-----------------------------------------------------------------------------
62+
-----------------------------------------------------------------------------
63+
FUNCTION pretty_str(
64+
p_input IN VARCHAR2
65+
,p_level IN NUMBER
66+
,p_amount IN VARCHAR2 DEFAULT ' '
67+
,p_linefeed IN VARCHAR2 DEFAULT CHR(10)
68+
) RETURN VARCHAR2;
69+
6170
-----------------------------------------------------------------------------
6271
-----------------------------------------------------------------------------
6372
FUNCTION pretty(

0 commit comments

Comments
 (0)