CUBRID Engine  latest
db_json.cpp File Reference
#include "db_json.hpp"
#include "db_json_path.hpp"
#include "db_json_types_internal.hpp"
#include "db_rapidjson.hpp"
#include "dbtype.h"
#include "memory_alloc.h"
#include "memory_private_allocator.hpp"
#include "object_primitive.h"
#include "object_representation.h"
#include "porting_inline.hpp"
#include "query_dump.h"
#include "string_opfunc.h"
#include "system_parameter.h"
#include <algorithm>
#include <sstream>
#include <stack>
Include dependency graph for db_json.cpp:

Go to the source code of this file.

Classes

class  JSON_ITERATOR
 
class  JSON_OBJECT_ITERATOR
 
class  JSON_ARRAY_ITERATOR
 
class  JSON_VALIDATOR
 
class  JSON_BASE_HANDLER
 
class  JSON_WALKER
 
class  JSON_DUPLICATE_KEYS_CHECKER
 
class  JSON_PATH_MAPPER
 
class  JSON_SERIALIZER_LENGTH
 
class  JSON_SERIALIZER
 
class  JSON_PRETTY_WRITER
 
struct  JSON_PRETTY_WRITER::level_context
 

Namespaces

 cubmem
 

Macros

#define TODO_OPTIMIZE_JSON_BODY_STRING   true
 

Typedefs

typedef rapidjson::GenericStringBuffer< JSON_ENCODING, JSON_PRIVATE_ALLOCATORJSON_STRING_BUFFER
 
typedef rapidjson::GenericMemberIterator< true, JSON_ENCODING, JSON_PRIVATE_MEMPOOL >::Iterator JSON_MEMBER_ITERATOR
 
typedef rapidjson::GenericArray< true, JSON_VALUE >::ConstValueIterator JSON_VALUE_ITERATOR
 
typedef std::function< int(const JSON_VALUE &, const JSON_PATH &, bool &)> map_func_type
 

Functions

static unsigned int db_json_value_get_depth (const JSON_VALUE *doc)
 
static int db_json_value_is_contained_in_doc_helper (const JSON_VALUE *doc, const JSON_VALUE *value, bool &result)
 
static bool db_json_value_has_numeric_type (const JSON_VALUE *doc)
 
DB_JSON_TYPE db_json_get_type_of_value (const JSON_VALUE *val)
 
static int db_json_get_int_from_value (const JSON_VALUE *val)
 
static std::int64_t db_json_get_bigint_from_value (const JSON_VALUE *val)
 
static double db_json_get_double_from_value (const JSON_VALUE *doc)
 
static const char * db_json_get_string_from_value (const JSON_VALUE *doc)
 
static char * db_json_copy_string_from_value (const JSON_VALUE *doc)
 
static char * db_json_get_bool_as_str_from_value (const JSON_VALUE *doc)
 
static bool db_json_get_bool_from_value (const JSON_VALUE *doc)
 
static char * db_json_bool_to_string (bool b)
 
