#include <cstddef>
#include <string>
#include <utility>
#include "my_rapidjson_size_t.h"
#include <rapidjson/encodings.h>
#include <rapidjson/reader.h>
#include "sql-common/json_error_handler.h"
 
Go to the source code of this file.
 | 
| class   | Syntax_check_handler | 
|   | This class implements a handler for use with rapidjson::Reader when we want to check if a string is a valid JSON text.  More...
  | 
|   | 
◆ check_json_depth() [1/2]
Check if the depth of a JSON document exceeds the maximum supported depth (JSON_DOCUMENT_MAX_DEPTH). 
Raise an error if the maximum depth has been exceeded.
- Parameters
 - 
  
    | [in] | depth | the current depth of the document  | 
    | [in] | handler | callback function that gets called when maximum depth is exceeded  | 
  
   
- Returns
 - true if the maximum depth is exceeded, false otherwise 
 
 
 
◆ check_json_depth() [2/2]
◆ get_error_from_reader()
      
        
          | std::pair< std::string, size_t > get_error_from_reader  | 
          ( | 
          const rapidjson::Reader &  | 
          reader | ) | 
           | 
        
      
 
Extract a readable error from a rapidjson reader and return it to the caller. 
- Parameters
 - 
  
    | [in] | reader | The rapidjson reader to extract the error from.  | 
  
   
- Returns
 - A pair where the first element is a readable error and the second element is the position in the input string where the error was found. 
 
 
 
◆ is_valid_json_syntax()
      
        
          | bool is_valid_json_syntax  | 
          ( | 
          const char *  | 
          text,  | 
        
        
           | 
           | 
          size_t  | 
          length,  | 
        
        
           | 
           | 
          size_t *  | 
          error_offset,  | 
        
        
           | 
           | 
          std::string *  | 
          error_message,  | 
        
        
           | 
           | 
          const JsonErrorHandler &  | 
          depth_handler  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Check if a string is a valid JSON. 
- Parameters
 - 
  
    | [in] | text | A pointer to the start of the text  | 
    | [in] | length | The length of the text  | 
    | [out] | error_offset | If the text is not a valid JSON, this variable will be set to the position in the input string where the error occurred. Can be nullptr.  | 
    | [out] | error_message | If the text is not a valid JSON, this variable will contain a readable error message. Can be nullptr.  | 
    | [in] | depth_handler | Pointer to a function that should handle error occurred when depth is exceeded. | 
  
   
- Return values
 - 
  
    | true | if the input text is a valid JSON.  | 
    | false | if the input text is not a valid JSON.  |