CUBRID Engine
latest
|
#include "config.h"
#include <assert.h>
#include <float.h>
#include <setjmp.h>
#include <signal.h>
#include "csql.h"
#include "dbtran_def.h"
#include "dbtype.h"
#include "memory_alloc.h"
#include "object_primitive.h"
#include "porting.h"
#include "transaction_cl.h"
Go to the source code of this file.
Classes | |
struct | CUR_RESULT_INFO |
struct | CSQL_CMD_STRING_TABLE |
Macros | |
#define | MAX_SHORT_DISPLAY_LENGTH 6 |
#define | MAX_INTEGER_DISPLAY_LENGTH 11 |
#define | MAX_BIGINT_DISPLAY_LENGTH 20 |
#define | MAX_FLOAT_DISPLAY_LENGTH (FLT_DIG + 7) |
#define | MAX_DOUBLE_DISPLAY_LENGTH (DBL_DIG + 9) |
#define | MAX_TIME_DISPLAY_LENGTH 11 |
#define | MAX_TIMEZONE_DISPLAY_LENGTH 18 |
#define | MAX_UTIME_DISPLAY_LENGTH 25 |
#define | MAX_TIMESTAMPTZ_DISPLAY_LENGTH (MAX_UTIME_DISPLAY_LENGTH + MAX_TIMEZONE_DISPLAY_LENGTH) |
#define | MAX_DATETIME_DISPLAY_LENGTH 29 |
#define | MAX_DATETIMETZ_DISPLAY_LENGTH (MAX_DATETIME_DISPLAY_LENGTH + MAX_TIMEZONE_DISPLAY_LENGTH) |
#define | MAX_DATE_DISPLAY_LENGTH 10 |
#define | MAX_MONETARY_DISPLAY_LENGTH 20 |
#define | MAX_DEFAULT_DISPLAY_LENGTH 20 |
#define | STRING_TYPE_PREFIX_SUFFIX_LENGTH 2 |
#define | NSTRING_TYPE_PREFIX_SUFFIX_LENGTH 3 |
#define | BIT_TYPE_PREFIX_SUFFIX_LENGTH 3 |
Functions | |
static const char * | csql_cmd_string (CUBRID_STMT_TYPE stmt_type, const char *default_string) |
static void | display_empty_result (int stmt_type, int line_no) |
static char ** | get_current_result (int **len, const CUR_RESULT_INFO *result_info, bool plain_output, bool query_output, bool loaddb_output, char column_enclosure) |
static int | write_results_to_stream (const CSQL_ARGUMENT *csql_arg, FILE *fp, const CUR_RESULT_INFO *result_info) |
static char * | uncontrol_strdup (const char *from) |
static char * | uncontrol_strndup (const char *from, int length) |
static int | calculate_width (int column_width, int string_width, int origin_width, DB_TYPE attr_type, bool is_null) |
static bool | is_string_type (DB_TYPE type) |
static bool | is_nstring_type (DB_TYPE type) |
static bool | is_bit_type (DB_TYPE type) |
static bool | is_cuttable_type_by_string_width (DB_TYPE type) |
static bool | is_type_that_has_suffix (DB_TYPE type) |
void | csql_results (const CSQL_ARGUMENT *csql_arg, DB_QUERY_RESULT *result, DB_QUERY_TYPE *attr_spec, int line_no, CUBRID_STMT_TYPE stmt_type) |
static void | csql_pipe_handler (int sig_no) |
Variables | |
static CSQL_CMD_STRING_TABLE | csql_Cmd_string_table [] |
static const char * | csql_Isolation_level_string [] |
static jmp_buf | csql_Jmp_buf |
static void(* | csql_pipe_save )(int sig) |
#define BIT_TYPE_PREFIX_SUFFIX_LENGTH 3 |
Definition at line 66 of file csql_result.c.
Referenced by calculate_width().
#define MAX_BIGINT_DISPLAY_LENGTH 20 |
Definition at line 50 of file csql_result.c.
Referenced by csql_results().
#define MAX_DATE_DISPLAY_LENGTH 10 |
Definition at line 61 of file csql_result.c.
Referenced by csql_results().
#define MAX_DATETIME_DISPLAY_LENGTH 29 |
Definition at line 58 of file csql_result.c.
Referenced by csql_results().
#define MAX_DATETIMETZ_DISPLAY_LENGTH (MAX_DATETIME_DISPLAY_LENGTH + MAX_TIMEZONE_DISPLAY_LENGTH) |
Definition at line 59 of file csql_result.c.
Referenced by csql_results().
#define MAX_DEFAULT_DISPLAY_LENGTH 20 |
Definition at line 63 of file csql_result.c.
Referenced by csql_results().
#define MAX_DOUBLE_DISPLAY_LENGTH (DBL_DIG + 9) |
Definition at line 52 of file csql_result.c.
Referenced by csql_results().
#define MAX_FLOAT_DISPLAY_LENGTH (FLT_DIG + 7) |
Definition at line 51 of file csql_result.c.
Referenced by csql_results().
#define MAX_INTEGER_DISPLAY_LENGTH 11 |
Definition at line 49 of file csql_result.c.
Referenced by csql_results().
#define MAX_MONETARY_DISPLAY_LENGTH 20 |
Definition at line 62 of file csql_result.c.
Referenced by csql_results().
#define MAX_SHORT_DISPLAY_LENGTH 6 |
Definition at line 48 of file csql_result.c.
Referenced by csql_results().
#define MAX_TIME_DISPLAY_LENGTH 11 |
Definition at line 53 of file csql_result.c.
Referenced by csql_results().
#define MAX_TIMESTAMPTZ_DISPLAY_LENGTH (MAX_UTIME_DISPLAY_LENGTH + MAX_TIMEZONE_DISPLAY_LENGTH) |
Definition at line 56 of file csql_result.c.
Referenced by csql_results().
#define MAX_TIMEZONE_DISPLAY_LENGTH 18 |
Definition at line 54 of file csql_result.c.
#define MAX_UTIME_DISPLAY_LENGTH 25 |
Definition at line 55 of file csql_result.c.
Referenced by csql_results().
#define NSTRING_TYPE_PREFIX_SUFFIX_LENGTH 3 |
Definition at line 65 of file csql_result.c.
Referenced by calculate_width().
#define STRING_TYPE_PREFIX_SUFFIX_LENGTH 2 |
Definition at line 64 of file csql_result.c.
Referenced by calculate_width().
|
static |
Definition at line 1026 of file csql_result.c.
References BIT_TYPE_PREFIX_SUFFIX_LENGTH, is_bit_type(), is_cuttable_type_by_string_width(), is_nstring_type(), is_string_type(), NSTRING_TYPE_PREFIX_SUFFIX_LENGTH, and STRING_TYPE_PREFIX_SUFFIX_LENGTH.
Referenced by write_results_to_stream().
|
static |
Definition at line 437 of file csql_result.c.
References i.
Referenced by display_empty_result(), and write_results_to_stream().
|
static |
Definition at line 705 of file csql_result.c.
References csql_Jmp_buf.
Referenced by write_results_to_stream().
void csql_results | ( | const CSQL_ARGUMENT * | csql_arg, |
DB_QUERY_RESULT * | result, | ||
DB_QUERY_TYPE * | attr_spec, | ||
int | line_no, | ||
CUBRID_STMT_TYPE | stmt_type | ||
) |
Definition at line 185 of file csql_result.c.
References assert, CUR_RESULT_INFO::attr_lengths, CUR_RESULT_INFO::attr_names, CUR_RESULT_INFO::attr_types, csql_check_server_down(), csql_display_csql_err(), CSQL_ERR_NO_MORE_MEMORY, CSQL_ERR_SQL_ERROR, csql_Error_code, CSQL_FAILURE, csql_Num_failures, csql_Output_fp, csql_Scratch_text, csql_text_utf8_to_console, CUR_RESULT_INFO::curr_stmt_line_no, CUR_RESULT_INFO::curr_stmt_type, DB_CURSOR_END, db_query_first_tuple(), db_query_format_name(), db_query_format_next(), db_query_format_type(), DB_TYPE_BIGINT, DB_TYPE_DATE, DB_TYPE_DATETIME, DB_TYPE_DATETIMELTZ, DB_TYPE_DATETIMETZ, DB_TYPE_DOUBLE, DB_TYPE_FLOAT, DB_TYPE_INTEGER, DB_TYPE_MONETARY, DB_TYPE_SHORT, DB_TYPE_TIME, DB_TYPE_TIMESTAMP, DB_TYPE_TIMESTAMPLTZ, DB_TYPE_TIMESTAMPTZ, display_empty_result(), err, error(), free_and_init, i, LC_FETCH_CURRENT_VERSION, CSQL_ARGUMENT::loaddb_output, CUR_RESULT_INFO::max_attr_name_length, MAX_BIGINT_DISPLAY_LENGTH, MAX_DATE_DISPLAY_LENGTH, MAX_DATETIME_DISPLAY_LENGTH, MAX_DATETIMETZ_DISPLAY_LENGTH, MAX_DEFAULT_DISPLAY_LENGTH, MAX_DOUBLE_DISPLAY_LENGTH, MAX_FLOAT_DISPLAY_LENGTH, MAX_INTEGER_DISPLAY_LENGTH, MAX_MONETARY_DISPLAY_LENGTH, MAX_SHORT_DISPLAY_LENGTH, MAX_TIME_DISPLAY_LENGTH, MAX_TIMESTAMPTZ_DISPLAY_LENGTH, MAX_UTIME_DISPLAY_LENGTH, NO_ERROR, nonscr_display_error(), NULL, CUR_RESULT_INFO::num_attrs, CSQL_ARGUMENT::plain_output, CSQL_ARGUMENT::query_output, CUR_RESULT_INFO::query_result, SCRATCH_TEXT_LEN, strlen, TM_TRAN_READ_FETCH_VERSION, uncontrol_strdup(), and write_results_to_stream().
Referenced by csql_execute_statements().
|
static |
Definition at line 459 of file csql_result.c.
References csql_cmd_string(), csql_fputs(), csql_fputs_console_conv(), csql_Output_fp, csql_Pager_cmd, csql_pclose(), csql_popen(), CSQL_RESULT_STMT_TITLE_FORMAT, csql_Scratch_text, CSQL_STAT_NONSCR_EMPTY_RESULT_TEXT, MSGCAT_CATALOG_CSQL, MSGCAT_CSQL_SET_CSQL, msgcat_message(), and SCRATCH_TEXT_LEN.
Referenced by csql_results().
|
static |
Definition at line 495 of file csql_result.c.
References assert, CUR_RESULT_INFO::attr_types, csql_db_value_as_string(), CSQL_ERR_NO_MORE_MEMORY, CSQL_ERR_SQL_ERROR, csql_Error_code, csql_Isolation_level_string, CSQL_LOADDB_OUTPUT, CSQL_QUERY_OUTPUT, CSQL_UNKNOWN_OUTPUT, CUBRID_STMT_GET_ISO_LVL, CUBRID_STMT_GET_TIMEOUT, CUR_RESULT_INFO::curr_stmt_type, db_get_error(), db_get_float(), db_get_int(), db_get_pointer(), db_make_null(), db_query_get_tuple_value(), db_query_set_copy_tplvalue(), DB_TYPE_ERROR, DB_TYPE_NULL, DB_TYPE_POINTER, DB_TYPE_VARIABLE, DB_VALUE_TYPE, error(), free_and_init, i, db_value::need_clear, NULL, CUR_RESULT_INFO::num_attrs, pr_clear_value(), CUR_RESULT_INFO::query_result, strlen, TRAN_ASYNC_WS_BIT, and TRAN_ISO_LVL_BITS.
Referenced by write_results_to_stream().
Definition at line 1139 of file csql_result.c.
References DB_TYPE_BIT, and DB_TYPE_VARBIT.
Referenced by calculate_width(), is_cuttable_type_by_string_width(), and is_type_that_has_suffix().
Definition at line 1159 of file csql_result.c.
References is_bit_type(), is_nstring_type(), and is_string_type().
Referenced by calculate_width().
Definition at line 1119 of file csql_result.c.
References DB_TYPE_NCHAR, and DB_TYPE_VARNCHAR.
Referenced by calculate_width(), is_cuttable_type_by_string_width(), and is_type_that_has_suffix().
Definition at line 1099 of file csql_result.c.
References DB_TYPE_CHAR, and DB_TYPE_STRING.
Referenced by calculate_width(), is_cuttable_type_by_string_width(), and is_type_that_has_suffix().
Definition at line 1170 of file csql_result.c.
References is_bit_type(), is_nstring_type(), and is_string_type().
Referenced by write_results_to_stream().
|
static |
Definition at line 1206 of file csql_result.c.
References strlen, and uncontrol_strndup().
Referenced by csql_results().
|
static |
Definition at line 1182 of file csql_result.c.
References CSQL_ERR_NO_MORE_MEMORY, csql_Error_code, and NULL.
Referenced by uncontrol_strdup().
|
static |
Definition at line 722 of file csql_result.c.
References CUR_RESULT_INFO::attr_lengths, CUR_RESULT_INFO::attr_names, CUR_RESULT_INFO::attr_types, calculate_width(), CSQL_ARGUMENT::column_delimiter, CSQL_ARGUMENT::column_enclosure, csql_cmd_string(), CSQL_ERR_SQL_ERROR, csql_Error_code, CSQL_FAILURE, csql_fputs(), csql_get_column_width(), csql_get_message(), csql_Jmp_buf, csql_Pager_cmd, csql_pclose(), csql_pipe_handler(), csql_pipe_save, csql_popen(), CSQL_RESULT_STMT_TITLE_FORMAT, csql_Row_count, csql_Scratch_text, csql_string_to_plain_string(), CSQL_SUCCESS, CUR_RESULT_INFO::curr_stmt_line_no, CUR_RESULT_INFO::curr_stmt_type, DB_CURSOR_END, db_query_first_tuple(), db_query_next_tuple(), error(), FALSE, for(), free_and_init, get_current_result(), i, is_type_that_has_suffix(), CSQL_ARGUMENT::line_output, CSQL_ARGUMENT::loaddb_output, CUR_RESULT_INFO::max_attr_name_length, NULL, CUR_RESULT_INFO::num_attrs, os_set_signal_handler(), CSQL_ARGUMENT::plain_output, CSQL_ARGUMENT::query_output, CUR_RESULT_INFO::query_result, SCRATCH_TEXT_LEN, CSQL_ARGUMENT::skip_column_names, CSQL_ARGUMENT::string_width, strlen, and TRUE.
Referenced by csql_results().
|
static |
Definition at line 87 of file csql_result.c.
|
static |
Definition at line 147 of file csql_result.c.
Referenced by get_current_result().
|
static |
Definition at line 157 of file csql_result.c.
Referenced by csql_pipe_handler(), and write_results_to_stream().
|
static |
Definition at line 710 of file csql_result.c.
Referenced by csql_help_info(), csql_killtran(), display_buffer(), and write_results_to_stream().