Skip to content

File db_json.hpp

FileList > compat > db_json.hpp

Go to the source code of this file

  • #include "error_manager.h"
  • #include "memory_reference_store.hpp"
  • #include "db_function.hpp"
  • #include "storage_common.h"
  • #include <cstdint>
  • #include <string>
  • #include <vector>

Public Types

Type Name
enum DB_JSON_TYPE
typedef cubmem::reference_store< JSON_DOC > JSON_DOC_STORE

Public Functions

Type Name
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_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, double value)
int db_json_add_member_to_object (JSON_DOC * doc, const char * name, const JSON_DOC * value)
JSON_DOC * db_json_allocate_doc ()
bool db_json_are_docs_equal (const JSON_DOC * doc1, const JSON_DOC * doc2)
bool db_json_are_validators_equal (JSON_VALIDATOR * val1, JSON_VALIDATOR * val2)
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)
void db_json_clear_json_iterator (JSON_ITERATOR *& json_itr)
int db_json_contains_path (const JSON_DOC * document, const std::vector< std::string > & paths, bool find_all, bool & result)
int db_json_convert_string_and_call (const char * json_raw, size_t json_raw_length, Fn && func, Args &&... args)
char * db_json_copy_string_from_document (const JSON_DOC * doc)
JSON_VALIDATOR * db_json_copy_validator (JSON_VALIDATOR * validator)
JSON_ITERATOR * db_json_create_iterator (const DB_JSON_TYPE & type)
void db_json_delete_doc (JSON_DOC *& doc)
void db_json_delete_json_iterator (JSON_ITERATOR *& json_itr)
void db_json_delete_validator (JSON_VALIDATOR *& validator)
int db_json_deserialize (or_buf * buf, 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_json_extract_document_from_path (const JSON_DOC * document, const std::vector< std::string > & raw_path, JSON_DOC_STORE & result, bool allow_wildcards=true)
int db_json_extract_document_from_path (const JSON_DOC * document, const std::string & path, JSON_DOC_STORE & result, bool allow_wildcards=true)
int db_json_get_all_paths_func (const JSON_DOC & doc, JSON_DOC *& result_json)
std::int64_t db_json_get_bigint_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)
JSON_DOC * db_json_get_copy_of_doc (const JSON_DOC * doc)
unsigned int db_json_get_depth (const JSON_DOC * doc)
double db_json_get_double_from_document (const JSON_DOC * doc)
int db_json_get_int_from_document (const JSON_DOC * doc)
char * db_json_get_json_body_from_document (const JSON_DOC & doc)
int db_json_get_json_from_str (const char * json_raw, JSON_DOC *& doc, size_t json_raw_length)
unsigned int db_json_get_length (const JSON_DOC * document)
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)
DB_JSON_TYPE db_json_get_type (const JSON_DOC * doc)
const char * db_json_get_type_as_str (const JSON_DOC * document)
int db_json_insert_func (const JSON_DOC * doc_to_be_inserted, JSON_DOC & doc_destination, const char * raw_path)
bool db_json_is_valid (const char * json_str)
const JSON_DOC * db_json_iterator_get_document (JSON_ITERATOR & json_itr)
bool db_json_iterator_has_next (JSON_ITERATOR & json_itr)
bool db_json_iterator_is_empty (const JSON_ITERATOR & json_itr)
void db_json_iterator_next (JSON_ITERATOR & json_itr)
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_load_validator (const char * json_schema_raw, JSON_VALIDATOR *& validator)
void db_json_make_document_null (JSON_DOC * doc)
JSON_DOC * db_json_make_json_array ()
JSON_DOC * db_json_make_json_object ()
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)
int db_json_normalize_path_string (const char * pointer_path, std::string & normalized_path)
int db_json_object_contains_key (JSON_DOC * obj, const char * key, int & result)
bool db_json_path_contains_wildcard (const char * sql_path)
int db_json_path_unquote_object_keys_external (std::string & sql_path)
void db_json_pretty_func (const JSON_DOC & doc, char *& result_str)
int db_json_remove_func (JSON_DOC & doc, const char * raw_path)
int db_json_replace_func (const JSON_DOC * value, JSON_DOC & doc, const char * raw_path)
void db_json_reset_iterator (JSON_ITERATOR *& json_itr)
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)
std::size_t db_json_serialize_length (const JSON_DOC & doc)
void db_json_set_bigint_to_doc (JSON_DOC * doc, std::int64_t i)
void db_json_set_double_to_doc (JSON_DOC * doc, double d)
int db_json_set_func (const JSON_DOC * value, JSON_DOC & doc, const char * raw_path)
void db_json_set_int_to_doc (JSON_DOC * doc, int i)
void db_json_set_iterator (JSON_ITERATOR *& json_itr, const JSON_DOC & new_doc)
void db_json_set_string_to_doc (JSON_DOC * doc, const char * str, unsigned len)
int db_json_unquote (const JSON_DOC & doc, char *& result_str)
int db_json_validate_doc (JSON_VALIDATOR * validator, JSON_DOC * doc)
int db_json_validate_json (const char * json_body)
int db_json_value_is_contained_in_doc (const JSON_DOC * doc, const JSON_DOC * value, bool & result)
void db_make_json_from_doc_store_and_release (DB_VALUE & value, JSON_DOC_STORE & doc_store)
int db_value_to_json_doc (const DB_VALUE & db_val, bool copy_json, JSON_DOC_STORE & json_doc)
int db_value_to_json_key (const DB_VALUE & db_val, std::string & key_str)
int db_value_to_json_path (const DB_VALUE & path_value, FUNC_CODE fcode, std::string & path_str)
int db_value_to_json_value (const DB_VALUE & db_val, JSON_DOC_STORE & json_doc)

