Giter Site home page Giter Site logo

pljson's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pljson's Issues

Wrong charcodes for form feed and carriage return ?

in json_printer:

when chr(13) then buf := '\f';
when chr(14) then buf := '\r';

Form feed \f should be code 12, and carriage return \r should be 13.

Maybe same issue in json_parser which is why it works?

        when 'f' then varbuf := varbuf || chr(13);
        when 'n' then varbuf := varbuf || chr(10);
        when 'r' then varbuf := varbuf || chr(14);

Values cannot exceed the canonical limit of 32K

Json values are stored as varchar2, bringing in this limitation. It should be possible to use clob instead of vc2.

declare 
  j pljson.json;
  c clob;
begin
  j := pljson.json();
  c := rpad(' ', 32768, ' ');
  j.put('test', c);
end;

character string buffer too small in JSON_PRINTER

(this question along with a screen shot of the error can also be viewed here: http://stackoverflow.com/questions/27608461/oracle-pl-json-to-clob-fails)

The code below is taken directly from example file ex11.sql. All I added was the loop code for making the string larger because I wanted to test a true clob. I found it fails with certain lengths and I can't figure out why.

  • 32,763 runs
  • 32,764 fails
  • 32,768 runs
  • Results continue on like this.
  • NOTE: Once you add the 8 extra hard coded json chars the true lengths for the above examples become: 32,771 (runs), 32,772 (fails), and 32,776 (runs).

Any ideas on how to get this to work consistently?

ex11.sql

set serveroutput on;
declare
    teststringlength pls_integer := 32763;
    i pls_integer := 0;
    obj json;
    my_clob clob := '{"a":"';
begin
    while i < teststringlength loop
            my_clob := concat(my_clob,'X');
            i := i + 1;
    end loop;
    my_clob := concat(my_clob,'"}');
    obj := json(my_clob);
    obj.print;
    dbms_lob.trim(my_clob, 0); --empty the lob
    obj.to_clob(my_clob);
    dbms_output.put_line('----');
    dbms_output.put_line(my_clob);
    --example with temperary clob
    my_clob := empty_clob();
    dbms_lob.createtemporary(my_clob, true);
    obj.to_clob(my_clob, true);
    dbms_output.put_line('----');
    dbms_output.put_line(my_clob);
    dbms_lob.freetemporary(my_clob);
end;
/

Error...
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "MySCHEMA.JSON_PRINTER", line 10
ORA-06512: at "MySCHEMA.JSON_PRINTER", line 211
ORA-06512: at "MySCHEMA.JSON_PRINTER", line 238
ORA-06512: at "MySCHEMA.JSON_PRINTER", line 256
ORA-06512: at "MySCHEMA.JSON", line 274
ORA-06512: at line 16

...update...

I may have found the bug, second set of eyes would be great. In json_printer.ppMem there is this line...

add_to_clob(buf, buf_str, llcheck('"'||escapeString(mem.get_string)||'"'));

If the string is close enough to the 32767 limit then then combination of escapeString() and llcheck() can cause it to grow beyond that point. escapeString() can replace a number of single chars with 2 chars and llcheck() adds 2 chars as well. Thus add_to_clob() bombs because the 3rd param is a varchar2. Thoughts? Is this a bug that can be fixed in a new version?

Current version no longer honours spaces=false in all cases

I've just used the latest version and my JSON is littered with newline characters now when spaces is set to false. It didn't used to happen in older versions.

In JSON_PRINTER.ppString there is a "|| newline_char" which is oblivious to the spaces boolean.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.