MWL#36: Add a mysqlbinlog option to change the used database.
Make sql_alloc() declaration "public" for a client context. The reason is that sql_alloc() is used in definition of some common purpose stuff (e.g. sql_list.*). To make this stuff available for a client context we declare sql_alloc() as a "virtual function", i.e. as a function that is already declared but must be defined in this context (note that definition of sql_alloc() in thr_malloc.cc is #ifndef'ed for MYSQL_CLIENT). Also make sql_string.h repeatedly includable.
This commit is contained in:
parent
8ea19fa73e
commit
6bc7eab161
@ -26,15 +26,6 @@
|
|||||||
#ifdef HAVE_FCONVERT
|
#ifdef HAVE_FCONVERT
|
||||||
#include <floatingpoint.h>
|
#include <floatingpoint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
The following extern declarations are ok as these are interface functions
|
|
||||||
required by the string function
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void sql_alloc(size_t size);
|
|
||||||
extern void sql_element_free(void *ptr);
|
|
||||||
|
|
||||||
#include "sql_string.h"
|
#include "sql_string.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -92,12 +92,16 @@ extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
|
|||||||
#include "unireg.h"
|
#include "unireg.h"
|
||||||
|
|
||||||
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
|
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
|
||||||
|
#endif // MYSQL_CLIENT
|
||||||
|
|
||||||
void *sql_alloc(size_t);
|
void *sql_alloc(size_t);
|
||||||
void *sql_calloc(size_t);
|
void *sql_calloc(size_t);
|
||||||
char *sql_strdup(const char *str);
|
char *sql_strdup(const char *str);
|
||||||
char *sql_strmake(const char *str, size_t len);
|
char *sql_strmake(const char *str, size_t len);
|
||||||
void *sql_memdup(const void * ptr, size_t size);
|
void *sql_memdup(const void * ptr, size_t size);
|
||||||
void sql_element_free(void *ptr);
|
void sql_element_free(void *ptr);
|
||||||
|
|
||||||
|
#ifndef MYSQL_CLIENT
|
||||||
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
size_t max_res_length,
|
size_t max_res_length,
|
||||||
|
@ -26,15 +26,6 @@
|
|||||||
#ifdef HAVE_FCONVERT
|
#ifdef HAVE_FCONVERT
|
||||||
#include <floatingpoint.h>
|
#include <floatingpoint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
The following extern declarations are ok as these are interface functions
|
|
||||||
required by the string function
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern uchar* sql_alloc(unsigned size);
|
|
||||||
extern void sql_element_free(void *ptr);
|
|
||||||
|
|
||||||
#include "sql_string.h"
|
#include "sql_string.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#ifndef MYSQL_SQL_STRING_H_INCLUDED
|
||||||
|
#define MYSQL_SQL_STRING_H_INCLUDED
|
||||||
/* Copyright (C) 2000 MySQL AB
|
/* Copyright (C) 2000 MySQL AB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -394,3 +396,5 @@ static inline bool check_if_only_end_space(CHARSET_INFO *cs, char *str,
|
|||||||
{
|
{
|
||||||
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
|
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // MYSQL_SQL_STRING_H_INCLUDED
|
||||||
|
@ -59,11 +59,13 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MYSQL_CLIENT
|
||||||
void *sql_alloc(size_t Size)
|
void *sql_alloc(size_t Size)
|
||||||
{
|
{
|
||||||
MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
|
MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
|
||||||
return alloc_root(root,Size);
|
return alloc_root(root,Size);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void *sql_calloc(size_t size)
|
void *sql_calloc(size_t size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user