static void db_json_array_push_back (const JSON_VALUE &value, JSON_VALUE &dest_array, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_object_add_member (const JSON_VALUE &name, const JSON_VALUE &value, JSON_VALUE &dest_object, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_merge_two_json_objects_preserve (const JSON_VALUE &source, JSON_VALUE &dest, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_merge_two_json_objects_patch (const JSON_VALUE &source, JSON_VALUE &dest, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_merge_two_json_array_values (const JSON_VALUE &source, JSON_VALUE &dest, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_merge_preserve_values (const JSON_VALUE &source, JSON_VALUE &dest, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_merge_patch_values (const JSON_VALUE &source, JSON_VALUE &dest, JSON_PRIVATE_MEMPOOL &allocator)
 
static void db_json_copy_doc (JSON_DOC &dest, const JSON_DOC *src)
 
static void db_json_get_paths_helper (const JSON_VALUE &obj, const std::string &sql_path, std::vector< std::string > &paths)
 
static void db_json_value_wrap_as_array (JSON_VALUE &value, JSON_PRIVATE_MEMPOOL &allocator)
 
static const char * db_json_get_json_type_as_str (const DB_JSON_TYPE &json_type)
 
static int db_json_er_set_path_does_not_exist (const char *file_name, const int line_no, const JSON_PATH &path, const JSON_DOC *doc)
 
static int db_json_er_set_expected_other_type (const char *file_name, const int line_no, const JSON_PATH &path, const DB_JSON_TYPE &found_type, const DB_JSON_TYPE &expected_type, const DB_JSON_TYPE &expected_type_optional=DB_JSON_NULL)
 
static int db_json_contains_duplicate_keys (const JSON_DOC &doc)
 
static int db_json_get_json_from_str (const char *json_raw, JSON_DOC &doc, size_t json_raw_length)
 
static int db_json_add_json_value_to_object (JSON_DOC &doc, const char *name, JSON_VALUE &value)
 
static int db_json_deserialize_doc_internal (OR_BUF *buf, JSON_VALUE &value, JSON_PRIVATE_MEMPOOL &doc_allocator)
 
static int db_json_or_buf_underflow (OR_BUF *buf, size_t length)
 
static int db_json_unpack_string_to_value (OR_BUF *buf, JSON_VALUE &value, JSON_PRIVATE_MEMPOOL &doc_allocator)
 
static int db_json_unpack_int_to_value (OR_BUF *buf, JSON_VALUE &value)
 
static int db_json_unpack_bigint_to_value (OR_BUF *buf, JSON_VALUE &value)
 
static int db_json_unpack_bool_to_value (OR_BUF *buf, JSON_VALUE &value)
 
static int db_json_unpack_object_to_value (OR_BUF *buf, JSON_VALUE &value, JSON_PRIVATE_MEMPOOL &doc_allocator)
 
static int db_json_unpack_array_to_value (OR_BUF *buf, JSON_VALUE &value, JSON_PRIVATE_MEMPOOL &doc_allocator)
 
static void db_json_add_element_to_array (JSON_DOC *doc, const JSON_VALUE *value)
 
void db_json_iterator_next (JSON_ITERATOR &json_itr)
 
const JSON_DOCdb_json_iterator_get_document (JSON_ITERATOR &json_itr)
 
bool db_json_iterator_has_next (JSON_ITERATOR &json_itr)
 
void db_json_set_iterator (JSON_ITERATOR *&json_itr, const JSON_DOC &new_doc)
 
void db_json_reset_iterator (JSON_ITERATOR *&json_itr)
 
bool db_json_iterator_is_empty (const JSON_ITERATOR &json_itr)
 
JSON_ITERATORdb_json_create_iterator (const DB_JSON_TYPE &type)
 
void db_json_delete_json_iterator (JSON_ITERATOR *&json_itr)
 
void db_json_clear_json_iterator (JSON_ITERATOR *&json_itr)
 
bool db_json_is_valid (const char *json_str)
 
const char * db_json_get_type_as_str (const JSON_DOC *document)
 
unsigned int db_json_get_length (const JSON_DOC *document)
 
unsigned int db_json_get_depth (const JSON_DOC *doc)
 
int db_json_unquote (const JSON_DOC &doc, char *&result_str)
 
int db_json_extract_document_from_path (const JSON_DOC *document, const std::string &path, JSON_DOC_STORE &result, bool allow_wildcards)
 
int db_json_extract_document_from_path (const JSON_DOC *document, const std::vector< std::string > &paths, JSON_DOC_STORE &result, bool allow_wildcards)
 
int db_json_contains_path (const JSON_DOC *document, const std::vector< std::string > &paths, bool find_all, bool &result)
 
char * db_json_get_raw_json_body_from_document (const JSON_DOC *doc)
 
char * db_json_get_json_body_from_document (const JSON_DOC &doc)
 
int db_json_add_member_to_object (JSON_DOC *doc, const char *name, const char *value)
 
int db_json_add_member_to_object (JSON_DOC *doc, const char *name, int value)
 
int db_json_add_member_to_object (JSON_DOC *doc, const char *name, std::int64_t value)
 
int db_json_add_member_to_object (JSON_DOC *doc, const char *name, const JSON_DOC *value)
 
int db_json_add_member_to_object (JSON_DOC *doc, const char *name, double value)
 
void db_json_add_element_to_array (JSON_DOC *doc, char *value)
 
void db_json_add_element_to_array (JSON_DOC *doc, int value)
 
void db_json_add_element_to_array (JSON_DOC *doc, std::int64_t value)
 
void db_json_add_element_to_array (JSON_DOC *doc, double value)
 
void db_json_add_element_to_array (JSON_DOC *doc, const JSON_DOC *value)
 
int db_json_get_json_from_str (const char *json_raw, JSON_DOC *&doc, size_t json_raw_length)
 
JSON_DOCdb_json_get_copy_of_doc (const JSON_DOC *doc)
 
int db_json_insert_func (const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
 
int db_json_replace_func (const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
 
int db_json_set_func (const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
 
int db_json_remove_func (JSON_DOC &doc, const char *raw_path)
 
int db_json_search_func (const JSON_DOC &doc, const DB_VALUE *pattern, const DB_VALUE *esc_char, std::vector< JSON_PATH > &paths, const std::vector< std::string > &patterns, bool find_all)
 
int db_json_array_append_func (const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
 
int db_json_array_insert_func (const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
 
int db_json_object_contains_key (JSON_DOC *obj, const char *key, int &result)
 
const char * db_json_get_schema_raw_from_validator (JSON_VALIDATOR *val)
 
int db_json_validate_json (const char *json_body)
 
JSON_DOCdb_json_allocate_doc ()
 
JSON_DOCdb_json_make_json_object ()
 
JSON_DOCdb_json_make_json_array ()
 
void db_json_delete_doc (JSON_DOC *&doc)
 
int db_json_load_validator (const char *json_schema_raw, JSON_VALIDATOR *&validator)
 
JSON_VALIDATORdb_json_copy_validator (JSON_VALIDATOR *validator)
 
int db_json_validate_doc (JSON_VALIDATOR *validator, JSON_DOC *doc)
 
void db_json_delete_validator (JSON_VALIDATOR *&validator)
 
bool db_json_are_validators_equal (JSON_VALIDATOR *val1, JSON_VALIDATOR *val2)
 
int db_json_merge_patch_func (const JSON_DOC *source, JSON_DOC *&dest)
 
int db_json_merge_preserve_func (const JSON_DOC *source, JSON_DOC *&dest)
 
DB_JSON_TYPE db_json_get_type (const JSON_DOC *doc)
 
int db_json_get_int_from_document (const JSON_DOC *doc)
 
std::int64_t db_json_get_bigint_from_document (const JSON_DOC *doc)
 
double db_json_get_double_from_document (const JSON_DOC *doc)
 
const char * db_json_get_string_from_document (const JSON_DOC *doc)
 
char * db_json_get_bool_as_str_from_document (const JSON_DOC *doc)
 
bool db_json_get_bool_from_document (const JSON_DOC *doc)
 
char * db_json_copy_string_from_document (const JSON_DOC *doc)
 
int db_json_normalize_path_string (const char *pointer_path, std::string &output)
 
int db_json_path_unquote_object_keys_external (std::string &sql_path)
 
bool db_json_path_contains_wildcard (const char *sql_path)
 
int db_json_get_all_paths_func (const JSON_DOC &doc, JSON_DOC *&result_json)
 
void db_json_pretty_func (const JSON_DOC &doc, char *&result_str)
 
std::string db_json_json_string_as_utf8 (std::string raw_json_string)
 
int db_json_keys_func (const JSON_DOC &doc, JSON_DOC &result_json, const char *raw_path)
 
int db_json_value_is_contained_in_doc (const JSON_DOC *doc, const JSON_DOC *value, bool &result)
 
void db_json_set_string_to_doc (JSON_DOC *doc, const char *str, unsigned len)
 
void db_json_set_double_to_doc (JSON_DOC *doc, double d)
 
void db_json_set_int_to_doc (JSON_DOC *doc, int i)
 
void db_json_set_bigint_to_doc (JSON_DOC *doc, std::int64_t i)
 
bool db_json_are_docs_equal (const JSON_DOC *doc1, const JSON_DOC *doc2)
 
void db_json_make_document_null (JSON_DOC *doc)
 
bool db_json_doc_has_numeric_type (const JSON_DOC *doc)
 
bool db_json_doc_is_uncomparable (const JSON_DOC *doc)
 
int db_value_to_json_path (const DB_VALUE &path_value, FUNC_TYPE fcode, std::string &path_str)
 
int db_value_to_json_doc (const DB_VALUE &db_val, bool force_copy, JSON_DOC_STORE &json_doc)
 
int db_value_to_json_value (const DB_VALUE &db_val, JSON_DOC_STORE &json_doc)
 
int db_value_to_json_key (const DB_VALUE &db_val, std::string &key_str)
 
void db_make_json_from_doc_store_and_release (DB_VALUE &value, JSON_DOC_STORE &doc_store)
 
int db_json_serialize (const JSON_DOC &doc, or_buf &buffer)
 
std::size_t db_json_serialize_length (const JSON_DOC &doc)
 
static int db_json_unpack_double_to_value (OR_BUF *buf, JSON_VALUE &value)
 
int db_json_deserialize (OR_BUF *buf, JSON_DOC *&doc)
 

Macro Definition Documentation

#define TODO_OPTIMIZE_JSON_BODY_STRING   true

Definition at line 75 of file db_json.cpp.

Typedef Documentation

typedef rapidjson::GenericMemberIterator<true, JSON_ENCODING, JSON_PRIVATE_MEMPOOL>::Iterator JSON_MEMBER_ITERATOR

Definition at line 89 of file db_json.cpp.

typedef rapidjson::GenericStringBuffer<JSON_ENCODING, JSON_PRIVATE_ALLOCATOR> JSON_STRING_BUFFER

Definition at line 88 of file db_json.cpp.

typedef rapidjson::GenericArray<true, JSON_VALUE>::ConstValueIterator JSON_VALUE_ITERATOR

Definition at line 90 of file db_json.cpp.

typedef std::function<int (const JSON_VALUE &, const JSON_PATH &, bool &)> map_func_type

Definition at line 92 of file db_json.cpp.

Function Documentation

static void db_json_add_element_to_array ( JSON_DOC doc,
const JSON_VALUE value 
)
static

Definition at line 1538 of file db_json.cpp.

References NULL.

Referenced by db_accumulate_json_arrayagg(), db_evaluate_json_array(), db_evaluate_json_search(), and db_json_extract_document_from_path().

Here is the caller graph for this function:

void db_json_add_element_to_array ( JSON_DOC doc,
char *  value 
)

Definition at line 1465 of file db_json.cpp.

References strlen.

void db_json_add_element_to_array ( JSON_DOC doc,
int  value 
)

Definition at line 1484 of file db_json.cpp.

void db_json_add_element_to_array ( JSON_DOC doc,
std::int64_t  value 
)

Definition at line 1495 of file db_json.cpp.

void db_json_add_element_to_array ( JSON_DOC doc,
double  value 
)

Definition at line 1506 of file db_json.cpp.

void db_json_add_element_to_array ( JSON_DOC doc,
const JSON_DOC value 
)

Definition at line 1517 of file db_json.cpp.

References NULL.

static int db_json_add_json_value_to_object ( JSON_DOC doc,
const char *  name,
JSON_VALUE value 
)
static

Definition at line 1386 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, ER_JSON_DUPLICATE_KEY, er_set(), NO_ERROR, and strlen.

Referenced by db_json_add_member_to_object().

Here is the caller graph for this function:

int db_json_add_member_to_object ( JSON_DOC doc,
const char *  name,
const char *  value 
)

Definition at line 1408 of file db_json.cpp.

References db_json_add_json_value_to_object(), and strlen.

Referenced by db_accumulate_json_objectagg(), and db_evaluate_json_object().

Here is the caller graph for this function:

int db_json_add_member_to_object ( JSON_DOC doc,
const char *  name,
int  value 
)

Definition at line 1418 of file db_json.cpp.

References db_json_add_json_value_to_object().

int db_json_add_member_to_object ( JSON_DOC doc,
const char *  name,
std::int64_t  value 
)

Definition at line 1428 of file db_json.cpp.

References db_json_add_json_value_to_object().

int db_json_add_member_to_object ( JSON_DOC doc,
const char *  name,
const JSON_DOC value 
)

Definition at line 1438 of file db_json.cpp.

References db_json_add_json_value_to_object(), and NULL.

int db_json_add_member_to_object ( JSON_DOC doc,
const char *  name,
double  value 
)

Definition at line 1455 of file db_json.cpp.

References db_json_add_json_value_to_object().

bool db_json_are_docs_equal ( const JSON_DOC doc1,
const JSON_DOC doc2 
)

Definition at line 3122 of file db_json.cpp.

References NULL.

bool db_json_are_validators_equal ( JSON_VALIDATOR val1,
JSON_VALIDATOR val2 
)

Definition at line 2401 of file db_json.cpp.

References JSON_VALIDATOR::get_schema_raw(), and NULL.

Referenced by tp_domain_match_internal(), and tp_is_domain_cached().

Here is the caller graph for this function:

static void db_json_array_push_back ( const JSON_VALUE value,
JSON_VALUE dest_array,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2275 of file db_json.cpp.

References assert.

Referenced by db_json_merge_preserve_values().

Here is the caller graph for this function:

static char * db_json_bool_to_string ( bool  b)
static

Definition at line 2682 of file db_json.cpp.

References db_private_strdup(), and NULL.

Referenced by db_json_get_bool_as_str_from_value().

Here is the caller graph for this function:

void db_json_clear_json_iterator ( JSON_ITERATOR *&  json_itr)

Definition at line 985 of file db_json.cpp.

References JSON_ITERATOR::clear_content(), and NULL.

Referenced by cubxasl::json_table::node::clear_iterators().

Here is the caller graph for this function:

static int db_json_contains_duplicate_keys ( const JSON_DOC doc)
static

Definition at line 1565 of file db_json.cpp.

References ASSERT_ERROR, NO_ERROR, and JSON_WALKER::WalkDocument().

Referenced by db_json_get_json_from_str().

Here is the caller graph for this function:

int db_json_contains_path ( const JSON_DOC document,
const std::vector< std::string > &  paths,
bool  find_all,
bool result 
)

Definition at line 1265 of file db_json.cpp.

References ASSERT_ERROR, i, JSON_PATH::match_pattern(), NO_ERROR, NULL, and JSON_WALKER::WalkDocument().

Referenced by db_evaluate_json_contains_path(), and cubxasl::json_table::column::evaluate_exists().

Here is the caller graph for this function:

static void db_json_copy_doc ( JSON_DOC dest,
const JSON_DOC src 
)
static

Definition at line 1643 of file db_json.cpp.

References db_json_get_type().

Referenced by db_json_merge_patch_func(), and db_json_merge_preserve_func().

Here is the caller graph for this function:

char* db_json_copy_string_from_document ( const JSON_DOC doc)

Definition at line 2561 of file db_json.cpp.

References db_json_copy_string_from_value().

char * db_json_copy_string_from_value ( const JSON_VALUE doc)
static

Definition at line 2669 of file db_json.cpp.

References assert, db_json_get_type_of_value(), db_private_strdup(), and NULL.

Referenced by db_json_copy_string_from_document().

Here is the caller graph for this function:

JSON_VALIDATOR* db_json_copy_validator ( JSON_VALIDATOR validator)

Definition at line 2382 of file db_json.cpp.

References JSON_VALIDATOR::JSON_VALIDATOR().

Referenced by tp_domain_copy().

Here is the caller graph for this function:

JSON_ITERATOR* db_json_create_iterator ( const DB_JSON_TYPE &  type)

Definition at line 963 of file db_json.cpp.

References NULL.

Referenced by cubxasl::json_table::node::init_iterator().

Here is the caller graph for this function:

void db_json_delete_doc ( JSON_DOC *&  doc)

Definition at line 2355 of file db_json.cpp.

References NULL.

Referenced by JSON_ITERATOR::clear_content(), db_json_deserialize(), mr_data_readmem_json(), mr_freemem_json(), pr_clear_value(), and tp_value_cast_internal().

Here is the caller graph for this function:

void db_json_delete_json_iterator ( JSON_ITERATOR *&  json_itr)

Definition at line 978 of file db_json.cpp.

References NULL.

Referenced by cubxasl::json_table::node::clear_iterators().

Here is the caller graph for this function:

void db_json_delete_validator ( JSON_VALIDATOR *&  validator)

Definition at line 2394 of file db_json.cpp.

References NULL.

Referenced by tp_domain_free().

Here is the caller graph for this function:

int db_json_deserialize ( OR_BUF buf,
JSON_DOC *&  doc 
)
bool db_json_doc_has_numeric_type ( const JSON_DOC doc)

Definition at line 3141 of file db_json.cpp.

References db_json_value_has_numeric_type().

bool db_json_doc_is_uncomparable ( const JSON_DOC doc)

Definition at line 3147 of file db_json.cpp.

References db_json_get_type().

Referenced by mr_cmpval_json().

Here is the caller graph for this function:

static int db_json_er_set_expected_other_type ( const char *  file_name,
const int  line_no,
const JSON_PATH path,
const DB_JSON_TYPE &  found_type,
const DB_JSON_TYPE &  expected_type,
const DB_JSON_TYPE &  expected_type_optional = DB_JSON_NULL 
)
static

Definition at line 2729 of file db_json.cpp.

References db_json_get_json_type_as_str(), JSON_PATH::dump_json_path(), ER_ERROR_SEVERITY, ER_JSON_EXPECTED_OTHER_TYPE, and er_set().

Referenced by db_json_insert_func(), and db_json_set_func().

Here is the caller graph for this function:

static int db_json_er_set_path_does_not_exist ( const char *  file_name,
const int  line_no,
const JSON_PATH path,
const JSON_DOC doc 
)
static
int db_json_extract_document_from_path ( const JSON_DOC document,
const std::string &  path,
JSON_DOC_STORE &  result,
bool  allow_wildcards 
)
int db_json_extract_document_from_path ( const JSON_DOC document,
const std::vector< std::string > &  paths,
JSON_DOC_STORE &  result,
bool  allow_wildcards 
)
int db_json_get_all_paths_func ( const JSON_DOC doc,
JSON_DOC *&  result_json 
)

Definition at line 2852 of file db_json.cpp.

References db_json_get_paths_helper(), JSON_PATH::get(), NO_ERROR, and p.

Referenced by db_evaluate_json_get_all_paths().

Here is the caller graph for this function:

std::int64_t db_json_get_bigint_from_document ( const JSON_DOC doc)

Definition at line 2531 of file db_json.cpp.

References db_json_get_bigint_from_value().

Referenced by db_convert_json_into_scalar(), and tp_value_cast_internal().

Here is the caller graph for this function:

std::int64_t db_json_get_bigint_from_value ( const JSON_VALUE val)
static

Definition at line 2626 of file db_json.cpp.

References assert, db_json_get_type_of_value(), and NULL.

Referenced by db_json_get_bigint_from_document(), and db_json_value_is_contained_in_doc_helper().

Here is the caller graph for this function:

char* db_json_get_bool_as_str_from_document ( const JSON_DOC doc)

Definition at line 2549 of file db_json.cpp.

References db_json_get_bool_as_str_from_value().

Referenced by db_convert_json_into_scalar(), and tp_value_cast_internal().

Here is the caller graph for this function:

char * db_json_get_bool_as_str_from_value ( const JSON_VALUE doc)
static

Definition at line 2688 of file db_json.cpp.

References db_json_bool_to_string(), and db_json_get_bool_from_value().

Referenced by db_json_get_bool_as_str_from_document().

Here is the caller graph for this function:

bool db_json_get_bool_from_document ( const JSON_DOC doc)

Definition at line 2555 of file db_json.cpp.

References db_json_get_bool_from_value().

Referenced by tp_value_cast_internal().

Here is the caller graph for this function:

bool db_json_get_bool_from_value ( const JSON_VALUE doc)
static

Definition at line 2694 of file db_json.cpp.

References assert, db_json_get_type_of_value(), and NULL.

Referenced by db_json_get_bool_as_str_from_value(), and db_json_get_bool_from_document().

Here is the caller graph for this function:

JSON_DOC* db_json_get_copy_of_doc ( const JSON_DOC doc)

Definition at line 1627 of file db_json.cpp.

References db_json_allocate_doc().

Referenced by db_get_deep_copy_of_json(), db_value_to_json_doc(), and mr_setval_json().

Here is the caller graph for this function:

unsigned int db_json_get_depth ( const JSON_DOC doc)

Definition at line 1079 of file db_json.cpp.

References db_json_value_get_depth().

Referenced by db_evaluate_json_depth().

Here is the caller graph for this function:

double db_json_get_double_from_document ( const JSON_DOC doc)

Definition at line 2537 of file db_json.cpp.

References db_json_get_double_from_value().

Referenced by db_convert_json_into_scalar(), and tp_value_cast_internal().

Here is the caller graph for this function:

double db_json_get_double_from_value ( const JSON_VALUE doc)
static

Definition at line 2640 of file db_json.cpp.

References assert, db_json_get_type_of_value(), and NULL.

Referenced by db_json_get_double_from_document(), and db_json_value_is_contained_in_doc_helper().

Here is the caller graph for this function:

int db_json_get_int_from_document ( const JSON_DOC doc)

Definition at line 2525 of file db_json.cpp.

References db_json_get_int_from_value().

Referenced by db_convert_json_into_scalar(), and tp_value_cast_internal().

Here is the caller graph for this function:

int db_json_get_int_from_value ( const JSON_VALUE val)
static

Definition at line 2612 of file db_json.cpp.

References assert, db_json_get_type_of_value(), and NULL.

Referenced by db_json_get_int_from_document(), and db_json_value_is_contained_in_doc_helper().

Here is the caller graph for this function:

char* db_json_get_json_body_from_document ( const JSON_DOC doc)

Definition at line 1370 of file db_json.cpp.

References db_json_get_raw_json_body_from_document().

Referenced by db_get_json_raw_body(), mr_cmpval_json(), and pt_bind_helper().

Here is the caller graph for this function:

static int db_json_get_json_from_str ( const char *  json_raw,
JSON_DOC doc,
size_t  json_raw_length 
)
static
int db_json_get_json_from_str ( const char *  json_raw,
JSON_DOC *&  doc,
size_t  json_raw_length 
)
static const char * db_json_get_json_type_as_str ( const DB_JSON_TYPE &  json_type)
static

Definition at line 1012 of file db_json.cpp.

Referenced by db_json_er_set_expected_other_type(), and db_json_get_type_as_str().

Here is the caller graph for this function:

unsigned int db_json_get_length ( const JSON_DOC document)

Definition at line 1046 of file db_json.cpp.

Referenced by db_evaluate_json_length().

Here is the caller graph for this function:

static void db_json_get_paths_helper ( const JSON_VALUE obj,
const std::string &  sql_path,
std::vector< std::string > &  paths 
)
static

Definition at line 2817 of file db_json.cpp.

References cubregex::count().

Referenced by db_json_get_all_paths_func().

Here is the caller graph for this function:

char* db_json_get_raw_json_body_from_document ( const JSON_DOC doc)
const char* db_json_get_schema_raw_from_validator ( JSON_VALIDATOR val)
const char* db_json_get_string_from_document ( const JSON_DOC doc)

Definition at line 2543 of file db_json.cpp.

References db_json_get_string_from_value().

Referenced by db_convert_json_into_scalar(), and tp_value_cast_internal().

Here is the caller graph for this function:

const char * db_json_get_string_from_value ( const JSON_VALUE doc)
static

Definition at line 2655 of file db_json.cpp.

References assert, db_json_get_type_of_value(), and NULL.

Referenced by db_json_get_string_from_document().

Here is the caller graph for this function:

const char* db_json_get_type_as_str ( const JSON_DOC document)

Definition at line 1002 of file db_json.cpp.

References assert, db_json_doc_to_value(), db_json_get_json_type_as_str(), db_json_get_type_of_value(), and NULL.

Referenced by db_evaluate_json_type_dbval().

Here is the caller graph for this function:

bool db_json_is_valid ( const char *  json_str)

Definition at line 994 of file db_json.cpp.

References db_json_validate_json(), error(), and NO_ERROR.

Referenced by db_evaluate_json_valid().

Here is the caller graph for this function:

const JSON_DOC* db_json_iterator_get_document ( JSON_ITERATOR json_itr)

Definition at line 930 of file db_json.cpp.

References JSON_ITERATOR::get_value_to_doc().

Referenced by cubscan::json_table::scanner::cursor::fetch_row().

Here is the caller graph for this function:

bool db_json_iterator_has_next ( JSON_ITERATOR json_itr)

Definition at line 936 of file db_json.cpp.

References JSON_ITERATOR::has_next().

Referenced by cubscan::json_table::scanner::cursor::advance_row_cursor().

Here is the caller graph for this function:

bool db_json_iterator_is_empty ( const JSON_ITERATOR json_itr)

Definition at line 957 of file db_json.cpp.

References JSON_ITERATOR::is_empty().

void db_json_iterator_next ( JSON_ITERATOR json_itr)

Definition at line 924 of file db_json.cpp.

References JSON_ITERATOR::next().

Referenced by cubscan::json_table::scanner::cursor::advance_row_cursor().

Here is the caller graph for this function:

std::string db_json_json_string_as_utf8 ( std::string  raw_json_string)

Definition at line 2893 of file db_json.cpp.

References assert, db_json_get_json_from_str(), and NO_ERROR.

Referenced by db_json_search_func(), JSON_PATH::erase(), JSON_PATH::extract_from_subtree(), JSON_PATH::get(), and JSON_PATH::set().

Here is the caller graph for this function:

int db_json_keys_func ( const JSON_DOC doc,
JSON_DOC result_json,
const char *  raw_path 
)

Definition at line 2919 of file db_json.cpp.

References ARG_FILE_LINE, ASSERT_ERROR, db_json_er_set_path_does_not_exist(), JSON_PATH::get(), NO_ERROR, NULL, p, and JSON_PATH::parse().

Referenced by db_evaluate_json_keys().

Here is the caller graph for this function:

int db_json_load_validator ( const char *  json_schema_raw,
JSON_VALIDATOR *&  validator 
)
void db_json_make_document_null ( JSON_DOC doc)

Definition at line 3132 of file db_json.cpp.

References NULL.

Referenced by db_value_to_json_doc(), and db_value_to_json_value().

Here is the caller graph for this function:

JSON_DOC* db_json_make_json_array ( )

Definition at line 2347 of file db_json.cpp.

Referenced by db_evaluate_json_array().

Here is the caller graph for this function:

JSON_DOC* db_json_make_json_object ( )

Definition at line 2339 of file db_json.cpp.

Referenced by db_evaluate_json_object().

Here is the caller graph for this function:

int db_json_merge_patch_func ( const JSON_DOC source,
JSON_DOC *&  dest 
)

Definition at line 2469 of file db_json.cpp.

References db_json_allocate_doc(), db_json_copy_doc(), db_json_doc_to_value(), db_json_merge_patch_values(), NO_ERROR, and NULL.

Referenced by db_evaluate_json_merge_patch().

Here is the caller graph for this function:

static void db_json_merge_patch_values ( const JSON_VALUE source,
JSON_VALUE dest,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2438 of file db_json.cpp.

References db_json_merge_two_json_objects_patch().

Referenced by db_json_merge_patch_func(), and db_json_merge_two_json_objects_patch().

Here is the caller graph for this function:

int db_json_merge_preserve_func ( const JSON_DOC source,
JSON_DOC *&  dest 
)

Definition at line 2501 of file db_json.cpp.

References db_json_allocate_doc(), db_json_copy_doc(), db_json_doc_to_value(), db_json_merge_preserve_values(), NO_ERROR, and NULL.

Referenced by db_evaluate_json_merge_preserve().

Here is the caller graph for this function:

static void db_json_merge_preserve_values ( const JSON_VALUE source,
JSON_VALUE dest,
JSON_PRIVATE_MEMPOOL allocator 
)
static
static void db_json_merge_two_json_array_values ( const JSON_VALUE source,
JSON_VALUE dest,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2258 of file db_json.cpp.

References assert.

Referenced by db_json_merge_preserve_values().

Here is the caller graph for this function:

void db_json_merge_two_json_objects_patch ( const JSON_VALUE source,
JSON_VALUE dest,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2186 of file db_json.cpp.

References assert, db_json_merge_patch_values(), and db_json_object_add_member().

Referenced by db_json_merge_patch_values().

Here is the caller graph for this function:

void db_json_merge_two_json_objects_preserve ( const JSON_VALUE source,
JSON_VALUE dest,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2229 of file db_json.cpp.

References assert, db_json_merge_preserve_values(), and db_json_object_add_member().

Referenced by db_json_merge_preserve_values().

Here is the caller graph for this function:

int db_json_normalize_path_string ( const char *  pointer_path,
std::string &  output 
)

Definition at line 2749 of file db_json.cpp.

References ASSERT_ERROR, JSON_PATH::dump_json_path(), NO_ERROR, and JSON_PATH::parse().

Referenced by pt_normalize_path().

Here is the caller graph for this function:

static void db_json_object_add_member ( const JSON_VALUE name,
const JSON_VALUE value,
JSON_VALUE dest_object,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 2287 of file db_json.cpp.

References assert.

Referenced by db_json_merge_two_json_objects_patch(), and db_json_merge_two_json_objects_preserve().

Here is the caller graph for this function:

int db_json_object_contains_key ( JSON_DOC obj,
const char *  key,
int &  result 
)
static int db_json_or_buf_underflow ( OR_BUF buf,
size_t  length 
)
static

Definition at line 3966 of file db_json.cpp.

References or_buf::endptr, NO_ERROR, or_underflow(), and or_buf::ptr.

Referenced by db_json_unpack_string_to_value().

Here is the caller graph for this function:

bool db_json_path_contains_wildcard ( const char *  sql_path)

Definition at line 2776 of file db_json.cpp.

References i, and NULL.

Referenced by pt_make_json_table_spec_node_internal().

Here is the caller graph for this function:

int db_json_path_unquote_object_keys_external ( std::string &  sql_path)

Definition at line 2765 of file db_json.cpp.

References db_json_path_unquote_object_keys().

Referenced by db_evaluate_json_search().

Here is the caller graph for this function:

void db_json_pretty_func ( const JSON_DOC doc,
char *&  result_str 
)

Definition at line 2881 of file db_json.cpp.

References assert, db_private_strdup(), NULL, and JSON_PRETTY_WRITER::ToString().

Referenced by db_evaluate_json_pretty().

Here is the caller graph for this function:

void db_json_reset_iterator ( JSON_ITERATOR *&  json_itr)

Definition at line 948 of file db_json.cpp.

References NULL, and JSON_ITERATOR::reset().

Referenced by cubscan::json_table::scanner::cursor::end().

Here is the caller graph for this function:

int db_json_search_func ( const JSON_DOC doc,
const DB_VALUE pattern,
const DB_VALUE esc_char,
std::vector< JSON_PATH > &  paths,
const std::vector< std::string > &  patterns,
bool  find_all 
)
int db_json_serialize ( const JSON_DOC doc,
or_buf buffer 
)

Definition at line 3931 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, and NO_ERROR.

Referenced by mr_data_writemem_json(), and mr_data_writeval_json().

Here is the caller graph for this function:

std::size_t db_json_serialize_length ( const JSON_DOC doc)

Definition at line 3946 of file db_json.cpp.

References JSON_SERIALIZER_LENGTH::GetLength().

Referenced by mr_data_lengthmem_json(), and mr_data_lengthval_json().

Here is the caller graph for this function:

void db_json_set_bigint_to_doc ( JSON_DOC doc,
std::int64_t  i 
)

Definition at line 3116 of file db_json.cpp.

Referenced by tp_value_cast_internal().

Here is the caller graph for this function:

void db_json_set_double_to_doc ( JSON_DOC doc,
double  d 
)

Definition at line 3104 of file db_json.cpp.

Referenced by tp_value_cast_internal().

Here is the caller graph for this function:

void db_json_set_int_to_doc ( JSON_DOC doc,
int  i 
)

Definition at line 3110 of file db_json.cpp.

Referenced by tp_value_cast_internal().

Here is the caller graph for this function:

void db_json_set_iterator ( JSON_ITERATOR *&  json_itr,
const JSON_DOC new_doc 
)

Definition at line 942 of file db_json.cpp.

References JSON_ITERATOR::set().

Referenced by cubscan::json_table::scanner::cursor::start_json_iterator().

Here is the caller graph for this function:

void db_json_set_string_to_doc ( JSON_DOC doc,
const char *  str,
unsigned  len 
)

Definition at line 3098 of file db_json.cpp.

Referenced by db_value_to_json_value().

Here is the caller graph for this function:

static int db_json_unpack_array_to_value ( OR_BUF buf,
JSON_VALUE value,
JSON_PRIVATE_MEMPOOL doc_allocator 
)
static

Definition at line 4154 of file db_json.cpp.

References ARG_FILE_LINE, db_json_deserialize_doc_internal(), ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, i, NO_ERROR, or_get_int(), and rc.

Referenced by db_json_deserialize_doc_internal().

Here is the caller graph for this function:

static int db_json_unpack_bigint_to_value ( OR_BUF buf,
JSON_VALUE value 
)
static

Definition at line 4044 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, NO_ERROR, or_get_bigint(), or_get_int(), and rc.

Referenced by db_json_deserialize_doc_internal().

Here is the caller graph for this function:

static int db_json_unpack_bool_to_value ( OR_BUF buf,
JSON_VALUE value 
)
static

Definition at line 4091 of file db_json.cpp.

References ARG_FILE_LINE, assert, ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, NO_ERROR, or_get_int(), and rc.

Referenced by db_json_deserialize_doc_internal().

Here is the caller graph for this function:

static int db_json_unpack_double_to_value ( OR_BUF buf,
JSON_VALUE value 
)
static

Definition at line 4072 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, NO_ERROR, or_get_double(), and rc.

Referenced by db_json_deserialize_doc_internal().

Here is the caller graph for this function:

static int db_json_unpack_int_to_value ( OR_BUF buf,
JSON_VALUE value 
)
static

Definition at line 4016 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ER_TF_BUFFER_OVERFLOW, NO_ERROR, or_get_int(), and rc.

Referenced by db_json_deserialize_doc_internal().

Here is the caller graph for this function:

static int db_json_unpack_object_to_value ( OR_BUF buf,
JSON_VALUE value,
JSON_PRIVATE_MEMPOOL doc_allocator 
)
static
static int db_json_unpack_string_to_value ( OR_BUF buf,
JSON_VALUE value,
JSON_PRIVATE_MEMPOOL doc_allocator 
)
static
int db_json_unquote ( const JSON_DOC doc,
char *&  result_str 
)

Definition at line 1090 of file db_json.cpp.

References assert, db_json_get_raw_json_body_from_document(), db_private_strdup(), ER_OUT_OF_VIRTUAL_MEMORY, NO_ERROR, and NULL.

Referenced by db_evaluate_json_unquote().

Here is the caller graph for this function:

int db_json_validate_doc ( JSON_VALIDATOR validator,
JSON_DOC doc 
)

Definition at line 2388 of file db_json.cpp.

References JSON_VALIDATOR::validate().

Referenced by tp_value_cast_internal().

Here is the caller graph for this function:

int db_json_validate_json ( const char *  json_body)

Definition at line 2316 of file db_json.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, ER_JSON_INVALID_JSON, er_set(), and NO_ERROR.

Referenced by db_json_is_valid(), pt_bind_helper(), and pt_dbval_to_value().

Here is the caller graph for this function:

static unsigned int db_json_value_get_depth ( const JSON_VALUE doc)
static

Definition at line 1111 of file db_json.cpp.

References max.

Referenced by db_json_get_depth().

Here is the caller graph for this function:

bool db_json_value_has_numeric_type ( const JSON_VALUE doc)
static

Definition at line 2953 of file db_json.cpp.

References db_json_get_type_of_value().

Referenced by db_json_doc_has_numeric_type(), and db_json_value_is_contained_in_doc_helper().

Here is the caller graph for this function:

int db_json_value_is_contained_in_doc ( const JSON_DOC doc,
const JSON_DOC value,
bool result 
)

Definition at line 2976 of file db_json.cpp.

References db_json_value_is_contained_in_doc_helper().

Referenced by db_evaluate_json_contains().

Here is the caller graph for this function:

int db_json_value_is_contained_in_doc_helper ( const JSON_VALUE doc,
const JSON_VALUE value,
bool result 
)
static
static void db_json_value_wrap_as_array ( JSON_VALUE value,
JSON_PRIVATE_MEMPOOL allocator 
)
static

Definition at line 3339 of file db_json.cpp.

Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), db_json_merge_preserve_values(), and db_json_set_func().

Here is the caller graph for this function:

int db_value_to_json_key ( const DB_VALUE db_val,
std::string &  key_str 
)