Public Types Documentation

enum DB_JSON_TYPE

enum DB_JSON_TYPE {
    DB_JSON_NULL = 0,
    DB_JSON_UNKNOWN,
    DB_JSON_INT,
    DB_JSON_BIGINT,
    DB_JSON_DOUBLE,
    DB_JSON_STRING,
    DB_JSON_OBJECT,
    DB_JSON_ARRAY,
    DB_JSON_BOOL
};

typedef JSON_DOC_STORE

using JSON_DOC_STORE =  cubmem::reference_store<JSON_DOC>;

Public Functions Documentation

function db_json_add_element_to_array

void db_json_add_element_to_array (
    JSON_DOC * doc,
    char * value
) 

function db_json_add_element_to_array

void db_json_add_element_to_array (
    JSON_DOC * doc,
    int value
) 

function db_json_add_element_to_array

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

function db_json_add_element_to_array

void db_json_add_element_to_array (
    JSON_DOC * doc,
    double value
) 

function db_json_add_element_to_array

void db_json_add_element_to_array (
    JSON_DOC * doc,
    const  JSON_DOC * value
) 

function db_json_add_member_to_object

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

function db_json_add_member_to_object

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

function db_json_add_member_to_object

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

function db_json_add_member_to_object

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

function db_json_add_member_to_object

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

function db_json_allocate_doc

JSON_DOC * db_json_allocate_doc () 

function db_json_are_docs_equal

bool db_json_are_docs_equal (
    const  JSON_DOC * doc1,
    const  JSON_DOC * doc2
) 

function db_json_are_validators_equal

bool db_json_are_validators_equal (
    JSON_VALIDATOR * val1,
    JSON_VALIDATOR * val2
) 

function db_json_array_append_func

int db_json_array_append_func (
    const  JSON_DOC * value,
    JSON_DOC & doc,
    const  char * raw_path
) 

function db_json_array_insert_func

int db_json_array_insert_func (
    const  JSON_DOC * value,
    JSON_DOC & doc,
    const  char * raw_path
) 

function db_json_clear_json_iterator

void db_json_clear_json_iterator (
    JSON_ITERATOR *& json_itr
) 

function db_json_contains_path

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

function db_json_convert_string_and_call

template<typename  Fn, typename... Args>
inline int db_json_convert_string_and_call (
    const  char * json_raw,
    size_t json_raw_length,
    Fn && func,
    Args &&... args
) 

function db_json_copy_string_from_document

char * db_json_copy_string_from_document (
    const  JSON_DOC * doc
) 

function db_json_copy_validator

JSON_VALIDATOR * db_json_copy_validator (
    JSON_VALIDATOR * validator
) 

function db_json_create_iterator

JSON_ITERATOR * db_json_create_iterator (
    const  DB_JSON_TYPE & type
) 

function db_json_delete_doc

void db_json_delete_doc (
    JSON_DOC *& doc
) 

function db_json_delete_json_iterator

void db_json_delete_json_iterator (
    JSON_ITERATOR *& json_itr
) 

function db_json_delete_validator

void db_json_delete_validator (
    JSON_VALIDATOR *& validator
) 

function db_json_deserialize

int db_json_deserialize (
    or_buf * buf,
    JSON_DOC *& doc
) 

function db_json_doc_has_numeric_type

bool db_json_doc_has_numeric_type (
    const  JSON_DOC * doc
) 

function db_json_doc_is_uncomparable

bool db_json_doc_is_uncomparable (
    const  JSON_DOC * doc
) 

function db_json_extract_document_from_path

int db_json_extract_document_from_path (
    const  JSON_DOC * document,
    const std::vector< std::string > & raw_path,
    JSON_DOC_STORE & result,
    bool allow_wildcards=true
) 

function db_json_extract_document_from_path

int db_json_extract_document_from_path (
    const  JSON_DOC * document,
    const std::string & path,
    JSON_DOC_STORE & result,
    bool allow_wildcards=true
) 

function db_json_get_all_paths_func

int db_json_get_all_paths_func (
    const  JSON_DOC & doc,
    JSON_DOC *& result_json
) 

function db_json_get_bigint_from_document

std::int64_t db_json_get_bigint_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_bool_as_str_from_document

char * db_json_get_bool_as_str_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_bool_from_document

bool db_json_get_bool_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_copy_of_doc

JSON_DOC * db_json_get_copy_of_doc (
    const  JSON_DOC * doc
) 

function db_json_get_depth

unsigned  int db_json_get_depth (
    const  JSON_DOC * doc
) 

