summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/CMakeLists.txt29
-rw-r--r--libmysqld/emb_qcache.cc14
-rw-r--r--libmysqld/emb_qcache.h4
-rw-r--r--libmysqld/lib_sql.cc41
-rw-r--r--libmysqld/libmysql.c14
5 files changed, 62 insertions, 40 deletions
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 2236d306318..4a508fe22b8 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -29,8 +29,10 @@ ${SSL_INTERNAL_INCLUDE_DIRS}
)
SET(GEN_SOURCES
-${CMAKE_BINARY_DIR}/sql/sql_yacc.h
+${CMAKE_BINARY_DIR}/sql/sql_yacc.hh
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
+${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.hh
+${CMAKE_BINARY_DIR}/sql/sql_yacc_ora.cc
${CMAKE_BINARY_DIR}/sql/lex_hash.h
)
@@ -42,7 +44,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql-common/my_user.c ../sql-common/pack.c
../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc
- ../sql/field.cc ../sql/field_conv.cc
+ ../sql/field.cc ../sql/field_conv.cc ../sql/field_comp.cc
../sql/filesort_utils.cc ../sql/sql_digest.cc
../sql/filesort.cc ../sql/gstream.cc ../sql/slave.cc
../sql/signal_handler.cc
@@ -89,7 +91,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/scheduler.cc ../sql/sql_audit.cc
../sql/sql_alter.cc ../sql/sql_partition_admin.cc
../sql/event_parse_data.cc
- ../sql/sql_signal.cc ../sql/rpl_handler.cc
+ ../sql/sql_signal.cc
../sql/sys_vars.cc
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
../sql/mdl.cc ../sql/transaction.cc
@@ -112,8 +114,13 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/wsrep_dummy.cc ../sql/encryption.cc
../sql/item_windowfunc.cc ../sql/sql_window.cc
../sql/sql_cte.cc
+ ../sql/sql_sequence.cc ../sql/sql_sequence.h
+ ../sql/ha_sequence.cc ../sql/ha_sequence.h
../sql/temporary_tables.cc
- ../sql/session_tracker.cc
+ ../sql/proxy_protocol.cc
+ ../sql/sql_tvc.cc ../sql/sql_tvc.h
+ ../sql/opt_split.cc
+ ../sql/item_vers.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
@@ -130,7 +137,7 @@ IF(WIN32)
SET(COMPONENT_MYSQLSERVER "Embedded")
SET(COMPONENT_LIBMYSQLD "Embedded")
ELSE()
- SET(MYSQLSERVER_OUTPUT_NAME mysqld)
+ SET(MYSQLSERVER_OUTPUT_NAME mariadbd)
SET(COMPONENT_MYSQLSERVER "Development")
SET(COMPONENT_LIBMYSQLD "Server")
ENDIF()
@@ -148,8 +155,7 @@ SET(LIBS
# (with corresponding target ${engine}_embedded)
SET(EMBEDDED_LIBS)
FOREACH(LIB ${LIBS})
- GET_TARGET_PROPERTY(EMBEDDED_LOCATION ${LIB}_embedded LOCATION)
- IF(EMBEDDED_LOCATION)
+ IF(TARGET ${LIB}_embedded)
LIST(APPEND EMBEDDED_LIBS ${LIB}_embedded)
ELSE()
LIST(APPEND EMBEDDED_LIBS ${LIB})
@@ -158,7 +164,9 @@ ENDFOREACH()
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT ${COMPONENT_MYSQLSERVER})
-
+IF(UNIX)
+ INSTALL_SYMLINK(libmysqld.a mysqlserver ${INSTALL_LIBDIR} ${COMPONENT_MYSQLSERVER})
+ENDIF()
INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/server/private COMPONENT ${COMPONENT_MYSQLSERVER})
@@ -430,12 +438,15 @@ IF(NOT DISABLE_SHARED)
# Name the shared library, handle versioning (provides same api as client
# library hence the same version)
SET_TARGET_PROPERTIES(libmysqld PROPERTIES
- OUTPUT_NAME mysqld
+ OUTPUT_NAME mariadbd
SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
+ INSTALL_SYMLINK(libmysqld.so libmysqld ${INSTALL_LIBDIR} ${COMPONENT_LIBMYSQLD})
# Clean direct output flags, as 2 targets have the same base name
# libmysqld
SET_TARGET_PROPERTIES(libmysqld PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+ TARGET_LINK_LIBRARIES(libmysqld ${CRC32_LIBRARY})
SET_TARGET_PROPERTIES(mysqlserver PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+ TARGET_LINK_LIBRARIES(mysqlserver ${CRC32_LIBRARY})
IF(LIBMYSQLD_SO_EXTRA_LIBS)
TARGET_LINK_LIBRARIES(libmysqld ${LIBMYSQLD_SO_EXTRA_LIBS})
ENDIF()
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index fead3a8b82b..603542e820e 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -13,7 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-#include "my_global.h" // HAVE_*
+#include "mariadb.h"
#include "sql_priv.h"
#ifdef HAVE_QUERY_CACHE
@@ -28,14 +28,14 @@ void Querycache_stream::store_uchar(uchar c)
if (data_end == cur_data)
use_next_block(TRUE);
*(cur_data++)= c;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
stored_size++;
#endif
}
void Querycache_stream::store_short(ushort s)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
stored_size+= 2;
#endif
if (data_end - cur_data > 1)
@@ -58,7 +58,7 @@ void Querycache_stream::store_short(ushort s)
void Querycache_stream::store_int(uint i)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
stored_size+= 4;
#endif
size_t rest_len= data_end - cur_data;
@@ -85,7 +85,7 @@ void Querycache_stream::store_int(uint i)
void Querycache_stream::store_ll(ulonglong ll)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
stored_size+= 8;
#endif
size_t rest_len= data_end - cur_data;
@@ -110,7 +110,7 @@ void Querycache_stream::store_ll(ulonglong ll)
void Querycache_stream::store_str_only(const char *str, uint str_len)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
stored_size+= str_len;
#endif
do
@@ -418,7 +418,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
if (!data)
goto err;
- init_alloc_root(&data->alloc, 8192,0,MYF(0));
+ init_alloc_root(&data->alloc, "embedded_query_cache", 8192,0,MYF(0));
f_alloc= &data->alloc;
data->fields= src->load_int();
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index fc60194d7f5..c4268752f9a 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -22,7 +22,7 @@ class Querycache_stream
Query_cache_block *block;
uint headers_len;
public:
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
Query_cache_block *first_block;
uint stored_size;
#endif
@@ -31,7 +31,7 @@ public:
{
cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
first_block= ini_block;
stored_size= 0;
#endif
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d6f77e68183..715f1dde5b5 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -55,6 +55,9 @@ extern "C" void unireg_clear(int exit_code)
DBUG_VOID_RETURN;
}
+
+static my_bool mysql_embedded_init= 0;
+
/*
Wrapper error handler for embedded server to call client/server error
handler based on whether thread is in client/server context
@@ -518,6 +521,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
const char *fake_groups[] = { "server", "embedded", 0 };
my_bool acl_error;
+ DBUG_ASSERT(mysql_embedded_init == 0);
+
if (my_thread_init())
return 1;
@@ -637,15 +642,20 @@ int init_embedded_server(int argc, char **argv, char **groups)
}
execute_ddl_log_recovery();
+ mysql_embedded_init= 1;
return 0;
}
void end_embedded_server()
{
- my_free(copy_arguments_ptr);
- copy_arguments_ptr=0;
- clean_up(0);
- clean_up_mutexes();
+ if (mysql_embedded_init)
+ {
+ my_free(copy_arguments_ptr);
+ copy_arguments_ptr=0;
+ clean_up(0);
+ clean_up_mutexes();
+ mysql_embedded_init= 0;
+ }
}
@@ -655,7 +665,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
thd->mysql= mysql;
mysql->server_version= server_version;
mysql->client_flag= client_flag;
- init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0));
+ init_alloc_root(&mysql->field_alloc, "fields", 8192, 0, MYF(0));
}
/**
@@ -692,8 +702,7 @@ void *create_embedded_thd(int client_flag)
thd->client_capabilities= client_flag;
thd->real_id= pthread_self();
- thd->db= NULL;
- thd->db_length= 0;
+ thd->db= null_clex_str;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->security_ctx->db_access= DB_ACLS;
thd->security_ctx->master_access= ~NO_ACCESS;
@@ -731,7 +740,7 @@ emb_transfer_connect_attrs(MYSQL *mysql)
ptr= buf= (uchar *) my_alloca(length + 9);
send_client_connect_attrs(mysql, buf);
net_field_length_ll(&ptr);
- PSI_THREAD_CALL(set_thread_connect_attrs)((char *) ptr, length, thd->charset());
+ PSI_CALL_set_thread_connect_attrs((char *) ptr, length, thd->charset());
my_afree(buf);
}
#endif
@@ -741,7 +750,7 @@ emb_transfer_connect_attrs(MYSQL *mysql)
int check_embedded_connection(MYSQL *mysql, const char *db)
{
int result;
- LEX_STRING db_str = { (char*)db, db ? strlen(db) : 0 };
+ LEX_CSTRING db_str = { db, safe_strlen(db) };
THD *thd= (THD*)mysql->thd;
/* the server does the same as the client */
@@ -972,7 +981,7 @@ int Protocol::begin_dataset()
return 1;
alloc= &data->alloc;
/* Assume rowlength < 8192 */
- init_alloc_root(alloc, 8192, 0, MYF(0));
+ init_alloc_root(alloc, "protocol", 8192, 0, MYF(0));
alloc->min_malloc= sizeof(MYSQL_ROWS);
return 0;
}
@@ -1035,7 +1044,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
while ((item= it++))
{
Send_field server_field;
- item->make_field(thd, &server_field);
+ item->make_send_field(thd, &server_field);
/* Keep things compatible for old clients */
if (server_field.type == MYSQL_TYPE_VARCHAR)
@@ -1045,12 +1054,14 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
strlen(server_field.db_name), cs, thd_cs);
client_field->table= dup_str_aux(field_alloc, server_field.table_name,
strlen(server_field.table_name), cs, thd_cs);
- client_field->name= dup_str_aux(field_alloc, server_field.col_name,
- strlen(server_field.col_name), cs, thd_cs);
+ client_field->name= dup_str_aux(field_alloc, server_field.col_name.str,
+ server_field.col_name.length, cs, thd_cs);
client_field->org_table= dup_str_aux(field_alloc, server_field.org_table_name,
strlen(server_field.org_table_name), cs, thd_cs);
- client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name,
- strlen(server_field.org_col_name), cs, thd_cs);
+ client_field->org_name= dup_str_aux(field_alloc,
+ server_field.org_col_name.str,
+ server_field.org_col_name.length,
+ cs, thd_cs);
if (item->charset_for_protocol() == &my_charset_bin || thd_cs == NULL)
{
/* No conversion */
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index 13f7f074d80..cb81c05f663 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -1533,8 +1533,9 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
- init_alloc_root(&stmt->mem_root, 2048,2048, MYF(MY_THREAD_SPECIFIC));
- init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->mem_root, "stmt", 2048,2048, MYF(MY_THREAD_SPECIFIC));
+ init_alloc_root(&stmt->result.alloc, "result", 4096, 4096,
+ MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@@ -1545,7 +1546,7 @@ mysql_stmt_init(MYSQL *mysql)
strmov(stmt->sqlstate, not_error_sqlstate);
/* The rest of statement members was bzeroed inside malloc */
- init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0,
+ init_alloc_root(&stmt->extension->fields_mem_root, "extension", 2048, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_RETURN(stmt);
@@ -3150,8 +3151,7 @@ static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
length data length
*/
-static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
- uint length)
+static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t length)
{
char *buffer= (char *)param->buffer;
int err= 0;
@@ -3263,7 +3263,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
param->length will always contain length of entire column;
number of copied bytes may be way different:
*/
- *param->length= length;
+ *param->length= (ulong)length;
break;
}
}
@@ -4375,7 +4375,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
MYSQL_FIELD *field;
uchar *null_ptr, bit;
uchar *row= (uchar*) data->data;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
uchar *row_end= row + data->length;
#endif