Add const to alloc-related thd methods
Also update abi declarations. The abi itself is unchanged, since const doesn't affect C-style exported name.
This commit is contained in:
parent
d7b0c6d8a8
commit
500787c72a
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -314,22 +314,22 @@ struct st_mysql_const_lex_string
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(THD*, size_t);
|
||||
void *(*thd_calloc_func)(THD*, size_t);
|
||||
char *(*thd_strdup_func)(THD*, const char *);
|
||||
char *(*thd_strmake_func)(THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(THD*,
|
||||
void *(*thd_alloc_func)(const THD*, size_t);
|
||||
void *(*thd_calloc_func)(const THD*, size_t);
|
||||
char *(*thd_strdup_func)(const THD*, const char *);
|
||||
char *(*thd_strmake_func)(const THD*, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const THD*, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const THD*,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
void *thd_alloc(THD* thd, size_t size);
|
||||
void *thd_calloc(THD* thd, size_t size);
|
||||
char *thd_strdup(THD* thd, const char *str);
|
||||
char *thd_strmake(THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(THD* thd, const void* str, size_t size);
|
||||
void *thd_alloc(const THD* thd, size_t size);
|
||||
void *thd_calloc(const THD* thd, size_t size);
|
||||
char *thd_strdup(const THD* thd, const char *str);
|
||||
char *thd_strmake(const THD* thd, const char *str, size_t size);
|
||||
void *thd_memdup(const THD* thd, const void* str, size_t size);
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const THD* thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ struct st_mysql_const_lex_string
|
||||
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
|
||||
|
||||
extern struct thd_alloc_service_st {
|
||||
void *(*thd_alloc_func)(MYSQL_THD, size_t);
|
||||
void *(*thd_calloc_func)(MYSQL_THD, size_t);
|
||||
char *(*thd_strdup_func)(MYSQL_THD, const char *);
|
||||
char *(*thd_strmake_func)(MYSQL_THD, const char *, size_t);
|
||||
void *(*thd_memdup_func)(MYSQL_THD, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD,
|
||||
void *(*thd_alloc_func)(const MYSQL_THD, size_t);
|
||||
void *(*thd_calloc_func)(const MYSQL_THD, size_t);
|
||||
char *(*thd_strdup_func)(const MYSQL_THD, const char *);
|
||||
char *(*thd_strmake_func)(const MYSQL_THD, const char *, size_t);
|
||||
void *(*thd_memdup_func)(const MYSQL_THD, const void*, size_t);
|
||||
MYSQL_CONST_LEX_STRING *(*thd_make_lex_string_func)(const MYSQL_THD,
|
||||
MYSQL_CONST_LEX_STRING *,
|
||||
const char *, size_t, int);
|
||||
} *thd_alloc_service;
|
||||
@ -92,23 +92,23 @@ extern struct thd_alloc_service_st {
|
||||
|
||||
@see alloc_root()
|
||||
*/
|
||||
void *thd_alloc(MYSQL_THD thd, size_t size);
|
||||
void *thd_alloc(const MYSQL_THD thd, size_t size);
|
||||
/**
|
||||
@see thd_alloc()
|
||||
*/
|
||||
void *thd_calloc(MYSQL_THD thd, size_t size);
|
||||
void *thd_calloc(const MYSQL_THD thd, size_t size);
|
||||
/**
|
||||
@see thd_alloc()
|
||||
*/
|
||||
char *thd_strdup(MYSQL_THD thd, const char *str);
|
||||
char *thd_strdup(const MYSQL_THD thd, const char *str);
|
||||
/**
|
||||
@see thd_alloc()
|
||||
*/
|
||||
char *thd_strmake(MYSQL_THD thd, const char *str, size_t size);
|
||||
char *thd_strmake(const MYSQL_THD thd, const char *str, size_t size);
|
||||
/**
|
||||
@see thd_alloc()
|
||||
*/
|
||||
void *thd_memdup(MYSQL_THD thd, const void* str, size_t size);
|
||||
void *thd_memdup(const MYSQL_THD thd, const void* str, size_t size);
|
||||
|
||||
/**
|
||||
Create a LEX_STRING in this connection's local memory pool
|
||||
@ -124,7 +124,7 @@ void *thd_memdup(MYSQL_THD thd, const void* str, size_t size);
|
||||
@see thd_alloc()
|
||||
*/
|
||||
MYSQL_CONST_LEX_STRING
|
||||
*thd_make_lex_string(MYSQL_THD thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
*thd_make_lex_string(const MYSQL_THD thd, MYSQL_CONST_LEX_STRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string);
|
||||
|
||||
|
@ -1138,31 +1138,31 @@ ret:
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void *thd_alloc(MYSQL_THD thd, size_t size)
|
||||
void *thd_alloc(const MYSQL_THD thd, size_t size)
|
||||
{
|
||||
return thd->alloc(size);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void *thd_calloc(MYSQL_THD thd, size_t size)
|
||||
void *thd_calloc(const MYSQL_THD thd, size_t size)
|
||||
{
|
||||
return thd->calloc(size);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
char *thd_strdup(MYSQL_THD thd, const char *str)
|
||||
char *thd_strdup(const MYSQL_THD thd, const char *str)
|
||||
{
|
||||
return thd->strdup(str);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
char *thd_strmake(MYSQL_THD thd, const char *str, size_t size)
|
||||
char *thd_strmake(const MYSQL_THD thd, const char *str, size_t size)
|
||||
{
|
||||
return thd->strmake(str, size);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
LEX_CSTRING *thd_make_lex_string(THD *thd, LEX_CSTRING *lex_str,
|
||||
LEX_CSTRING *thd_make_lex_string(const THD *thd, LEX_CSTRING *lex_str,
|
||||
const char *str, size_t size,
|
||||
int allocate_lex_string)
|
||||
{
|
||||
@ -1171,7 +1171,7 @@ LEX_CSTRING *thd_make_lex_string(THD *thd, LEX_CSTRING *lex_str,
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void *thd_memdup(MYSQL_THD thd, const void* str, size_t size)
|
||||
void *thd_memdup(const MYSQL_THD thd, const void* str, size_t size)
|
||||
{
|
||||
return thd->memdup(str, size);
|
||||
}
|
||||
@ -2345,7 +2345,7 @@ void THD::cleanup_after_query()
|
||||
|
||||
bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
const char *from, size_t from_length,
|
||||
CHARSET_INFO *from_cs)
|
||||
CHARSET_INFO *from_cs) const
|
||||
{
|
||||
DBUG_ENTER("THD::convert_string");
|
||||
size_t new_length= to_cs->mbmaxlen * from_length;
|
||||
@ -2382,7 +2382,7 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
*/
|
||||
|
||||
bool THD::reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *cs,
|
||||
const char *str, size_t length)
|
||||
const char *str, size_t length) const
|
||||
{
|
||||
/*
|
||||
When reinterpreting from binary to tricky character sets like
|
||||
@ -2424,7 +2424,7 @@ bool THD::reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *cs,
|
||||
*/
|
||||
bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length,
|
||||
String_copier *status)
|
||||
String_copier *status) const
|
||||
{
|
||||
DBUG_ENTER("THD::convert_fix");
|
||||
size_t dst_length= dstcs->mbmaxlen * src_length;
|
||||
@ -2442,7 +2442,7 @@ bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
*/
|
||||
bool THD::copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length,
|
||||
String_copier *status)
|
||||
String_copier *status) const
|
||||
{
|
||||
DBUG_ENTER("THD::copy_fix");
|
||||
size_t dst_length= dstcs->mbmaxlen * src_length;
|
||||
@ -2474,7 +2474,7 @@ public:
|
||||
|
||||
bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs,
|
||||
const char *src, size_t src_length)
|
||||
const char *src, size_t src_length) const
|
||||
{
|
||||
String_copier_with_error status;
|
||||
return convert_fix(dstcs, dst, srccs, src, src_length, &status) ||
|
||||
@ -2484,7 +2484,7 @@ bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
|
||||
bool THD::copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs,
|
||||
const char *src, size_t src_length)
|
||||
const char *src, size_t src_length) const
|
||||
{
|
||||
String_copier_with_error status;
|
||||
return copy_fix(dstcs, dst, srccs, src, src_length, &status) ||
|
||||
@ -2507,7 +2507,8 @@ bool THD::copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
!0 out of memory
|
||||
*/
|
||||
|
||||
bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||
bool THD::convert_string(String *s, CHARSET_INFO *from_cs,
|
||||
CHARSET_INFO *to_cs)
|
||||
{
|
||||
uint dummy_errors;
|
||||
if (unlikely(convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs,
|
||||
@ -2539,7 +2540,8 @@ bool THD::check_string_for_wellformedness(const char *str,
|
||||
}
|
||||
|
||||
|
||||
bool THD::to_ident_sys_alloc(Lex_ident_sys_st *to, const Lex_ident_cli_st *ident)
|
||||
bool THD::to_ident_sys_alloc(Lex_ident_sys_st *to,
|
||||
const Lex_ident_cli_st *ident) const
|
||||
{
|
||||
if (ident->is_quoted())
|
||||
{
|
||||
|
@ -1221,21 +1221,21 @@ public:
|
||||
inline bool is_conventional() const
|
||||
{ return state == STMT_CONVENTIONAL_EXECUTION; }
|
||||
|
||||
inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
|
||||
inline void* calloc(size_t size)
|
||||
inline void* alloc(size_t size) const { return alloc_root(mem_root,size); }
|
||||
inline void* calloc(size_t size) const
|
||||
{
|
||||
void *ptr;
|
||||
if (likely((ptr=alloc_root(mem_root,size))))
|
||||
bzero(ptr, size);
|
||||
return ptr;
|
||||
}
|
||||
inline char *strdup(const char *str)
|
||||
inline char *strdup(const char *str) const
|
||||
{ return strdup_root(mem_root,str); }
|
||||
inline char *strmake(const char *str, size_t size)
|
||||
inline char *strmake(const char *str, size_t size) const
|
||||
{ return strmake_root(mem_root,str,size); }
|
||||
inline void *memdup(const void *str, size_t size)
|
||||
inline void *memdup(const void *str, size_t size) const
|
||||
{ return memdup_root(mem_root,str,size); }
|
||||
inline void *memdup_w_gap(const void *str, size_t size, size_t gap)
|
||||
inline void *memdup_w_gap(const void *str, size_t size, size_t gap) const
|
||||
{
|
||||
void *ptr;
|
||||
if (likely((ptr= alloc_root(mem_root,size+gap))))
|
||||
@ -2695,7 +2695,7 @@ public:
|
||||
Protocol_binary protocol_binary; // Binary protocol
|
||||
HASH user_vars; // hash for user variables
|
||||
String packet; // dynamic buffer for network I/O
|
||||
String convert_buffer; // buffer for charset conversions
|
||||
String convert_buffer; // buffer for charset conversions
|
||||
struct my_rnd_struct rand; // used for authentication
|
||||
struct system_variables variables; // Changeable local variables
|
||||
struct system_status_var status_var; // Per thread statistic vars
|
||||
@ -4148,24 +4148,25 @@ public:
|
||||
{
|
||||
return !stmt_arena->is_stmt_prepare();
|
||||
}
|
||||
inline void* trans_alloc(size_t size)
|
||||
inline void* trans_alloc(size_t size) const
|
||||
{
|
||||
return alloc_root(&transaction->mem_root,size);
|
||||
}
|
||||
|
||||
LEX_CSTRING strmake_lex_cstring(const char *str, size_t length)
|
||||
LEX_CSTRING strmake_lex_cstring(const char *str, size_t length) const
|
||||
{
|
||||
const char *tmp= strmake_root(mem_root, str, length);
|
||||
if (!tmp)
|
||||
return {0,0};
|
||||
return {tmp, length};
|
||||
}
|
||||
LEX_CSTRING strmake_lex_cstring(const LEX_CSTRING &from)
|
||||
LEX_CSTRING strmake_lex_cstring(const LEX_CSTRING &from) const
|
||||
{
|
||||
return strmake_lex_cstring(from.str, from.length);
|
||||
}
|
||||
|
||||
LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, size_t length)
|
||||
LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str,
|
||||
size_t length) const
|
||||
{
|
||||
if (!(lex_str->str= strmake_root(mem_root, str, length)))
|
||||
{
|
||||
@ -4175,7 +4176,8 @@ public:
|
||||
lex_str->length= length;
|
||||
return lex_str;
|
||||
}
|
||||
LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str, const char* str, size_t length)
|
||||
LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str, const char* str,
|
||||
size_t length) const
|
||||
{
|
||||
if (!(lex_str->str= strmake_root(mem_root, str, length)))
|
||||
{
|
||||
@ -4186,7 +4188,8 @@ public:
|
||||
return lex_str;
|
||||
}
|
||||
// Remove double quotes: aaa""bbb -> aaa"bbb
|
||||
bool quote_unescape(LEX_CSTRING *dst, const LEX_CSTRING *src, char quote)
|
||||
bool quote_unescape(LEX_CSTRING *dst, const LEX_CSTRING *src,
|
||||
char quote) const
|
||||
{
|
||||
const char *tmp= src->str;
|
||||
const char *tmpend= src->str + src->length;
|
||||
@ -4206,7 +4209,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
LEX_CSTRING *make_clex_string(const char* str, size_t length)
|
||||
LEX_CSTRING *make_clex_string(const char* str, size_t length) const
|
||||
{
|
||||
LEX_CSTRING *lex_str;
|
||||
char *tmp;
|
||||
@ -4221,13 +4224,13 @@ public:
|
||||
lex_str->length= length;
|
||||
return lex_str;
|
||||
}
|
||||
LEX_CSTRING *make_clex_string(const LEX_CSTRING from)
|
||||
LEX_CSTRING *make_clex_string(const LEX_CSTRING from) const
|
||||
{
|
||||
return make_clex_string(from.str, from.length);
|
||||
}
|
||||
|
||||
// Allocate LEX_STRING for character set conversion
|
||||
bool alloc_lex_string(LEX_STRING *dst, size_t length)
|
||||
bool alloc_lex_string(LEX_STRING *dst, size_t length) const
|
||||
{
|
||||
if (likely((dst->str= (char*) alloc(length))))
|
||||
return false;
|
||||
@ -4236,12 +4239,13 @@ public:
|
||||
}
|
||||
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
const char *from, size_t from_length,
|
||||
CHARSET_INFO *from_cs);
|
||||
CHARSET_INFO *from_cs) const;
|
||||
bool reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *to_cs,
|
||||
const char *from, size_t from_length);
|
||||
const char *from, size_t from_length)
|
||||
const;
|
||||
bool convert_string(LEX_CSTRING *to, CHARSET_INFO *to_cs,
|
||||
const char *from, size_t from_length,
|
||||
CHARSET_INFO *from_cs)
|
||||
CHARSET_INFO *from_cs) const
|
||||
{
|
||||
LEX_STRING tmp;
|
||||
bool rc= convert_string(&tmp, to_cs, from, from_length, from_cs);
|
||||
@ -4251,7 +4255,7 @@ public:
|
||||
}
|
||||
bool convert_string(LEX_CSTRING *to, CHARSET_INFO *tocs,
|
||||
const LEX_CSTRING *from, CHARSET_INFO *fromcs,
|
||||
bool simple_copy_is_possible)
|
||||
bool simple_copy_is_possible) const
|
||||
{
|
||||
if (!simple_copy_is_possible)
|
||||
return unlikely(convert_string(to, tocs, from->str, from->length, fromcs));
|
||||
@ -4267,7 +4271,7 @@ public:
|
||||
*/
|
||||
bool convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length,
|
||||
String_copier *status);
|
||||
String_copier *status) const;
|
||||
|
||||
/*
|
||||
Same as above, but additionally sends ER_INVALID_CHARACTER_STRING
|
||||
@ -4275,7 +4279,7 @@ public:
|
||||
*/
|
||||
bool convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs,
|
||||
const char *src, size_t src_length);
|
||||
const char *src, size_t src_length) const;
|
||||
/*
|
||||
If either "dstcs" or "srccs" is &my_charset_bin,
|
||||
then performs native copying using copy_fix().
|
||||
@ -4283,16 +4287,18 @@ public:
|
||||
*/
|
||||
bool copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length,
|
||||
String_copier *status);
|
||||
String_copier *status) const;
|
||||
|
||||
/*
|
||||
Same as above, but additionally sends ER_INVALID_CHARACTER_STRING
|
||||
in case of bad byte sequences or Unicode conversion problems.
|
||||
*/
|
||||
bool copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length);
|
||||
CHARSET_INFO *srccs, const char *src, size_t src_length)
|
||||
const;
|
||||
|
||||
bool convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs);
|
||||
bool convert_string(String *s, CHARSET_INFO *from_cs,
|
||||
CHARSET_INFO *to_cs);
|
||||
|
||||
/*
|
||||
Check if the string is wellformed, raise an error if not wellformed.
|
||||
@ -4303,7 +4309,8 @@ public:
|
||||
size_t length,
|
||||
CHARSET_INFO *cs) const;
|
||||
|
||||
bool to_ident_sys_alloc(Lex_ident_sys_st *to, const Lex_ident_cli_st *from);
|
||||
bool to_ident_sys_alloc(Lex_ident_sys_st *to,
|
||||
const Lex_ident_cli_st *from) const;
|
||||
|
||||
/*
|
||||
Create a string literal with optional client->connection conversion.
|
||||
@ -4313,7 +4320,8 @@ public:
|
||||
*/
|
||||
Item_basic_constant *make_string_literal(const char *str, size_t length,
|
||||
my_repertoire_t repertoire);
|
||||
Item_basic_constant *make_string_literal(const Lex_string_with_metadata_st &str)
|
||||
Item_basic_constant *
|
||||
make_string_literal(const Lex_string_with_metadata_st &str)
|
||||
{
|
||||
my_repertoire_t repertoire= str.repertoire(variables.character_set_client);
|
||||
return make_string_literal(str.str, str.length, repertoire);
|
||||
|
@ -9683,18 +9683,18 @@ Item *LEX::create_item_qualified_asterisk(THD *thd,
|
||||
}
|
||||
|
||||
|
||||
bool Lex_ident_sys_st::copy_ident_cli(THD *thd, const Lex_ident_cli_st *str)
|
||||
bool Lex_ident_sys_st::copy_ident_cli(const THD *thd, const Lex_ident_cli_st *str)
|
||||
{
|
||||
return thd->to_ident_sys_alloc(this, str);
|
||||
}
|
||||
|
||||
bool Lex_ident_sys_st::copy_keyword(THD *thd, const Lex_ident_cli_st *str)
|
||||
bool Lex_ident_sys_st::copy_keyword(const THD *thd, const Lex_ident_cli_st *str)
|
||||
{
|
||||
return thd->make_lex_string(static_cast<LEX_CSTRING*>(this),
|
||||
str->str, str->length) == NULL;
|
||||
}
|
||||
|
||||
bool Lex_ident_sys_st::copy_or_convert(THD *thd,
|
||||
bool Lex_ident_sys_st::copy_or_convert(const THD *thd,
|
||||
const Lex_ident_cli_st *src,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
@ -9704,7 +9704,7 @@ bool Lex_ident_sys_st::copy_or_convert(THD *thd,
|
||||
}
|
||||
|
||||
|
||||
bool Lex_ident_sys_st::copy_sys(THD *thd, const LEX_CSTRING *src)
|
||||
bool Lex_ident_sys_st::copy_sys(const THD *thd, const LEX_CSTRING *src)
|
||||
{
|
||||
if (thd->check_string_for_wellformedness(src->str, src->length,
|
||||
system_charset_info))
|
||||
@ -9713,7 +9713,7 @@ bool Lex_ident_sys_st::copy_sys(THD *thd, const LEX_CSTRING *src)
|
||||
}
|
||||
|
||||
|
||||
bool Lex_ident_sys_st::convert(THD *thd,
|
||||
bool Lex_ident_sys_st::convert(const THD *thd,
|
||||
const LEX_CSTRING *src, CHARSET_INFO *cs)
|
||||
{
|
||||
LEX_STRING tmp;
|
||||
|
@ -148,11 +148,12 @@ public:
|
||||
struct Lex_ident_sys_st: public LEX_CSTRING
|
||||
{
|
||||
public:
|
||||
bool copy_ident_cli(THD *thd, const Lex_ident_cli_st *str);
|
||||
bool copy_keyword(THD *thd, const Lex_ident_cli_st *str);
|
||||
bool copy_sys(THD *thd, const LEX_CSTRING *str);
|
||||
bool convert(THD *thd, const LEX_CSTRING *str, CHARSET_INFO *cs);
|
||||
bool copy_or_convert(THD *thd, const Lex_ident_cli_st *str, CHARSET_INFO *cs);
|
||||
bool copy_ident_cli(const THD *thd, const Lex_ident_cli_st *str);
|
||||
bool copy_keyword(const THD *thd, const Lex_ident_cli_st *str);
|
||||
bool copy_sys(const THD *thd, const LEX_CSTRING *str);
|
||||
bool convert(const THD *thd, const LEX_CSTRING *str, CHARSET_INFO *cs);
|
||||
bool copy_or_convert(const THD *thd, const Lex_ident_cli_st *str,
|
||||
CHARSET_INFO *cs);
|
||||
bool is_null() const { return str == NULL; }
|
||||
bool to_size_number(ulonglong *to) const;
|
||||
void set_valid_utf8(const LEX_CSTRING *name)
|
||||
@ -167,7 +168,7 @@ public:
|
||||
class Lex_ident_sys: public Lex_ident_sys_st
|
||||
{
|
||||
public:
|
||||
Lex_ident_sys(THD *thd, const Lex_ident_cli_st *str)
|
||||
Lex_ident_sys(const THD *thd, const Lex_ident_cli_st *str)
|
||||
{
|
||||
if (copy_ident_cli(thd, str))
|
||||
((LEX_CSTRING &) *this)= null_clex_str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user