55 #if defined (SUPPRESS_STRLEN_WARNING) 56 #define strlen(s1) ((int) strlen(s1)) 68 static int move_n_days (
int *monthp,
int *dayp,
int *yearp,
const int interval);
147 bool decrement =
false;
149 num_str_p = num_str + 1;
151 num_str_len =
strlen (num_str_p);
153 num_str_p += num_str_len - s;
157 if (*num_str_p !=
'0')
166 if (decrement && num_str[1] ==
'-')
170 char *num_str_digits = num_str + num_str_len -
p;
173 num_str_p = num_str + num_str_len - s;
174 while (*num_str_p ==
'9')
179 if (*num_str_p ==
'-')
190 if (carry || num_str_p <= num_str_digits)
199 num_str[num_str_len] =
'\0';
209 num_str_p = num_str + 1;
313 bool increment =
false;
315 num_str_p = num_str + 1;
317 if (num_str_p[0] ==
'-')
322 num_str_len =
strlen (num_str_p);
323 num_str_p += num_str_len - s;
327 if (*num_str_p !=
'0')
339 if (num_str[1] ==
'-')
348 char *num_str_digits = num_str + 1 + num_str_len -
p;
352 num_str_p += num_str_len - s;
354 while (*num_str_p ==
'9')
365 if (carry || num_str_p < num_str_digits)
378 num_str[num_str_len] =
'\0';
384 num_str_p = num_str + 1;
595 bitmp = llabs (bitmp);
680 dtmp = exp ((
double) s);
684 dtmp = exp ((
double) i);
688 dtmp = exp ((
double) bi);
756 dtmp = sqrt ((
double) s);
764 dtmp = sqrt ((
double) i);
772 dtmp = sqrt ((
double) bi);
859 if (d1 < 0 && d2 != ceil (d2))
996 value2 = &cast_value2;
1019 dtmp = fmod ((
double) s1, d2);
1058 #if !defined(NDEBUG) 1078 #if !defined(NDEBUG) 1145 value2 = &cast_value2;
1168 dtmp = fmod ((
double) i1, d2);
1207 #if !defined(NDEBUG) 1227 #if !defined(NDEBUG) 1278 db_make_float (result, (
float) fmod ((
double) bi1, (
double) f2));
1294 value2 = &cast_value2;
1317 dtmp = fmod ((
double) bi1, d2);
1356 #if !defined(NDEBUG) 1372 #if !defined(NDEBUG) 1412 db_make_float (result, (
float) fmod ((
double) f1, (
double) bi2));
1439 value2 = &cast_value2;
1500 #if !defined(NDEBUG) 1516 #if !defined(NDEBUG) 1583 value2 = &cast_value2;
1651 #if !defined(NDEBUG) 1665 value1 = &cast_value1;
1680 #if !defined(NDEBUG) 1700 #if !defined(NDEBUG) 1718 dtmp = fmod (d1, (
double) s2);
1731 dtmp = fmod (d1, (
double) i2);
1744 dtmp = fmod (d1, (
double) bi2);
1774 value2 = &cast_value2;
1797 dtmp = fmod (d1, d2);
1837 #if !defined(NDEBUG) 1849 #if !defined(NDEBUG) 1885 value2 = &cast_value2;
1993 volatile double scale_up, result;
2000 scale_up = pow (10, integer);
2002 if (!
FINITE (num * scale_up))
2007 result = round (num * scale_up) / scale_up;
2059 int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0, millisecond = 0;
2095 db_datetime_decode (pdatetime, &month, &day, &year, &hour, &minute, &second, &millisecond);
2107 db_datetime_decode (&local_dt, &month, &day, &year, &hour, &minute, &second, &millisecond);
2120 db_datetime_decode (&local_dt, &month, &day, &year, &hour, &minute, &second, &millisecond);
2126 hour = minute = second = millisecond = 0;
2206 if (millisecond >= 500)
2228 if (month < 2 || (month == 2 && day < 16))
2232 else if (month < 5 || (month == 5 && day < 16))
2236 else if (month < 8 || (month == 8 && day < 16))
2240 else if (month < 11 || (month == 11 && day < 16))
2266 error =
move_n_days (&month, &day, &year, -weekday);
2270 error =
move_n_days (&month, &day, &year, 7 - weekday);
2285 if (year < 0 || year > 9999)
2321 double d1, d2 = 0.0;
2352 value2 = &cast_format;
2377 value1 = &cast_value;
2402 value2 = &cast_format;
2425 value2 = &cast_format;
2474 value1 = &cast_value;
2483 memset (num_string, 0,
sizeof (num_string));
2487 end = num_string +
strlen (num_string);
2505 ptr = end - s + bi2;
2512 else if (ptr < num_string)
2514 memset (num_string, 0,
sizeof (num_string));
2531 for (ptr = end - s + bi2 - 1; ptr >= num_string && !done; ptr--)
2544 for (ptr = num_string; ptr < end; ptr++)
2546 if (
'1' <= *ptr && *ptr <=
'9')
2638 dtmp = log10 ((
double) s2) / log10 ((
double) s1);
2646 dtmp = log10 ((
double) i2) / log10 ((
double) s1);
2654 dtmp = log10 ((
double) bi2) / log10 ((
double) s1);
2662 dtmp = log10 ((
double) f2) / log10 ((
double) s1);
2670 dtmp = log10 ((
double) d2) / log10 ((
double) s1);
2678 dtmp = log10 ((
double) d2) / log10 ((
double) s1);
2686 dtmp = log10 (d2) / log10 ((
double) s1);
2709 dtmp = log10 ((
double) s2) / log10 ((
double) bi1);
2717 dtmp = log10 ((
double) i2) / log10 ((
double) bi1);
2725 dtmp = log10 ((
double) bi2) / log10 ((
double) bi1);
2733 dtmp = log10 ((
double) f2) / log10 ((
double) bi1);
2741 dtmp = log10 ((
double) d2) / log10 ((
double) bi1);
2749 dtmp = log10 ((
double) d2) / log10 ((
double) bi1);
2757 dtmp = log10 (d2) / log10 ((
double) bi1);
2780 dtmp = log10 ((
double) s2) / log10 ((
double) i1);
2788 dtmp = log10 ((
double) i2) / log10 ((
double) i1);
2796 dtmp = log10 ((
double) bi2) / log10 ((
double) i1);
2804 dtmp = log10 ((
double) f2) / log10 ((
double) i1);
2812 dtmp = log10 (d2) / log10 ((
double) i1);
2820 dtmp = log10 (d2) / log10 ((
double) i1);
2828 dtmp = log10 (d2) / log10 ((
double) i1);
2851 dtmp = log10 ((
double) s2) / log10 ((
double) f1);
2859 dtmp = log10 ((
double) i2) / log10 ((
double) f1);
2867 dtmp = log10 ((
double) bi2) / log10 ((
double) f1);
2875 dtmp = log10 ((
double) f2) / log10 ((
double) f1);
2883 dtmp = log10 (d2) / log10 ((
double) f1);
2891 dtmp = log10 (d2) / log10 (f1);
2899 dtmp = log10 (d2) / log10 (f1);
2922 dtmp = log10 ((
double) s2) / log10 (d1);
2930 dtmp = log10 ((
double) i2) / log10 (d1);
2938 dtmp = log10 ((
double) bi2) / log10 (d1);
2946 dtmp = log10 ((
double) f2) / log10 (d1);
2954 dtmp = log10 (d2) / log10 (d1);
2962 dtmp = log10 (d2) / log10 (d1);
2970 dtmp = log10 (d2) / log10 (d1);
2993 dtmp = log10 ((
double) s2) / log10 (d1);
3001 dtmp = log10 ((
double) i2) / log10 (d1);
3009 dtmp = log10 ((
double) bi2) / log10 (d1);
3017 dtmp = log10 ((
double) f2) / log10 (d1);
3025 dtmp = log10 (d2) / log10 (d1);
3033 dtmp = log10 (d2) / log10 (d1);
3041 dtmp = log10 (d2) / log10 (d1);
3064 dtmp = log10 ((
double) s2) / log10 (d1);
3072 dtmp = log10 ((
double) i2) / log10 (d1);
3080 dtmp = log10 ((
double) bi2) / log10 (d1);
3088 dtmp = log10 ((
double) f2) / log10 (d1);
3096 dtmp = log10 (d2) / log10 (d1);
3104 dtmp = log10 (d2) / log10 (d1);
3112 dtmp = log10 (d2) / log10 (d1);
3146 double scale_up, num_scale_up, result;
3153 scale_up = pow (10, integer);
3154 num_scale_up = num * scale_up;
3157 result = floor (num_scale_up);
3161 result = ceil (num_scale_up);
3164 if (num_scale_up == result)
3170 result = result / scale_up;
3185 if (num == 0 || integer >= 0)
3190 integer = (
DB_BIGINT) pow (10, (
double) -integer);
3191 num -= num % integer;
3205 int year, month, day;
3209 int days_months[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
3252 month = (month - 1) / 3 * 3 + 1;
3259 day = day - weekday;
3270 if (month == 2 && (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)))
3272 days_months[2] = 29;
3275 day = day + days_months[month];
3369 value1 = &cast_value;
3404 value2 = &cast_format;
3504 memset (num_string, 0,
sizeof (num_string));
3508 end = num_string +
strlen (num_string);
3509 ptr = end - s + bi2;
3517 else if (ptr < num_string)
3520 memset (num_string, 0,
sizeof (num_string));
3575 date = local_dt.
date;
3597 date = local_dt.
date;
3858 dtmp = 1 / tan (dtmp);
3891 if (dtmp < -1 || dtmp > 1)
3940 if (dtmp < -1 || dtmp > 1)
4041 dtmp = atan2 (d, d2);
4073 dtmp = dtmp * (double) 57.295779513082320876798154814105;
4105 dtmp = dtmp * (double) 0.017453292519943295769236907684886;
4123 double base = ((b == -1) ? (2.7182818284590452353) : (double) b);
4140 dtmp = log10 (dtmp) / log10 (base);
4145 const char *log_func;
4153 log_func =
"log2()";
4156 log_func =
"log10()";
4160 log_func =
"unknown";
4222 for (c = 0; bi; c++)
4232 i = (int) (f - 0.5f);
4236 i = (int) (f + 0.5f);
4254 for (c = 0; bi; c++)
4278 for (c = 0; bi; c++)
4305 const char *type_name;
4310 if (type_name ==
NULL)
4368 char *tail_ptr =
NULL;
4374 dtmp = (
long double) s;
4379 dtmp = (
long double) i;
4384 dtmp = (
long double) bi;
4389 dtmp = (
long double) f;
4398 #ifdef _ISOC99_SOURCE 4399 dtmp = strtold (num_string, &tail_ptr) / powl (10.0,
DB_VALUE_SCALE (value));
4452 if (c == 0 || c == -1)
4512 res = floor (res) + 1.0;
4577 res = floor (res) + 1.0;
4601 #define RETURN_ERROR(err) \ 4604 if (prm_get_bool_value (PRM_ID_RETURN_NULL_ON_FUNCTION_ERRORS) == true) \ 4606 db_make_null (result); \ 4612 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, (err), 0); \ 4618 #define RETURN_ERROR_WITH_ARG(err, arg) \ 4621 if (prm_get_bool_value (PRM_ID_RETURN_NULL_ON_FUNCTION_ERRORS) == true) \ 4623 db_make_null (result); \ 4629 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, (err), 1, (arg)); \ 4635 #define MAX_DOMAIN_NAME_SIZE 150 4637 double d1, d2, d3, d4, d_ret;
4638 double tmp_d1 = 0.0, tmp_d2 = 0.0, tmp_d3 = 0.0, tmp_d4 = 0.0;
4640 DB_VALUE cast_value1, cast_value2, cast_value3, cast_value4;
4644 bool is_deal_with_numeric =
false;
4668 d4 = (int) floor (d4);
4713 value1 = &cast_value1;
4725 value2 = &cast_value2;
4738 value3 = &cast_value3;
4819 if (numeric_domain ==
NULL)
4824 cast_domain = numeric_domain;
4843 value1 = &cast_value1;
4857 value2 = &cast_value2;
4870 value3 = &cast_value3;
4875 cast_domain->
scale = 0;
4876 cast_status =
tp_value_coerce (&cast_value4, &cast_value4, cast_domain);
4883 value4 = &cast_value4;
4885 is_deal_with_numeric =
true;
4888 numeric_domain =
NULL;
4895 if (is_deal_with_numeric)
4920 tmp_d3 = tmp_d2 / d4;
4921 tmp_d4 = tmp_d1 / tmp_d3;
4922 d_ret = floor (tmp_d4) + 1.0;
4940 tmp_d3 = tmp_d2 / d4;
4941 tmp_d4 = tmp_d1 / tmp_d3;
4942 d_ret = floor (tmp_d4) + 1.0;
4966 #undef RETURN_ERROR_WITH_ARG 4979 long million_sec = 0;
4996 error =
msleep (million_sec);
5024 int hash_result = 0;
5031 return error_status;
5049 return error_status;
5064 return error_status;
5072 JSON_DOC_STORE source;
5098 JSON_DOC_STORE extracted_doc;
5100 std::string raw_path;
5108 source = std::move (extracted_doc);
5121 if (source.get_immutable () !=
NULL)
5123 bool has_member =
false;
5124 JSON_DOC_STORE value_doc;
5161 unsigned int length;
5214 JSON_DOC_STORE source_doc;
5218 if (num_args < 1 || num_args > 2)
5231 unsigned int length;
5241 JSON_DOC_STORE extracted_doc;
5243 std::string raw_path;
5251 source_doc = std::move (extracted_doc);
5260 if (source_doc.get_immutable () !=
NULL)
5282 JSON_DOC_STORE source_doc;
5320 JSON_DOC_STORE source_doc;
5361 JSON_DOC_STORE source_doc;
5386 JSON_DOC_STORE val_doc;
5387 JSON_DOC_STORE result_doc;
5409 result_doc.create_mutable_reference ();
5416 if (result_doc.get_immutable () ==
NULL)
5440 JSON_DOC_STORE val_doc;
5441 JSON_DOC_STORE result_doc;
5454 std::string key_str;
5475 result_doc.create_mutable_reference ();
5482 if (result_doc.get_immutable () ==
NULL)
5524 JSON_DOC_STORE source_doc;
5538 std::vector<std::string> paths;
5540 for (
int path_idx = 1; path_idx < num_args; path_idx++)
5542 const DB_VALUE *path_value = args[path_idx];
5543 paths.emplace_back ();
5552 JSON_DOC_STORE res_doc;
5573 JSON_DOC_STORE value_doc;
5577 if (num_args % 2 != 0)
5584 JSON_DOC_STORE new_doc;
5587 for (i = 0; i < num_args; i += 2)
5596 std::string value_key;
5629 JSON_DOC_STORE new_doc;
5631 JSON_DOC_STORE value_doc;
5635 for (
int i = 0;
i < num_args;
i++)
5656 JSON_DOC_STORE new_doc;
5657 JSON_DOC_STORE value_doc;
5661 if (num_args < 3 || num_args % 2 == 0)
5680 for (i = 1; i < num_args; i += 2)
5689 std::string value_path;
5707 error_code =
db_json_insert_func (value_doc.get_immutable (), *new_doc.get_mutable (), value_path.c_str ());
5724 JSON_DOC_STORE new_doc;
5725 JSON_DOC_STORE value_doc;
5729 if (num_args < 3 || num_args % 2 == 0)
5748 for (i = 1; i < num_args; i += 2)
5757 std::string value_path;
5775 error_code =
db_json_replace_func (value_doc.get_immutable (), *new_doc.get_mutable (), value_path.c_str ());
5791 JSON_DOC_STORE new_doc;
5792 JSON_DOC_STORE value_doc;
5796 if (num_args < 3 || num_args % 2 == 0)
5815 for (i = 1; i < num_args; i += 2)
5824 std::string value_path;
5842 error_code =
db_json_set_func (value_doc.get_immutable (), *new_doc.get_mutable (), value_path.c_str ());
5858 JSON_DOC_STORE new_doc;
5898 JSON_DOC_STORE result_json;
5899 result_json.create_mutable_reference ();
5900 error_code =
db_json_keys_func (*new_doc.get_immutable (), *result_json.get_mutable (), path.c_str ());
5915 JSON_DOC_STORE new_doc;
5941 for (i = 1; i < num_args; i++)
5967 JSON_DOC_STORE new_doc;
5968 JSON_DOC_STORE value_doc;
5972 if (num_args < 3 || num_args % 2 == 0)
5991 for (i = 1; i < num_args; i += 2)
6000 std::string value_path;
6035 JSON_DOC_STORE new_doc;
6036 JSON_DOC_STORE value_doc;
6040 if (num_args < 3 || num_args % 2 == 0)
6059 for (i = 1; i < num_args; i += 2)
6068 std::string value_path;
6102 bool exists =
false;
6106 std::vector<std::string> paths;
6129 for (
int i = 2;
i < num_args; ++
i)
6132 paths.emplace_back ();
6167 JSON_DOC_STORE accumulator_owner;
6182 for (
int i = 0;
i < num_args; ++
i)
6192 accumulator_owner.set_mutable_reference (accumulator);
6219 JSON_DOC_STORE accumulator_owner;
6234 for (
int i = 0;
i < num_args; ++
i)
6243 accumulator_owner.set_mutable_reference (accumulator);
6272 const size_t ESCAPE_CHAR_ARG_INDEX = 3;
6280 for (
int i = 0;
i < num_args; ++
i)
6283 if (
i != ESCAPE_CHAR_ARG_INDEX &&
DB_IS_NULL (args[
i]))
6304 const DB_VALUE *esc_char =
nullptr;
6305 const char * slash_str =
"\\";
6319 esc_char = &default_slash_str_dbval;
6323 std::vector<std::string> starting_paths;
6324 for (
int i = 4;
i < num_args; ++
i)
6326 starting_paths.emplace_back ();
6335 if (starting_paths.empty ())
6337 starting_paths.push_back (
"$");
6340 std::vector<JSON_PATH> paths;
6341 error_code =
db_json_search_func (*doc.get_immutable (), pattern, esc_char, paths, starting_paths, find_all);
6353 if (paths.size () == 1)
6355 std::string path = paths[0].dump_json_path ();
6363 size_t escaped_size;
6379 JSON_DOC_STORE result_json_owner;
6380 JSON_DOC_STORE json_array_elem_owner;
6381 result_json_owner.create_mutable_reference ();
6382 for (std::size_t
i = 0;
i < paths.size (); ++
i)
6384 std::string path = paths[
i].dump_json_path ();
6393 size_t escaped_size;
6401 JSON_DOC *json_array_elem =
nullptr;
6403 json_array_elem_owner.set_mutable_reference (json_array_elem);
6422 JSON_DOC_STORE new_doc;
6457 bool can_compare =
false;
6462 if (cmp_result ==
DB_EQ)
6466 else if (cmp_result ==
DB_GT)
6477 else if (cmp_result ==
DB_LT)
6488 else if (cmp_result ==
DB_UNK && can_compare ==
false)
6519 std::transform (find_all_str.begin (), find_all_str.end (), find_all_str.begin (), [] (
unsigned char c)
6521 return std::tolower (c);
6526 if (find_all_str ==
"all")
6530 if (!find_all && find_all_str !=
"one")
6541 for (
int i = 0;
i < num_args; ++
i)
int julian_encode(int m, int d, int y)
int db_evaluate_json_extract(DB_VALUE *result, DB_VALUE *const *args, int num_args)
DB_C_FLOAT db_get_float(const DB_VALUE *value)
int db_sin_dbval(DB_VALUE *result, DB_VALUE *value)
struct db_domain_info::char_info char_info
static int db_mod_monetary(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
static int is_str_find_all(DB_VALUE *val, bool &find_all)
TP_DOMAIN_STATUS tp_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
int db_evaluate_json_replace(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
#define ER_QPROC_OVERFLOW_POWER
int db_make_json(DB_VALUE *value, JSON_DOC *json_document, bool need_clear)
int db_evaluate_json_merge_preserve(DB_VALUE *result, DB_VALUE *const *arg, const int num_args)
static int db_width_bucket_calculate_numeric(double *result, const DB_VALUE *value1, const DB_VALUE *value2, const DB_VALUE *value3, const DB_VALUE *value4)
unsigned int db_json_get_length(const JSON_DOC *document)
#define ER_PROC_WIDTH_BUCKET_COUNT
int db_json_merge_patch_func(const JSON_DOC *source, JSON_DOC *&dest)
#define db_locate_numeric(value)
#define QSTR_IS_ANY_CHAR(s)
void db_make_json_from_doc_store_and_release(DB_VALUE &value, JSON_DOC_STORE &doc_store)
int db_json_replace_func(const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
JSON_DOC * db_get_json_document(const DB_VALUE *value)
#define DB_GET_STRING_SAFE(v)
int db_get_date_format(const DB_VALUE *format_str, TIMESTAMP_FORMAT *format)
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
int db_get_int(const DB_VALUE *value)
DB_C_DOUBLE db_get_double(const DB_VALUE *value)
void numeric_coerce_num_to_double(DB_C_NUMERIC num, int scale, double *adouble)
int db_make_varchar(DB_VALUE *value, const int max_char_length, DB_CONST_C_CHAR str, const int char_str_byte_size, const int codeset, const int collation_id)
int db_datetime_decode(const DB_DATETIME *datetime, int *month, int *day, int *year, int *hour, int *minute, int *second, int *millisecond)
int db_evaluate_json_object(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int numeric_db_value_div(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
int db_evaluate_json_keys(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
DB_VALUE_COMPARE_RESULT tp_value_compare_with_error(const DB_VALUE *value1, const DB_VALUE *value2, int do_coercion, int total_order, bool *can_compare)
static int get_number_dbval_as_double(double *d, const DB_VALUE *value)
int db_make_numeric(DB_VALUE *value, const DB_C_NUMERIC num, const int precision, const int scale)
int db_power_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_asin_dbval(DB_VALUE *result, DB_VALUE *value)
#define assert_release(e)
#define ER_QSTR_INVALID_DATA_TYPE
DB_C_NUMERIC db_get_numeric(const DB_VALUE *value)
static double truncate_double(double num, double integer)
bool db_json_is_valid(const char *json_str)
int numeric_db_value_compare(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
int db_evaluate_json_quote(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_make_date(DB_VALUE *value, const int month, const int day, const int year)
DB_DATETIMETZ * db_get_datetimetz(const DB_VALUE *value)
int db_accumulate_json_arrayagg(const DB_VALUE *json_db_val, DB_VALUE *json_res)
int db_exp_dbval(DB_VALUE *result, DB_VALUE *value)
int db_json_extract_document_from_path(const JSON_DOC *document, const std::string &path, JSON_DOC_STORE &result, bool allow_wildcards)
int db_round_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
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_value_to_json_path(const DB_VALUE &path_value, FUNC_TYPE fcode, std::string &path_str)
int db_json_value_is_contained_in_doc(const JSON_DOC *doc, const JSON_DOC *value, bool &result)
int numeric_db_value_coerce_to_num(DB_VALUE *src, DB_VALUE *dest, DB_DATA_STATUS *data_status)
#define RETURN_ERROR_WITH_ARG(err, arg)
int numeric_db_value_sub(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
void crypt_crc32(const char *src, int src_len, int *dest)
#define ER_QSTR_INVALID_FORMAT
#define DB_VALUE_PRECISION(value)
enum tp_domain_status TP_DOMAIN_STATUS
int db_sign_dbval(DB_VALUE *result, DB_VALUE *value)
#define ER_QPROC_OVERFLOW_DIVISION
#define MAX_DOMAIN_NAME_SIZE
int db_atan2_dbval(DB_VALUE *result, DB_VALUE *value, DB_VALUE *value2)
int db_log_generic_dbval(DB_VALUE *result, DB_VALUE *value, long b)
#define DB_VALUE_SCALE(value)
int db_sleep(DB_VALUE *result, DB_VALUE *value)
JSON_DOC * db_json_make_json_array()
#define DB_FLOAT_DECIMAL_PRECISION
int db_evaluate_json_valid(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
DB_TIMESTAMPTZ * db_get_timestamptz(const DB_VALUE *value)
int db_date_encode(DB_DATE *date, int month, int day, int year)
static void db_json_add_element_to_array(JSON_DOC *doc, const JSON_VALUE *value)
TP_DOMAIN tp_Double_domain
int db_make_short(DB_VALUE *value, const DB_C_SHORT num)
int db_evaluate_json_depth(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_make_string(DB_VALUE *value, DB_CONST_C_CHAR str)
DB_MONETARY * db_get_monetary(const DB_VALUE *value)
unsigned int DB_TIMESTAMP
#define OR_CHECK_DOUBLE_OVERFLOW(i)
int db_json_get_all_paths_func(const JSON_DOC &doc, JSON_DOC *&result_json)
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
static int round_date(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_evaluate_json_array(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_cot_dbval(DB_VALUE *result, DB_VALUE *value)
#define DB_MAX_NUMERIC_PRECISION
int db_log_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_bit_count_dbval(DB_VALUE *result, DB_VALUE *value)
static int db_mod_double(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
int db_make_monetary(DB_VALUE *value, const DB_CURRENCY type, const double amount)
static int db_mod_int(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
JSON_DOC * db_json_make_json_object()
#define LANG_COERCIBLE_CODESET
DB_TYPE db_value_domain_type(const DB_VALUE *value)
struct db_domain_info::numeric_info numeric_info
int prm_get_integer_value(PARAM_ID prm_id)
#define ER_QPROC_OVERFLOW_SUBTRACTION
#define ER_IT_DATA_OVERFLOW
#define ER_OUT_OF_VIRTUAL_MEMORY
int tp_domain_name(const TP_DOMAIN *domain, char *buffer, int maxlen)
int db_json_array_insert_func(const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
#define DB_INTEGER_PRECISION
int db_json_get_json_from_str(const char *json_raw, JSON_DOC *&doc, size_t json_raw_length)
int db_tan_dbval(DB_VALUE *result, DB_VALUE *value)
#define DB_VALUE_DOMAIN_TYPE(value)
#define TP_IS_NUMERIC_TYPE(typeid)
#define DB_IS_STRING(value)
int db_acos_dbval(DB_VALUE *result, DB_VALUE *value)
#define OR_CHECK_INT_OVERFLOW(i)
#define ER_QPROC_OVERFLOW_ADDITION
static int get_number_dbval_as_long_double(long double *ld, const DB_VALUE *value)
const char * db_json_get_type_as_str(const JSON_DOC *document)
#define ER_JSON_DUPLICATE_KEY
int db_evaluate_json_pretty(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
TP_DOMAIN_STATUS tp_value_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
#define TP_DOMAIN_TYPE(dom)
int db_evaluate_json_unquote(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_json_merge_preserve_func(const JSON_DOC *source, JSON_DOC *&dest)
#define ER_INVALID_ONE_ALL_ARGUMENT
unsigned char * DB_C_NUMERIC
int tz_datetimeltz_to_local(const DB_DATETIME *dt_ltz, DB_DATETIME *dt_local)
#define LANG_COERCIBLE_COLL
const char * pr_type_name(DB_TYPE id)
#define MILLISECONDS_OF_ONE_DAY
static double round_double(double num, double integer)
static int db_mod_float(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
int db_value_put_encoded_date(DB_VALUE *value, const DB_DATE *date)
void PRIM_SET_NULL(DB_VALUE *value)
int db_timestamp_decode_w_tz_id(const DB_TIMESTAMP *utime, const TZ_ID *tz_id, DB_DATE *date, DB_TIME *timeval)
int db_drandom_dbval(DB_VALUE *result)
void numeric_coerce_num_to_dec_str(DB_C_NUMERIC num, char *dec_str)
#define db_private_alloc(thrd, size)
static int db_mod_string(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
need_clear_type need_clear
static int db_mod_numeric(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
int db_trunc_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int pr_clear_value(DB_VALUE *value)
int db_timestamp_decode_ses(const DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
#define ER_QPROC_FUNCTION_ARG_ERROR
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)
DB_BIGINT db_get_bigint(const DB_VALUE *value)
DB_JSON_TYPE db_json_get_type(const JSON_DOC *doc)
#define DB_BIGINT_PRECISION
#define ER_JSON_OBJECT_NAME_IS_NULL
static int move_n_days(int *monthp, int *dayp, int *yearp, const int interval)
int db_evaluate_json_array_insert(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_json_path_unquote_object_keys_external(std::string &sql_path)
#define TP_IS_CHAR_TYPE(typeid)
static int db_mod_bigint(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
static void error(const char *msg)
int db_make_float(DB_VALUE *value, const DB_C_FLOAT num)
int db_json_array_append_func(const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
int db_evaluate_json_insert(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int numeric_internal_double_to_num(double adouble, int dst_scale, DB_C_NUMERIC num, int *prec, int *scale)
int db_cos_dbval(DB_VALUE *result, DB_VALUE *value)
int tz_utc_datetimetz_to_local(const DB_DATETIME *dt_utc, const TZ_ID *tz_id, DB_DATETIME *dt_local)
int db_json_unquote(const JSON_DOC &doc, char *&result_str)
#define RETURN_ERROR(err)
int db_evaluate_json_contains_path(DB_VALUE *result, DB_VALUE *const *arg, const int num_args)
int db_json_keys_func(const JSON_DOC &doc, JSON_DOC &result_json, const char *raw_path)
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
int db_evaluate_json_contains(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
unsigned int db_json_get_depth(const JSON_DOC *doc)
int db_sqrt_dbval(DB_VALUE *result, DB_VALUE *value)
int db_string_escape_str(const char *src_str, size_t src_size, char **res_string, size_t *dest_size)
void numeric_coerce_dec_str_to_num(const char *dec_str, DB_C_NUMERIC result)
DB_DATE * db_get_date(const DB_VALUE *value)
int db_evaluate_json_remove(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_evaluate_json_get_all_paths(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
#define ER_OBJ_INVALID_ARGUMENTS
int db_radians_dbval(DB_VALUE *result, DB_VALUE *value)
bool prm_get_bool_value(PARAM_ID prm_id)
DB_TIMESTAMP * db_get_timestamp(const DB_VALUE *value)
int db_get_string_size(const DB_VALUE *value)
DB_C_SHORT db_get_short(const DB_VALUE *value)
#define ER_QPROC_OVERFLOW_EXP
int db_evaluate_json_merge_patch(DB_VALUE *result, DB_VALUE *const *arg, const int num_args)
#define TP_IS_DATE_TYPE(typeid)
int db_crc32_dbval(DB_VALUE *result, DB_VALUE *value)
int db_least_or_greatest(DB_VALUE *arg1, DB_VALUE *arg2, DB_VALUE *result, bool least)
#define DB_VALUE_TYPE(value)
int db_random_dbval(DB_VALUE *result)
int db_make_null(DB_VALUE *value)
int tp_value_str_auto_cast_to_number(DB_VALUE *src, DB_VALUE *dest, DB_TYPE *val_type)
#define DB_IS_NULL(value)
int db_make_double(DB_VALUE *value, const DB_C_DOUBLE num)
int db_mod_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_floor_dbval(DB_VALUE *result, DB_VALUE *value)
void db_date_decode(const DB_DATE *date, int *monthp, int *dayp, int *yearp)
int db_json_add_member_to_object(JSON_DOC *doc, const char *name, const char *value)
DB_DATETIME * db_get_datetime(const DB_VALUE *value)
int db_json_contains_path(const JSON_DOC *document, const std::vector< std::string > &paths, bool find_all, bool &result)
int db_string_quote(const DB_VALUE *str, DB_VALUE *res)
#define DB_NUMERIC_BUF_SIZE
int db_make_int(DB_VALUE *value, const int num)
int db_json_insert_func(const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
int msleep(const long msec)
void numeric_db_value_abs(DB_C_NUMERIC src_num, DB_C_NUMERIC dest_num)
static int truncate_date(DB_DATE *date, const DB_VALUE *format_str)
int db_atan_dbval(DB_VALUE *result, DB_VALUE *value)
int db_evaluate_json_length(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_evaluate_json_type_dbval(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
static bool is_any_arg_null(DB_VALUE *const *args, int num_args)
int db_accumulate_json_objectagg(const DB_VALUE *json_key, const DB_VALUE *json_db_val, DB_VALUE *json_res)
int db_typeof_dbval(DB_VALUE *result, DB_VALUE *value)
int db_value_to_json_value(const DB_VALUE &db_val, JSON_DOC_STORE &json_doc)
DB_TIME * db_get_time(const DB_VALUE *value)
#define ER_QPROC_INVALID_DATATYPE
int db_evaluate_json_set(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_abs_dbval(DB_VALUE *result, DB_VALUE *value)
void db_time_decode(DB_TIME *timeval, int *hourp, int *minutep, int *secondp)
static int db_mod_short(DB_VALUE *value, DB_VALUE *value1, DB_VALUE *value2)
int db_evaluate_json_search(DB_VALUE *result, DB_VALUE *const *args, const int num_args)
int db_value_to_json_doc(const DB_VALUE &db_val, bool force_copy, JSON_DOC_STORE &json_doc)
int day_of_week(int jul_day)
TP_DOMAIN * tp_domain_new(DB_TYPE type)
int db_evaluate_json_array_append(DB_VALUE *result, DB_VALUE *const *arg, int const num_args)
int db_value_to_json_key(const DB_VALUE &db_val, std::string &key_str)
int db_ceil_dbval(DB_VALUE *result, DB_VALUE *value)
static DB_BIGINT truncate_bigint(DB_BIGINT num, DB_BIGINT integer)
int db_degrees_dbval(DB_VALUE *result, DB_VALUE *value)
JSON_DOC * db_json_allocate_doc()
void tp_domain_free(TP_DOMAIN *dom)
DB_CONST_C_CHAR db_get_string(const DB_VALUE *value)
int db_json_set_func(const JSON_DOC *value, JSON_DOC &doc, const char *raw_path)
#define ER_QPROC_POWER_ERROR
int db_width_bucket(DB_VALUE *result, const DB_VALUE *value1, const DB_VALUE *value2, const DB_VALUE *value3, const DB_VALUE *value4)