32 static const char *
left_trim (
const char *str);
34 static inline const char *
left_trim (
const char *str);
118 if (parser_p !=
NULL)
217 return start_token == end_token;
235 static inline const char *
241 while (*p && isspace (*p))
275 while (isspace (p[length - 1]))
301 value_p->
string.
value_ex = (
char *) malloc (
sizeof (
char) * (length + 1));
319 char tmp = pos[length];
479 while (hint_p !=
NULL)
554 if (tolower (*p) ==
'i' && tolower (*(p + 1)) ==
'n' && (isspace (*(p + 2)) || *(p + 2) ==
'('))
580 if (strncasecmp (sql,
"shard_", 6) != 0)
586 if (strncasecmp (sql,
"key", 3) == 0)
591 else if (strncasecmp (sql,
"val", 3) == 0)
596 else if (strncasecmp (sql,
"all", 3) == 0)
601 else if (strncasecmp (sql,
"id", 2) == 0)
653 if (*(sql++) ==
'*' && *(sql++) ==
'/')
817 while (*s && (!isspace (*s) && *s !=
',' && *s !=
')'))
enum sp_hint_type SP_HINT_TYPE
char * sp_get_hint_key(SP_PARSER_HINT *hint_p)
SP_PARSER_HINT * sp_get_first_static_hint(SP_PARSER_CTX *parser_p)
SP_PARSER_HINT_LIST list_t[2]
void sp_free_parser_hint(SP_PARSER_HINT *hint_p)
void sp_destroy_parser(SP_PARSER_CTX *parser_p)
static bool sp_is_start_token(SP_TOKEN token)
SP_PARSER_HINT * sp_get_first_dynamic_hint(SP_PARSER_CTX *parser_p)
SP_PARSER_HINT_LIST list_a
#define SP_VALUE_INIT_SIZE
SP_PARSER_HINT * sp_get_next_static_hint(SP_PARSER_HINT *hint_p)
static int sp_make_string_sp_value(SP_VALUE *value_p, const char *pos, int length)
static int sp_get_int_bind_value(SP_PARSER_CTX *parser_p, SP_PARSER_HINT *hint_p)
static int sp_get_bind_type_and_value(SP_PARSER_CTX *parser_p, SP_PARSER_HINT *hint_p)
static int sp_make_int_sp_value_from_string(SP_VALUE *value_p, char *pos, int length)
SP_PARSER_HINT * sp_get_first_hint(SP_PARSER_CTX *parser_p)
SP_PARSER_CTX * sp_create_parser(const char *sql_stmt)
const char * sp_check_end_of_hint(const char *sql, int *error)
static void sp_append_parser_hint_to_ctx(SP_PARSER_CTX *parser_p, SP_PARSER_HINT *hint_p)
static int sp_parse_sql_internal(SP_PARSER_CTX *parser_p)
static void sp_init_praser_hint_list(SP_PARSER_HINT_LIST *list)
const char * sp_get_token_type(const char *sql, SP_TOKEN *token)
SP_PARSER_HINT * next_t[2]
bool sp_is_pair_token(SP_TOKEN start_token, SP_TOKEN end_token)
int sp_get_total_hint_count(SP_PARSER_CTX *parser_p)
static int sp_get_string_bind_value(SP_PARSER_CTX *parser_p, SP_PARSER_HINT *hint_p)
static int sp_make_sp_value(SP_VALUE *value_p, const char *pos, int length)
bool sp_is_hint_static(SP_PARSER_CTX *parser_p)
static void sp_free_parser_hint_from_ctx(SP_PARSER_CTX *parser_p)
enum sp_bind_type SP_BIND_TYPE
const char * sp_get_hint_arg(const char *sql, SP_PARSER_HINT *hint_p, int *error)
SP_PARSER_HINT * sp_create_parser_hint(void)
int sp_get_static_hint_count(SP_PARSER_CTX *parser_p)
static void error(const char *msg)
SP_PARSER_HINT * sp_get_next_dynamic_hint(SP_PARSER_HINT *hint_p)
int sp_get_dynamic_hint_count(SP_PARSER_CTX *parser_p)
#define PROXY_LOG(level, fmt, args...)
const char * sp_get_hint_type(const char *sql, SP_HINT_TYPE *hint_type)
static void sp_free_sp_value(SP_VALUE *value_p)
static int sp_init_sp_value(SP_VALUE *value_p)
struct sp_value::@40 string
char * strdup(const char *str)
int parse_bigint(INT64 *ret_p, const char *str_p, int base)
static int sp_is_valid_hint(SP_PARSER_CTX *parser_p, SP_PARSER_HINT *hint_p)
bool sp_is_exist_pair_token(SP_TOKEN token)
int sp_parse_sql(SP_PARSER_CTX *parser_p)
const char * sp_get_sql_stmt(SP_PARSER_CTX *parser_p)
static int sp_process_token(SP_PARSER_CTX *parser_p, SP_TOKEN token_type)
SP_PARSER_HINT * sp_get_next_hint(SP_PARSER_HINT *hint_p)
char value_arr[SP_VALUE_INIT_SIZE]
static const char * left_trim(const char *str)
static void sp_copy_cursor_to_prv(SP_PARSER_CTX *parser_p)