@@ -31,6 +31,8 @@ uint GetJsonGrpSize(void);
3131static int IsJson (UDF_ARGS *args, uint i);
3232static PSZ MakePSZ (PGLOBAL g, UDF_ARGS *args, int i);
3333
34+ static uint JsonGrpSize = 10 ;
35+
3436/* ----------------------------------- JSNX ------------------------------------ */
3537
3638/* ********************************************************************************/
@@ -1039,6 +1041,14 @@ static void SetChanged(PBSON bsp)
10391041bsp->Changed = true ;
10401042} /* end of SetChanged */
10411043
1044+ /* ********************************************************************************/
1045+ /* Replaces GetJsonGrpSize not usable when CONNECT is not installed. */
1046+ /* ********************************************************************************/
1047+ static uint GetJsonGroupSize (void )
1048+ {
1049+ return (JsonGrpSize) ? JsonGrpSize : GetJsonGrpSize ();
1050+ } // end of GetJsonGroupSize
1051+
10421052/* ********************************************************************************/
10431053/* Program for SubSet re-initialization of the memory pool. */
10441054/* ********************************************************************************/
@@ -2393,12 +2403,51 @@ void json_object_list_deinit(UDF_INIT* initid)
23932403JsonFreeMem ((PGLOBAL)initid->ptr );
23942404} // end of json_object_list_deinit
23952405
2406+ /* ********************************************************************************/
2407+ /* Set the value of JsonGrpSize. */
2408+ /* ********************************************************************************/
2409+ my_bool jsonset_grp_size_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
2410+ {
2411+ if (args->arg_count != 1 || args->arg_type [0 ] != INT_RESULT) {
2412+ strcpy (message, " This function must have 1 integer argument" );
2413+ return true ;
2414+ } else
2415+ return false ;
2416+
2417+ } // end of jsonset_grp_size_init
2418+
2419+ long long jsonset_grp_size (UDF_INIT *initid, UDF_ARGS *args, char *, char *)
2420+ {
2421+ long long n = *(long long *)args->args [0 ];
2422+
2423+ JsonGrpSize = (uint)n;
2424+ return (long long )GetJsonGroupSize ();
2425+ } // end of jsonset_grp_size
2426+
2427+ /* ********************************************************************************/
2428+ /* Get the value of JsonGrpSize. */
2429+ /* ********************************************************************************/
2430+ my_bool jsonget_grp_size_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
2431+ {
2432+ if (args->arg_count != 0 ) {
2433+ strcpy (message, " This function must have no arguments" );
2434+ return true ;
2435+ } else
2436+ return false ;
2437+
2438+ } // end of jsonget_grp_size_init
2439+
2440+ long long jsonget_grp_size (UDF_INIT *initid, UDF_ARGS *args, char *, char *)
2441+ {
2442+ return (long long )GetJsonGroupSize ();
2443+ } // end of jsonget_grp_size
2444+
23962445/* ********************************************************************************/
23972446/* Make a Json array from values coming from rows. */
23982447/* ********************************************************************************/
23992448my_bool json_array_grp_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
24002449{
2401- unsigned long reslen, memlen, n = GetJsonGrpSize ();
2450+ unsigned long reslen, memlen, n = GetJsonGroupSize ();
24022451
24032452 if (args->arg_count != 1 ) {
24042453 strcpy (message, " This function can only accept 1 argument" );
@@ -2458,7 +2507,7 @@ void json_array_grp_clear(UDF_INIT *initid, char*, char*)
24582507
24592508 PlugSubSet (g, g->Sarea , g->Sarea_Size );
24602509 g->Activityp = (PACTIVITY)new (g) JARRAY;
2461- g->N = GetJsonGrpSize ();
2510+ g->N = GetJsonGroupSize ();
24622511} // end of json_array_grp_clear
24632512
24642513void json_array_grp_deinit (UDF_INIT* initid)
@@ -2471,7 +2520,7 @@ void json_array_grp_deinit(UDF_INIT* initid)
24712520/* ********************************************************************************/
24722521my_bool json_object_grp_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
24732522{
2474- unsigned long reslen, memlen, n = GetJsonGrpSize ();
2523+ unsigned long reslen, memlen, n = GetJsonGroupSize ();
24752524
24762525if (args->arg_count != 2 ) {
24772526 strcpy (message, " This function requires 2 arguments (key, value)" );
@@ -2529,7 +2578,7 @@ void json_object_grp_clear(UDF_INIT *initid, char*, char*)
25292578
25302579 PlugSubSet (g, g->Sarea , g->Sarea_Size );
25312580 g->Activityp = (PACTIVITY)new (g) JOBJECT;
2532- g->N = GetJsonGrpSize ();
2581+ g->N = GetJsonGroupSize ();
25332582} // end of json_object_grp_clear
25342583
25352584void json_object_grp_deinit (UDF_INIT* initid)
0 commit comments