CUBRID Engine  latest
shard_statement.h File Reference
#include "shard_parser.h"
#include "broker_config.h"
#include "shard_proxy_queue.h"
#include "cas_protocol.h"
Include dependency graph for shard_statement.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  t_shard_stmt
 
struct  t_shard_stmt_global
 

Macros

#define SHARD_STMT_INVALID_HANDLE_ID   (-1)
 
#define SHARD_STMT_MAX_NUM_ALLOC   (8192)
 

Typedefs

typedef struct t_shard_stmt T_SHARD_STMT
 
typedef struct t_shard_stmt_global T_SHARD_STMT_GLOBAL
 

Enumerations

enum  { SHARD_STMT_STATUS_UNUSED = 0, SHARD_STMT_STATUS_IN_PROGRESS = 1, SHARD_STMT_STATUS_COMPLETE = 2, SHARD_STMT_STATUS_INVALID = 3 }
 
enum  { SHARD_STMT_TYPE_PREPARED = 0, SHARD_STMT_TYPE_SCHEMA_INFO = 1, SHARD_STMT_TYPE_EXCLUSIVE = 2 }
 

Functions

T_SHARD_STMTshard_stmt_find_by_sql (char *sql_stmt, const char *db_user, T_BROKER_VERSION client_version)
 
T_SHARD_STMTshard_stmt_find_by_stmt_h_id (int stmt_h_id)
 
int shard_stmt_pin (T_SHARD_STMT *stmt_p)
 
int shard_stmt_unpin (T_SHARD_STMT *stmt_p)
 
void shard_stmt_check_waiter_and_wakeup (T_SHARD_STMT *stmt_p)
 
T_SHARD_STMTshard_stmt_new_prepared_stmt (char *sql_stmt, int ctx_cid, unsigned int ctx_uid, T_BROKER_VERSION client_version)
 
T_SHARD_STMTshard_stmt_new_schema_info (int ctx_cid, unsigned int ctx_uid)
 
T_SHARD_STMTshard_stmt_new_exclusive (char *sql_stmt, int ctx_cid, unsigned int ctx_uid, T_BROKER_VERSION client_version)
 
void shard_stmt_free (T_SHARD_STMT *stmt_p)
 
void shard_stmt_destroy (void)
 
int shard_stmt_find_srv_h_id_for_shard_cas (int stmt_h_id, int shard_id, int cas_id)
 
int shard_stmt_add_srv_h_id_for_shard_cas (int stmt_h_id, int shard_id, int cas_id, int srv_h_id)
 
void shard_stmt_del_srv_h_id_for_shard_cas (int stmt_h_id, int shard_id, int cas_id)
 
void shard_stmt_del_all_srv_h_id_for_shard_cas (int shard_id, int cas_id)
 
int shard_stmt_set_hint_list (T_SHARD_STMT *stmt_p)
 
int shard_stmt_get_hint_type (T_SHARD_STMT *stmt_p)
 
int shard_stmt_save_prepare_request (T_SHARD_STMT *stmt_p, bool has_shard_val_hint, char **prepare_req, int *prepare_req_len, char *argv_sql_stmt, char *argv_remainder, char *orgzd_sql)
 
char * shard_str_stmt (T_SHARD_STMT *stmt_p)
 
int shard_stmt_initialize (int initial_size)
 
char * shard_stmt_rewrite_sql (bool *has_shard_val_hint, char *sql_stmt, char appl_server)
 
void shard_statement_wait_timer (void)
 
void shard_stmt_set_status_invalid (int stmt_h_id)
 
void shard_stmt_set_status_complete (int stmt_h_id)
 

Macro Definition Documentation

#define SHARD_STMT_MAX_NUM_ALLOC   (8192)

Definition at line 36 of file shard_statement.h.

Typedef Documentation

typedef struct t_shard_stmt T_SHARD_STMT

Definition at line 53 of file shard_statement.h.

Definition at line 87 of file shard_statement.h.

Enumeration Type Documentation

