diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-10-29 13:03:08 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-10-29 13:03:08 +0100 |
commit | 0697d75cd052e809b05cc3e812f5e48209c04b4c (patch) | |
tree | 16524035d92e3d78dc27db00dbc30198aa84db78 /storage/connect/jsonudf.h | |
parent | f6549e95448e5cce52336361f5a59d1edcdac46a (diff) | |
parent | c05e571e7d53ba11a3422490cff0d93e6691ea62 (diff) | |
download | mariadb-git-10.5-merge.tar.gz |
Merge commit 'c05e571e7d53ba11a3422490cff0d93e6691ea62' into HEAD10.5-merge
Diffstat (limited to 'storage/connect/jsonudf.h')
-rw-r--r-- | storage/connect/jsonudf.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index ee56869a111..897b0fe9919 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -235,6 +235,10 @@ extern "C" { DllExport char *json_serialize(UDF_EXEC_ARGS); DllExport void json_serialize_deinit(UDF_INIT*); + DllExport my_bool jfile_convert_init(UDF_INIT*, UDF_ARGS*, char*); + DllExport char* jfile_convert(UDF_EXEC_ARGS); + DllExport void jfile_convert_deinit(UDF_INIT*); + DllExport my_bool envar_init(UDF_INIT*, UDF_ARGS*, char*); DllExport char *envar(UDF_EXEC_ARGS); @@ -324,3 +328,38 @@ protected: my_bool Wr; // Write mode my_bool Jb; // Must return json item }; // end of class JSNX + +/*********************************************************************************/ +/* Class JUP: used by jfile_convert to make a json file pretty = 0. */ +/*********************************************************************************/ +class JUP : public BLOCK { +public: + // Constructor + JUP(PGLOBAL g); + + // Implementation + void AddBuff(char c) { + if (k < recl) + buff[k++] = c; + else + throw "Record size is too small"; + } // end of AddBuff + + // Methods + char *UnprettyJsonFile(PGLOBAL g, char* fn, char* outfn, int lrecl); + bool unPretty(PGLOBAL g, int lrecl); + void CopyObject(PGLOBAL g); + void CopyArray(PGLOBAL g); + void CopyValue(PGLOBAL g); + void CopyString(PGLOBAL g); + void CopyNumeric(PGLOBAL g); + + // Members + FILE* fs; + char* s; + char* buff; + int len; + int recl; + int i, k; +}; // end of class JUP + |