| 2711 | } |
| 2712 | |
| 2713 | String strBuildJSON(RandomGenerator & rg, const int jdepth, const int jwidth) |
| 2714 | { |
| 2715 | String ret = "{"; |
| 2716 | |
| 2717 | if (jdepth && jwidth && rg.nextSmallNumber() < 9) |
| 2718 | { |
| 2719 | std::uniform_int_distribution<int> childd(0, jwidth); |
| 2720 | const int nchildren = childd(rg.generator); |
| 2721 | |
| 2722 | for (int i = 0; i < nchildren; i++) |
| 2723 | { |
| 2724 | std::uniform_int_distribution<int> jopt(1, 3); |
| 2725 | |
| 2726 | if (i != 0) |
| 2727 | { |
| 2728 | ret += ","; |
| 2729 | } |
| 2730 | ret += "\""; |
| 2731 | ret += rg.nextJSONCol(); |
| 2732 | ret += "\":"; |
| 2733 | switch (jopt(rg.generator)) |
| 2734 | { |
| 2735 | case 1: |
| 2736 | /// Object |
| 2737 | ret += strBuildJSON(rg, jdepth - 1, jwidth); |
| 2738 | break; |
| 2739 | case 2: |
| 2740 | /// Array |
| 2741 | ret += strBuildJSONArray(rg, jdepth - 1, jwidth); |
| 2742 | break; |
| 2743 | case 3: |
| 2744 | /// Others |
| 2745 | ret += strBuildJSONElement(rg); |
| 2746 | break; |
| 2747 | default: UNREACHABLE(); |
| 2748 | } |
| 2749 | } |
| 2750 | } |
| 2751 | ret += "}"; |
| 2752 | return ret; |
| 2753 | } |
| 2754 | |
| 2755 | String StatementGenerator::strAppendAnyValue(RandomGenerator & rg, const bool allow_cast, SQLType * tp) |
| 2756 | { |
no test coverage detected