From 5535fa96fbbee28558bb2fccbc8eecf4872b37ff Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Dec 2004 12:47:20 +0200 Subject: Ensure that we free memory used with --order-by-primary (in mysqldump) Simple, non critical, fix to mysql_fix_privilege_tables client/mysqldump.c: Ensure that we free memory used with --order-by-primary mysql-test/t/system_mysql_db_fix.test: Remove warnings when compiled with support for ISAM scripts/mysql_fix_privilege_tables.sh: Ensure that 'my_print_defaults' is called correctly sql/set_var.cc: Code style cleanups sql/sql_db.cc: Fixed comments sql/udf_example.cc: Fixed comments --- sql/set_var.cc | 14 +++++--------- sql/sql_db.cc | 28 +++++++++++++++------------- sql/udf_example.cc | 13 ++++++++----- 3 files changed, 28 insertions(+), 27 deletions(-) (limited to 'sql') diff --git a/sql/set_var.cc b/sql/set_var.cc index 79be4dc1c46..35a2c264f28 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -359,22 +359,18 @@ sys_var_thd_bool sys_innodb_table_locks("innodb_table_locks", sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment", &srv_auto_extend_increment); #endif + #ifdef HAVE_NDBCLUSTER_DB -// ndb thread specific variable settings +/* ndb thread specific variable settings */ sys_var_thd_ulong sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz", &SV::ndb_autoincrement_prefetch_sz); sys_var_thd_bool -sys_ndb_force_send("ndb_force_send", - &SV::ndb_force_send); +sys_ndb_force_send("ndb_force_send", &SV::ndb_force_send); sys_var_thd_bool -sys_ndb_use_exact_count("ndb_use_exact_count", - &SV::ndb_use_exact_count); +sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count); sys_var_thd_bool -sys_ndb_use_transactions("ndb_use_transactions", - &SV::ndb_use_transactions); -// ndb server global variable settings -// none +sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions); #endif /* Time/date/datetime formats */ diff --git a/sql/sql_db.cc b/sql/sql_db.cc index e3ca0328382..00dff1d713b 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -390,7 +390,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); - // do not create database if another thread is holding read lock + /* do not create database if another thread is holding read lock */ if (wait_if_global_read_lock(thd, 0, 1)) { error= -1; @@ -514,7 +514,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); - // do not alter database if another thread is holding read lock + /* do not alter database if another thread is holding read lock */ if ((error=wait_if_global_read_lock(thd,0,1))) goto exit2; @@ -542,9 +542,11 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) Query_log_event qinfo(thd, thd->query, thd->query_length, 0, /* suppress_use */ TRUE); - // Write should use the database being created as the "current - // database" and not the threads current database, which is the - // default. + /* + Write should use the database being created as the "current + database" and not the threads current database, which is the + default. + */ qinfo.db = db; qinfo.db_len = strlen(db); @@ -577,7 +579,6 @@ exit2: -1 Error generated */ - int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { long deleted=0; @@ -589,7 +590,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); - // do not drop database if another thread is holding read lock + /* do not drop database if another thread is holding read lock */ if (wait_if_global_read_lock(thd, 0, 1)) { error= -1; @@ -657,10 +658,11 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { Query_log_event qinfo(thd, query, query_length, 0, /* suppress_use */ TRUE); - - // Write should use the database being created as the "current - // database" and not the threads current database, which is the - // default. + /* + Write should use the database being created as the "current + database" and not the threads current database, which is the + default. + */ qinfo.db = db; qinfo.db_len = strlen(db); @@ -774,7 +776,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, found_other_files++; continue; } - // just for safety we use files_charset_info + /* just for safety we use files_charset_info */ if (db && !my_strcasecmp(files_charset_info, extension, reg_ext)) { @@ -909,7 +911,7 @@ bool mysql_change_db(THD *thd, const char *name) if (!dbname || !(db_length= strlen(dbname))) { x_free(dbname); /* purecov: inspected */ - send_error(thd,ER_NO_DB_ERROR); /* purecov: inspected */ + send_error(thd,ER_NO_DB_ERROR); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } if (check_db_name(dbname)) diff --git a/sql/udf_example.cc b/sql/udf_example.cc index 7e2ee9113b2..50de0f187fe 100644 --- a/sql/udf_example.cc +++ b/sql/udf_example.cc @@ -615,10 +615,12 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return 1; } bzero(initid->ptr,sizeof(longlong)); - // Fool MySQL to think that this function is a constant - // This will ensure that MySQL only evalutes the function - // when the rows are sent to the client and not before any ORDER BY - // clauses + /* + Fool MySQL to think that this function is a constant + This will ensure that MySQL only evalutes the function + when the rows are sent to the client and not before any ORDER BY + clauses + */ initid->const_item=1; return 0; } @@ -635,9 +637,10 @@ longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null, ulonglong val=0; if (args->arg_count) val= *((longlong*) args->args[0]); - return ++ *((longlong*) initid->ptr) + val; + return ++*((longlong*) initid->ptr) + val; } + /**************************************************************************** ** Some functions that handles IP and hostname conversions ** The orignal function was from Zeev Suraski. -- cgit v1.2.1