97
97
static const char *load_default_groups[]= { "drizzletest", "client", 0 };
98
98
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
100
static uint start_lineno= 0; /* Start line of current command */
101
static uint my_end_arg= 0;
100
static uint32_t start_lineno= 0; /* Start line of current command */
101
static uint32_t my_end_arg= 0;
103
103
/* Number of lines of the result to include in failure report */
104
static uint opt_tail_lines= 0;
104
static uint32_t opt_tail_lines= 0;
106
106
static char delimiter[MAX_DELIMITER_LENGTH]= ";";
107
static uint delimiter_length= 1;
107
static uint32_t delimiter_length= 1;
109
109
static char TMPDIR[FN_REFLEN];
397
397
VAR* var_get(const char *var_name, const char** var_name_end,
398
398
bool raw, bool ignore_not_existing);
399
399
void eval_expr(VAR* v, const char *p, const char** p_end);
400
bool match_delimiter(int c, const char *delim, uint length);
400
bool match_delimiter(int c, const char *delim, uint32_t length);
401
401
void dump_result_to_reject_file(char *buf, int size);
402
402
void dump_result_to_log_file(const char *buf, int size);
403
403
void dump_warning_messages(void);
435
435
void replace_append_mem(string *ds, const char *val,
437
437
void replace_append(string *ds, const char *val);
438
void replace_append_uint(string *ds, uint val);
438
void replace_append_uint(string *ds, uint32_t val);
439
439
void append_sorted(string* ds, string* ds_input);
441
441
void handle_error(struct st_command*,
4813
4813
Append the result for one field to the dynamic string ds
4816
static void append_field(string *ds, uint col_idx, const DRIZZLE_FIELD* field,
4816
static void append_field(string *ds, uint32_t col_idx, const DRIZZLE_FIELD* field,
4817
4817
const char* val, uint64_t len, bool is_null)
4819
4819
if (col_idx < max_replace_column && replace_column[col_idx])
6042
6042
TYPELIB typelib; /* Pointer to strings */
6043
6043
unsigned char *str; /* Strings is here */
6044
6044
uint8_t *flag; /* Flag about each var. */
6045
uint array_allocs,max_count,length,max_length;
6045
uint32_t array_allocs,max_count,length,max_length;
6046
6046
} POINTER_ARRAY;
6048
6048
struct st_replace;
6049
struct st_replace *init_replace(char * *from, char * *to, uint count,
6049
struct st_replace *init_replace(char * *from, char * *to, uint32_t count,
6050
6050
char * word_end_chars);
6051
6051
int insert_pointer_name(POINTER_ARRAY *pa,char * name);
6052
6052
void replace_strings_append(struct st_replace *rep, string* ds,
6490
6490
#define LAST_CHAR_CODE 259
6492
6492
typedef struct st_rep_set {
6493
uint *bits; /* Pointer to used sets */
6493
uint32_t *bits; /* Pointer to used sets */
6494
6494
short next[LAST_CHAR_CODE]; /* Pointer to next sets */
6495
uint found_len; /* Best match to date */
6495
uint32_t found_len; /* Best match to date */
6496
6496
int found_offset;
6498
uint size_of_bits; /* For convinience */
6497
uint32_t table_offset;
6498
uint32_t size_of_bits; /* For convinience */
6501
6501
typedef struct st_rep_sets {
6502
uint count; /* Number of sets */
6503
uint extra; /* Extra sets in buffer */
6504
uint invisible; /* Sets not chown */
6502
uint32_t count; /* Number of sets */
6503
uint32_t extra; /* Extra sets in buffer */
6504
uint32_t invisible; /* Sets not chown */
6505
uint32_t size_of_bits;
6506
6506
REP_SET *set,*set_buffer;
6507
uint32_t *bit_buffer;
6510
6510
typedef struct st_found_set {
6511
uint32_t table_offset;
6512
6512
int found_offset;
6515
6515
typedef struct st_follow {
6517
uint32_t table_offset;
6522
int init_sets(REP_SETS *sets,uint states);
6522
int init_sets(REP_SETS *sets,uint32_t states);
6523
6523
REP_SET *make_new_set(REP_SETS *sets);
6524
6524
void make_sets_invisible(REP_SETS *sets);
6525
6525
void free_last_set(REP_SETS *sets);
6526
6526
void free_sets(REP_SETS *sets);
6527
void internal_set_bit(REP_SET *set, uint bit);
6528
void internal_clear_bit(REP_SET *set, uint bit);
6527
void internal_set_bit(REP_SET *set, uint32_t bit);
6528
void internal_clear_bit(REP_SET *set, uint32_t bit);
6529
6529
void or_bits(REP_SET *to,REP_SET *from);
6530
6530
void copy_bits(REP_SET *to,REP_SET *from);
6531
6531
int cmp_bits(REP_SET *set1,REP_SET *set2);
6532
int get_next_bit(REP_SET *set,uint lastpos);
6532
int get_next_bit(REP_SET *set,uint32_t lastpos);
6533
6533
int find_set(REP_SETS *sets,REP_SET *find);
6534
int find_found(FOUND_SET *found_set,uint table_offset,
6534
int find_found(FOUND_SET *found_set,uint32_t table_offset,
6535
6535
int found_offset);
6536
uint start_at_word(char * pos);
6537
uint end_of_word(char * pos);
6539
static uint found_sets=0;
6542
static uint replace_len(char * str)
6536
uint32_t start_at_word(char * pos);
6537
uint32_t end_of_word(char * pos);
6539
static uint32_t found_sets=0;
6542
static uint32_t replace_len(char * str)
6547
6547
if (str[0] == '\\' && str[1])
6555
6555
/* Init a replace structure for further calls */
6557
REPLACE *init_replace(char * *from, char * *to,uint count,
6557
REPLACE *init_replace(char * *from, char * *to,uint32_t count,
6558
6558
char * word_end_chars)
6560
6560
static const int SPACE_CHAR= 256;
6561
6561
static const int START_OF_LINE= 257;
6562
6562
static const int END_OF_LINE= 258;
6564
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
6564
uint32_t i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
6565
6565
int used_sets,chr,default_state;
6566
6566
char used_chars[LAST_CHAR_CODE],is_word_end[256];
6567
6567
char * pos, *to_pos, **to_array;
6915
void internal_set_bit(REP_SET *set, uint bit)
6915
void internal_set_bit(REP_SET *set, uint32_t bit)
6917
6917
set->bits[bit / WORD_BIT] |= 1 << (bit % WORD_BIT);
6921
void internal_clear_bit(REP_SET *set, uint bit)
6921
void internal_clear_bit(REP_SET *set, uint32_t bit)
6923
6923
set->bits[bit / WORD_BIT] &= ~ (1 << (bit % WORD_BIT));
6948
6948
/* Get next set bit from set. */
6950
int get_next_bit(REP_SET *set,uint lastpos)
6950
int get_next_bit(REP_SET *set,uint32_t lastpos)
6952
uint pos,*start,*end,bits;
6952
uint32_t pos,*start,*end,bits;
6954
6954
start=set->bits+ ((lastpos+1) / WORD_BIT);
6955
6955
end=set->bits + set->size_of_bits;
7009
7009
/* Return 1 if regexp starts with \b or ends with \b*/
7011
uint start_at_word(char * pos)
7011
uint32_t start_at_word(char * pos)
7013
7013
return (((!memcmp(pos, "\\b",2) && pos[2]) ||
7014
7014
!memcmp(pos, "\\^", 2)) ? 1 : 0);
7017
uint end_of_word(char * pos)
7017
uint32_t end_of_word(char * pos)
7019
7019
char * end= strchr(pos, '\0');
7020
7020
return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) ||
7147
7147
replace_append_mem(ds, val, strlen(val));
7150
/* Append uint to ds, with optional replace */
7151
void replace_append_uint(string *ds, uint val)
7150
/* Append uint32_t to ds, with optional replace */
7151
void replace_append_uint(string *ds, uint32_t val)
7153
7153
char buff[22]; /* This should be enough for any int */
7154
7154
char *end= int64_t10_to_str(val, buff, 10);