anonymous enum
Enumerator
SHARD_STMT_STATUS_UNUSED 
SHARD_STMT_STATUS_IN_PROGRESS 
SHARD_STMT_STATUS_COMPLETE 
SHARD_STMT_STATUS_INVALID 

Definition at line 38 of file shard_statement.h.

anonymous enum
Enumerator
SHARD_STMT_TYPE_PREPARED 
SHARD_STMT_TYPE_SCHEMA_INFO 
SHARD_STMT_TYPE_EXCLUSIVE 

Definition at line 46 of file shard_statement.h.

Function Documentation

void shard_statement_wait_timer ( void  )
int shard_stmt_add_srv_h_id_for_shard_cas ( int  stmt_h_id,
int  shard_id,
int  cas_id,
int  srv_h_id 
)
void shard_stmt_del_all_srv_h_id_for_shard_cas ( int  shard_id,
int  cas_id 
)
void shard_stmt_del_srv_h_id_for_shard_cas ( int  stmt_h_id,
int  shard_id,
int  cas_id 
)
T_SHARD_STMT* shard_stmt_new_exclusive ( char *  sql_stmt,
int  ctx_cid,
unsigned int  ctx_uid,
T_BROKER_VERSION  client_version 
)

Definition at line 548 of file shard_statement.c.

References NULL, shard_stmt_new_internal(), and SHARD_STMT_TYPE_EXCLUSIVE.

Referenced by fn_proxy_client_prepare(), and fn_proxy_client_prepare_and_execute().

Here is the caller graph for this function:

T_SHARD_STMT* shard_stmt_new_prepared_stmt ( char *  sql_stmt,
int  ctx_cid,
unsigned int  ctx_uid,
T_BROKER_VERSION  client_version 
)

Definition at line 530 of file shard_statement.c.

References NULL, shard_stmt_new_internal(), and SHARD_STMT_TYPE_PREPARED.

Referenced by fn_proxy_client_prepare().

Here is the caller graph for this function:

T_SHARD_STMT* shard_stmt_new_schema_info ( int  ctx_cid,
unsigned int  ctx_uid 
)

Definition at line 539 of file shard_statement.c.

References NULL, shard_stmt_new_internal(), and SHARD_STMT_TYPE_SCHEMA_INFO.

Referenced by fn_proxy_client_schema_info().

Here is the caller graph for this function:

char* shard_stmt_rewrite_sql ( bool has_shard_val_hint,
char *  sql_stmt,
char  appl_server 
)

The 'shard_val(n)' is changed to 'shard_id(N)'. a minimum number of chipers of n is 1; a maximum number of chipers of N is 3; so length of organized sql can be larger than length of original sql.

Definition at line 1133 of file shard_statement.c.

References error(), HT_NONE, HT_VAL, NO_ERROR, NULL, p, shard_stmt_change_shard_val_to_id(), shard_stmt_write_buf_to_sql(), sp_get_hint_type(), sp_get_token_type(), sp_is_exist_pair_token(), sp_is_pair_token(), strlen, TT_CPP_COMMENT, TT_CSQL_COMMENT, TT_DOUBLE_QUOTED, TT_HINT, TT_NEWLINE, TT_NONE, TT_SINGLE_QUOTED, and TT_WHITESPACE.

Referenced by fn_proxy_client_prepare().

Here is the caller graph for this function:

void shard_stmt_set_status_complete ( int  stmt_h_id)

Definition at line 1432 of file shard_statement.c.

References shard_stmt_set_status(), and SHARD_STMT_STATUS_COMPLETE.

Referenced by shard_stmt_add_srv_h_id_for_shard_cas().

Here is the caller graph for this function:

void shard_stmt_set_status_invalid ( int  stmt_h_id)

Definition at line 1426 of file shard_statement.c.

References shard_stmt_set_status(), and SHARD_STMT_STATUS_INVALID.

Referenced by fn_proxy_cas_prepare(), and proxy_cas_execute_internal().

Here is the caller graph for this function:

int shard_stmt_unpin ( T_SHARD_STMT stmt_p)