function db_json_get_double_from_document

double db_json_get_double_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_int_from_document

int db_json_get_int_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_json_body_from_document

char * db_json_get_json_body_from_document (
    const  JSON_DOC & doc
) 

function db_json_get_json_from_str

int db_json_get_json_from_str (
    const  char * json_raw,
    JSON_DOC *& doc,
    size_t json_raw_length
) 

function db_json_get_length

unsigned  int db_json_get_length (
    const  JSON_DOC * document
) 

function db_json_get_raw_json_body_from_document

char * db_json_get_raw_json_body_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_schema_raw_from_validator

const  char * db_json_get_schema_raw_from_validator (
    JSON_VALIDATOR * val
) 

function db_json_get_string_from_document

const  char * db_json_get_string_from_document (
    const  JSON_DOC * doc
) 

function db_json_get_type

DB_JSON_TYPE db_json_get_type (
    const  JSON_DOC * doc
) 

function db_json_get_type_as_str

const  char * db_json_get_type_as_str (
    const  JSON_DOC * document
) 

function db_json_insert_func

int db_json_insert_func (
    const  JSON_DOC * doc_to_be_inserted,
    JSON_DOC & doc_destination,
    const  char * raw_path
) 

function db_json_is_valid

bool db_json_is_valid (
    const  char * json_str
) 

function db_json_iterator_get_document

const  JSON_DOC * db_json_iterator_get_document (
    JSON_ITERATOR & json_itr
) 

function db_json_iterator_has_next

bool db_json_iterator_has_next (
    JSON_ITERATOR & json_itr
) 

function db_json_iterator_is_empty

bool db_json_iterator_is_empty (
    const  JSON_ITERATOR & json_itr
) 

function db_json_iterator_next

void db_json_iterator_next (
    JSON_ITERATOR & json_itr
) 

function db_json_json_string_as_utf8

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

function db_json_keys_func

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

function db_json_load_validator

int db_json_load_validator (
    const  char * json_schema_raw,
    JSON_VALIDATOR *& validator
) 

function db_json_make_document_null

void db_json_make_document_null (
    JSON_DOC * doc
) 

function db_json_make_json_array

JSON_DOC * db_json_make_json_array () 

function db_json_make_json_object

JSON_DOC * db_json_make_json_object () 

function db_json_merge_patch_func

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

function db_json_merge_preserve_func

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

function db_json_normalize_path_string

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

function db_json_object_contains_key

int db_json_object_contains_key (
    JSON_DOC * obj,
    const  char * key,
    int & result
) 

function db_json_path_contains_wildcard

bool db_json_path_contains_wildcard (
    const  char * sql_path
) 

function db_json_path_unquote_object_keys_external

int db_json_path_unquote_object_keys_external (
    std::string & sql_path
) 

function db_json_pretty_func

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

function db_json_remove_func

int db_json_remove_func (
    JSON_DOC & doc,
    const  char * raw_path
) 

function db_json_replace_func

int db_json_replace_func (
    const  JSON_DOC * value,
    JSON_DOC & doc,
    const  char * raw_path
) 

function db_json_reset_iterator

void db_json_reset_iterator (
    JSON_ITERATOR *& json_itr
) 

function db_json_search_func

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
) 

function db_json_serialize

int db_json_serialize (
    const  JSON_DOC & doc,
    or_buf & buffer
) 

function db_json_serialize_length

std::size_t db_json_serialize_length (
    const  JSON_DOC & doc
) 

function db_json_set_bigint_to_doc

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

function db_json_set_double_to_doc

void db_json_set_double_to_doc (
    JSON_DOC * doc,
    double d
) 

function db_json_set_func

int db_json_set_func (
    const  JSON_DOC * value,
    JSON_DOC & doc,
    const  char * raw_path
) 

function db_json_set_int_to_doc

void db_json_set_int_to_doc (
    JSON_DOC * doc,
    int i
) 

function db_json_set_iterator

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

function db_json_set_string_to_doc

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

function db_json_unquote

int db_json_unquote (
    const  JSON_DOC & doc,
    char *& result_str
) 

function db_json_validate_doc

int db_json_validate_doc (
    JSON_VALIDATOR * validator,
    JSON_DOC * doc
) 

function db_json_validate_json

int db_json_validate_json (
    const  char * json_body
) 

function db_json_value_is_contained_in_doc

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

function db_make_json_from_doc_store_and_release

void db_make_json_from_doc_store_and_release (
    DB_VALUE & value,
    JSON_DOC_STORE & doc_store
) 

function db_value_to_json_doc

int db_value_to_json_doc (
    const  DB_VALUE & db_val,
    bool copy_json,
    JSON_DOC_STORE & json_doc
) 

function db_value_to_json_key

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

function db_value_to_json_path

int db_value_to_json_path (
    const  DB_VALUE & path_value,
    FUNC_CODE fcode,
    std::string & path_str
) 

function db_value_to_json_value

int db_value_to_json_value (
    const  DB_VALUE & db_val,
    JSON_DOC_STORE & json_doc
) 


The documentation for this class was generated from the following file cubrid/src/compat/db_json.hpp