CUBRID Engine
latest
|
#include "config.h"
#include <float.h>
#include <time.h>
#include "csql.h"
#include "cnv.h"
#include "memory_alloc.h"
#include "language_support.h"
#include "string_opfunc.h"
#include "unicode_support.h"
#include "dbtype.h"
Go to the source code of this file.
Classes | |
struct | db_type_double_profile |
struct | db_type_integer_profile |
struct | DB_TYPE_MONETARY_PROFILE |
struct | DB_TYPE_TIME_PROFILE |
struct | DB_TYPE_DATE_PROFILE |
struct | DB_TYPE_SET_PROFILE |
struct | DB_TYPE_STRING_PROFILE |
Macros | |
#define | UX_CHAR wchar_t |
#define | CMSB(x) ((x) & 0x80) |
#define | FORMERBYTE(x) ((UX_CHAR)(((unsigned)(x) & 0xff00) >> 8)) |
#define | LATTERBYTE(x) ((UX_CHAR)((x) & 0xff)) |
#define | COMMAS_OFFSET(COND, N) (COND == TRUE ? (N / 3) : 0) |
#define | TIME_STRING_MAX 20 |
#define | OID_LENGTH 15 |
#define | COMMA_CHAR ',' |
#define | SHORT_TO_INT(short_val) ((int)short_val) |
#define | OBJECT_SYMBOL_MAX 512 |
#define | DATE_ABREV_NAME_LENGTH 3 |
#define | DATE_TEMP_BUFFER_LENGTH 50 |
#define | DOUBLE_FORMAT_SCIENTIFIC 'e' |
#define | DOUBLE_FORMAT_DECIMAL 'f' |
#define | INT_FORMAT_UNSIGNED_DECIMAL 'u' |
#define | INT_FORMAT_SIGNED_DECIMAL 'd' |
#define | INT_FORMAT_OCTAL 'o' |
#define | INT_FORMAT_HEXADECIMAL 'x' |
#define | INT_FORMAT_CHARACTER 'c' |
#define | TIME_FORMAT_TWELVE_HOUR "%I:%M:%S %p" |
#define | TIME_FORMAT_TWELVE_HOUR_W_TIMEZONE "%I:%M:%S %p %Z" |
#define | TIME_FORMAT_TWENTY_FOUR_HOUR "%H:%M:%S" |
#define | TIME_FORMAT_TWENTY_FOUR_HOUR_W_TIMEZONE "%H:%M:%S %Z" |
Typedefs | |
typedef struct db_type_double_profile | DB_TYPE_DOUBLE_PROFILE |
typedef struct db_type_double_profile | DB_TYPE_FLOAT_PROFILE |
typedef struct db_type_double_profile | DB_TYPE_NUMERIC_PROFILE |
typedef struct db_type_integer_profile | DB_TYPE_BIGINT_PROFILE |
typedef struct db_type_integer_profile | DB_TYPE_INTEGER_PROFILE |
typedef struct db_type_integer_profile | DB_TYPE_SHORT_PROFILE |
Functions | |
static void | add_commas (char *string) |
static void | strip_trailing_zeros (char *numeric_string) |
static char * | double_to_string (double double_value, int field_width, int precision, const bool leading_sign, const char *leading_str, const char *trailing_str, bool leading_zeros, bool trailing_zeros, bool commas, char conversion) |
static char * | date_as_string (DB_DATE *date_value, int format) |
static char * | bigint_to_string (DB_BIGINT int_value, int field_width, bool leading_zeros, bool leading_symbol, bool commas, char conversion) |
static char * | object_to_string (DB_OBJECT *object, int format) |
static char * | numeric_to_string (DB_VALUE *value, bool commas) |
static char * | bit_to_string (DB_VALUE *value, char string_delimiter, bool plain_string) |
static char * | set_to_string (DB_VALUE *value, char begin_notation, char end_notation, int max_entries, bool plain_string, CSQL_OUTPUT_TYPE output_type, char column_encolser) |
static char * | duplicate_string (const char *string) |
static char * | string_to_string (const char *string_value, char string_delimiter, char string_introducer, int length, int *result_length, bool plain_string, bool change_single_quote) |
static int | get_object_print_format (void) |
char * | csql_string_to_plain_string (const char *string_value, int length, int *result_length) |
char * | csql_db_value_as_string (DB_VALUE *value, int *length, bool plain_string, CSQL_OUTPUT_TYPE output_type, char column_enclosure) |
Variables | |
static DB_TYPE_DOUBLE_PROFILE | default_double_profile |
static DB_TYPE_FLOAT_PROFILE | default_float_profile |
static DB_TYPE_NUMERIC_PROFILE | default_numeric_profile |
static DB_TYPE_BIGINT_PROFILE | default_bigint_profile |
static DB_TYPE_INTEGER_PROFILE | default_int_profile |
static DB_TYPE_SHORT_PROFILE | default_short_profile |
static DB_TYPE_MONETARY_PROFILE | default_monetary_profile |
static DB_TYPE_TIME_PROFILE | default_time_profile |
static DB_TYPE_DATE_PROFILE | default_date_profile |
static DB_TYPE_SET_PROFILE | default_set_profile |
static DB_TYPE_STRING_PROFILE | default_string_profile |
static const char * | day_of_week_names [] |
static const char * | month_of_year_names [] |
#define CMSB | ( | x | ) | ((x) & 0x80) |
Definition at line 47 of file csql_result_format.c.
Referenced by add_commas().
#define COMMA_CHAR ',' |
Definition at line 58 of file csql_result_format.c.
Referenced by add_commas().
#define COMMAS_OFFSET | ( | COND, | |
N | |||
) | (COND == TRUE ? (N / 3) : 0) |
Definition at line 52 of file csql_result_format.c.
Referenced by bigint_to_string(), double_to_string(), and numeric_to_string().
#define DATE_ABREV_NAME_LENGTH 3 |
Definition at line 63 of file csql_result_format.c.
Referenced by date_as_string().
#define DATE_TEMP_BUFFER_LENGTH 50 |
Definition at line 64 of file csql_result_format.c.
Referenced by date_as_string().
#define DOUBLE_FORMAT_DECIMAL 'f' |
Definition at line 86 of file csql_result_format.c.
Referenced by csql_db_value_as_string().
#define DOUBLE_FORMAT_SCIENTIFIC 'e' |
Definition at line 85 of file csql_result_format.c.
Referenced by double_to_string().
#define FORMERBYTE | ( | x | ) | ((UX_CHAR)(((unsigned)(x) & 0xff00) >> 8)) |
Definition at line 49 of file csql_result_format.c.
#define INT_FORMAT_CHARACTER 'c' |
Definition at line 122 of file csql_result_format.c.
#define INT_FORMAT_HEXADECIMAL 'x' |
Definition at line 121 of file csql_result_format.c.
Referenced by bigint_to_string().
#define INT_FORMAT_OCTAL 'o' |
Definition at line 120 of file csql_result_format.c.
#define INT_FORMAT_SIGNED_DECIMAL 'd' |
Definition at line 119 of file csql_result_format.c.
Referenced by bigint_to_string().
#define INT_FORMAT_UNSIGNED_DECIMAL 'u' |
Definition at line 118 of file csql_result_format.c.
#define LATTERBYTE | ( | x | ) | ((UX_CHAR)((x) & 0xff)) |
Definition at line 50 of file csql_result_format.c.
#define OBJECT_SYMBOL_MAX 512 |
Definition at line 61 of file csql_result_format.c.
Referenced by object_to_string().
#define OID_LENGTH 15 |
Definition at line 56 of file csql_result_format.c.
#define SHORT_TO_INT | ( | short_val | ) | ((int)short_val) |
Definition at line 60 of file csql_result_format.c.
Referenced by csql_db_value_as_string().
#define TIME_FORMAT_TWELVE_HOUR "%I:%M:%S %p" |
Definition at line 167 of file csql_result_format.c.
#define TIME_FORMAT_TWELVE_HOUR_W_TIMEZONE "%I:%M:%S %p %Z" |
Definition at line 168 of file csql_result_format.c.
#define TIME_FORMAT_TWENTY_FOUR_HOUR "%H:%M:%S" |
Definition at line 169 of file csql_result_format.c.
#define TIME_FORMAT_TWENTY_FOUR_HOUR_W_TIMEZONE "%H:%M:%S %Z" |
Definition at line 170 of file csql_result_format.c.
#define TIME_STRING_MAX 20 |
Definition at line 54 of file csql_result_format.c.
Referenced by double_to_string().
#define UX_CHAR wchar_t |
Definition at line 44 of file csql_result_format.c.
typedef struct db_type_integer_profile DB_TYPE_BIGINT_PROFILE |
Definition at line 104 of file csql_result_format.c.
typedef struct db_type_double_profile DB_TYPE_DOUBLE_PROFILE |
Definition at line 69 of file csql_result_format.c.
typedef struct db_type_double_profile DB_TYPE_FLOAT_PROFILE |
Definition at line 70 of file csql_result_format.c.
typedef struct db_type_integer_profile DB_TYPE_INTEGER_PROFILE |
Definition at line 105 of file csql_result_format.c.
typedef struct db_type_double_profile DB_TYPE_NUMERIC_PROFILE |
Definition at line 71 of file csql_result_format.c.
typedef struct db_type_integer_profile DB_TYPE_SHORT_PROFILE |
Definition at line 106 of file csql_result_format.c.
anonymous enum |
Definition at line 187 of file csql_result_format.c.
anonymous enum |
Enumerator | |
---|---|
OBJECT_FORMAT_OID | |
OBJECT_FORMAT_CLASSNAME |
Definition at line 206 of file csql_result_format.c.
|
static |
Definition at line 294 of file csql_result_format.c.
References CMSB, COMMA_CHAR, i, NULL, and strlen.
Referenced by bigint_to_string(), and double_to_string().
|
static |
Definition at line 750 of file csql_result_format.c.
References add_commas(), COMMAS_OFFSET, i, INT_FORMAT_HEXADECIMAL, INT_FORMAT_SIGNED_DECIMAL, NULL, return_string(), and strlen.
Referenced by csql_db_value_as_string().
Definition at line 942 of file csql_result_format.c.
References CSQL_SUCCESS, db_bit_string(), db_get_string_length(), free_and_init, NULL, return_string(), string_to_string(), and strlen.
Referenced by csql_db_value_as_string().
char* csql_db_value_as_string | ( | DB_VALUE * | value, |
int * | length, | ||
bool | plain_string, | ||
CSQL_OUTPUT_TYPE | output_type, | ||
char | column_enclosure | ||
) |
Definition at line 1336 of file csql_result_format.c.
References db_monetary::amount, DB_TYPE_SET_PROFILE::begin_notation, bigint_to_string(), bit_to_string(), db_type_double_profile::commas, db_type_integer_profile::commas, DB_TYPE_MONETARY_PROFILE::commas, CSQL_LOADDB_OUTPUT, CSQL_QUERY_OUTPUT, CSQL_UNKNOWN_OUTPUT, DB_TYPE_MONETARY_PROFILE::currency_symbol, date_as_string(), db_datetimetz::datetime, DATETIME_BUF_SIZE, DATETIMETZ_BUF_SIZE, db_datetime_to_string(), db_datetimeltz_to_string(), db_datetimetz_to_string(), db_get_bigint(), db_get_char(), db_get_date(), db_get_datetime(), db_get_datetimetz(), db_get_double(), db_get_elo(), db_get_enum_codeset(), db_get_enum_short(), db_get_enum_string(), db_get_enum_string_size(), db_get_float(), db_get_int(), db_get_json_raw_body(), db_get_monetary(), db_get_object(), db_get_short(), db_get_string_codeset(), db_get_string_size(), db_get_time(), db_get_timestamp(), db_get_timestamptz(), db_get_type_name(), db_private_free, db_time_to_string(), db_timestampltz_to_string(), db_timestamptz_to_string(), DB_TYPE_BIGINT, DB_TYPE_BIT, DB_TYPE_BLOB, DB_TYPE_CHAR, DB_TYPE_CLOB, DB_TYPE_DATE, DB_TYPE_DATETIME, DB_TYPE_DATETIMELTZ, DB_TYPE_DATETIMETZ, DB_TYPE_DOUBLE, DB_TYPE_ENUMERATION, DB_TYPE_FLOAT, DB_TYPE_INTEGER, DB_TYPE_JSON, DB_TYPE_MONETARY, DB_TYPE_MULTISET, DB_TYPE_NCHAR, DB_TYPE_NULL, DB_TYPE_NUMERIC, DB_TYPE_OBJECT, DB_TYPE_SEQUENCE, DB_TYPE_SET, DB_TYPE_SHORT, DB_TYPE_TIME, DB_TYPE_TIMESTAMP, DB_TYPE_TIMESTAMPLTZ, DB_TYPE_TIMESTAMPTZ, DB_TYPE_VARBIT, DB_TYPE_VARCHAR, DB_TYPE_VARNCHAR, DB_TYPE_VOBJ, db_utime_to_string, DB_VALUE_TYPE, DB_TYPE_MONETARY_PROFILE::decimalplaces, DOUBLE_FORMAT_DECIMAL, double_to_string(), duplicate_string(), DB_TYPE_SET_PROFILE::end_notation, db_type_double_profile::fieldwidth, db_type_integer_profile::fieldwidth, DB_TYPE_MONETARY_PROFILE::fieldwidth, db_type_double_profile::format, db_type_integer_profile::format, DB_TYPE_DATE_PROFILE::format, free_and_init, get_object_print_format(), INTL_CODESET_UTF8, intl_get_currency_symbol_position(), intl_get_money_symbol_console(), lang_get_generic_unicode_norm(), db_type_double_profile::leadingsign, DB_TYPE_MONETARY_PROFILE::leadingsign, db_type_integer_profile::leadingsymbol, db_type_double_profile::leadingzeros, db_type_integer_profile::leadingzeros, DB_TYPE_MONETARY_PROFILE::leadingzeros, db_elo::locator, DB_TYPE_SET_PROFILE::max_entries, NULL, numeric_to_string(), object_to_string(), db_type_double_profile::precision, set_to_string(), SHORT_TO_INT, DB_TYPE_STRING_PROFILE::string_delimiter, string_to_string(), strlen, TIME_BUF_SIZE, db_timestamptz::timestamp, TIMESTAMP_BUF_SIZE, TIMESTAMPTZ_BUF_SIZE, db_type_double_profile::trailingzeros, DB_TYPE_MONETARY_PROFILE::trailingzeros, db_monetary::type, db_timestamptz::tz_id, db_datetimetz::tz_id, unicode_decompose_string(), and unicode_string_need_decompose().
Referenced by get_current_result(), and set_to_string().
char* csql_string_to_plain_string | ( | const char * | string_value, |
int | length, | ||
int * | result_length | ||
) |
Definition at line 1141 of file csql_result_format.c.
References CAST_STRLEN, csql_text_utf8_to_console, duplicate_string(), i, NO_ERROR, NULL, return_string(), and strlen.
Referenced by string_to_string(), and write_results_to_stream().
|
static |
Definition at line 648 of file csql_result_format.c.
References DATE_ABREV_NAME_LENGTH, DATE_FORMAT_ABREV_EURO_TEXT, DATE_FORMAT_ABREV_TEXT, DATE_FORMAT_ABREV_TEXT_W_DAY, DATE_FORMAT_DDMMYY, DATE_FORMAT_FULL_EURO_TEXT, DATE_FORMAT_FULL_TEXT, DATE_FORMAT_FULL_TEXT_W_DAY, DATE_FORMAT_MMDDYY, DATE_FORMAT_MMDDYYYY, DATE_FORMAT_YYMMDD, DATE_TEMP_BUFFER_LENGTH, day_of_week_names, db_date_decode(), db_date_weekday(), duplicate_string(), month_of_year_names, and NULL.
Referenced by csql_db_value_as_string().
|
static |
Definition at line 471 of file csql_result_format.c.
References add_commas(), COMMAS_OFFSET, db_strftime(), DOUBLE_FORMAT_SCIENTIFIC, duplicate_string(), i, NULL, return_string(), strip_trailing_zeros(), strlen, time_as_string(), and TIME_STRING_MAX.
Referenced by csql_db_value_as_string().
|
static |
Definition at line 1111 of file csql_result_format.c.
Referenced by csql_db_value_as_string(), csql_string_to_plain_string(), date_as_string(), double_to_string(), numeric_to_string(), object_to_string(), set_to_string(), and string_to_string().
|
static |
Definition at line 1870 of file csql_result_format.c.
References OBJECT_FORMAT_CLASSNAME, OBJECT_FORMAT_OID, prm_get_bool_value(), and PRM_ID_OBJECT_PRINT_FORMAT_OID.
Referenced by csql_db_value_as_string().
Definition at line 904 of file csql_result_format.c.
References COMMAS_OFFSET, DB_VALUE_PRECISION, duplicate_string(), free_and_init, NULL, numeric_db_value_print(), NUMERIC_MAX_STRING_SIZE, return_string(), and strlen.
Referenced by csql_db_value_as_string().
|
static |
Definition at line 866 of file csql_result_format.c.
References db_get_class_name(), db_print_mop(), duplicate_string(), NULL, OBJECT_FORMAT_OID, and OBJECT_SYMBOL_MAX.
Referenced by csql_db_value_as_string().
|
static |
Definition at line 986 of file csql_result_format.c.
References csql_db_value_as_string(), DB_FETCH_READ, db_fetch_set(), db_get_set(), db_set_get(), db_set_size(), db_value_clear(), duplicate_string(), cubthread::internal_tasks_worker_pool::finalize(), free_and_init, i, NO_ERROR, NULL, return_string(), and strlen.
Referenced by csql_db_value_as_string().
|
static |
Definition at line 1233 of file csql_result_format.c.
References CAST_STRLEN, csql_string_to_plain_string(), csql_text_utf8_to_console, duplicate_string(), i, NO_ERROR, NULL, return_string(), and strlen.
Referenced by bit_to_string(), and csql_db_value_as_string().
|
static |
Definition at line 392 of file csql_result_format.c.
Referenced by double_to_string().
|
static |
Definition at line 242 of file csql_result_format.c.
Referenced by date_as_string().
|
static |
Definition at line 124 of file csql_result_format.c.
|
static |
Definition at line 201 of file csql_result_format.c.
|
static |
Definition at line 88 of file csql_result_format.c.
|
static |
Definition at line 92 of file csql_result_format.c.
|
static |
Definition at line 128 of file csql_result_format.c.
|
static |
Definition at line 152 of file csql_result_format.c.
|
static |
Definition at line 96 of file csql_result_format.c.
|
static |
Definition at line 223 of file csql_result_format.c.
|
static |
Definition at line 132 of file csql_result_format.c.
|
static |
Definition at line 237 of file csql_result_format.c.
|
static |
Definition at line 172 of file csql_result_format.c.
|
static |
Definition at line 252 of file csql_result_format.c.
Referenced by date_as_string().