cleanup: remove #ifdef MYSQL_VERSION_ID

remove conditional compilation for old MariaDB versions.
Some were as old as MYSQL_VERSION_ID > 32300

Didn't touch engines hosted externally, like connect, mroonga,
and columnstore
This commit is contained in:
Sergei Golubchik 2025-10-15 19:22:18 +02:00
parent c64421c1ef
commit b78d6fa274
10 changed files with 18 additions and 132 deletions

View File

@ -285,9 +285,7 @@ get_one_option(const struct my_option *opt, const char *argument,
opt_verbose= 0;
break;
case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300
charsets_dir = argument;
#endif
break;
case OPT_MYSQL_PROTOCOL:
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
@ -1309,9 +1307,9 @@ static void usage(void)
my_print_help(my_long_options);
my_print_variables(my_long_options);
puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
create databasename Create a new database\n\
debug Instruct server to write debug information to log\n\
drop databasename Delete a database and all its tables\n\
create databasename Create a new database\n\
debug Instruct server to write debug information to log\n\
drop databasename Delete a database and all its tables\n\
extended-status Gives an extended status message from the server\n\
flush-all-statistics Flush all statistics tables\n\
flush-all-status Flush status and statistics\n\
@ -1333,25 +1331,21 @@ static void usage(void)
flush-threads Flush the thread cache\n\
flush-user-statistics Flush user statistics\n\
flush-user-resources Flush user resources\n\
kill id,id,... Kill mysql threads");
#if MYSQL_VERSION_ID >= 32200
puts("\
kill id,id,... Kill mysql threads\n\
password [new-password] Change old password to new-password in current format\n\
old-password [new-password] Change old password to new-password in old format");
#endif
puts("\
ping Check if mysqld is alive\n\
processlist Show list of active threads in server\n\
reload Reload grant tables\n\
refresh Flush all tables and close and open logfiles\n\
shutdown Take server down\n\
status Gives a short status message from the server\n\
start-all-slaves Start all slaves\n\
start-slave Start slave\n\
stop-all-slaves Stop all slaves\n\
stop-slave Stop slave\n\
old-password [new-password] Change old password to new-password in old format\n\
ping Check if mysqld is alive\n\
processlist Show list of active threads in server\n\
reload Reload grant tables\n\
refresh Flush all tables and close and open logfiles\n\
shutdown Take server down\n\
status Gives a short status message from the server\n\
start-all-slaves Start all slaves\n\
start-slave Start slave\n\
stop-all-slaves Stop all slaves\n\
stop-slave Stop slave\n\
variables Prints variables available\n\
version Get version info from server");
version Get version info from server");
}

View File

@ -2181,11 +2181,9 @@ static void unescape(FILE *file,char *pos, size_t length)
static my_bool test_if_special_chars(const char *str)
{
#if MYSQL_VERSION_ID >= 32300
for ( ; *str ; str++)
if (!my_isvar(charset_info,*str) && *str != '$')
return 1;
#endif
return 0;
} /* test_if_special_chars */

View File

@ -9053,7 +9053,6 @@ end:
var_set_errno(mysql_stmt_errno(stmt));
display_optimizer_trace(cn, ds);
#if MYSQL_VERSION_ID >= 50000
if (cursor_protocol_enabled)
{
ulong type= CURSOR_TYPE_NO_CURSOR;
@ -9061,7 +9060,6 @@ end:
die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
}
#endif
revert_properties();
@ -9278,7 +9276,6 @@ void run_execute_stmt(struct st_connection *cn, struct st_command *command,
init_dynamic_string(&ds_execute_warnings, NULL, 0, 256);
}
#if MYSQL_VERSION_ID >= 50000
if (cursor_protocol_enabled)
{
/*
@ -9289,7 +9286,6 @@ void run_execute_stmt(struct st_connection *cn, struct st_command *command,
die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
}
#endif
/*
Execute the query

View File

@ -211,7 +211,7 @@ static void init_ibd_data(ds_local_file_t *local_file, const uchar *buf, size_t
? fil_space_t::is_compressed(flags)
: bool(FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
#if defined(_WIN32) && (MYSQL_VERSION_ID > 100200)
#if defined(_WIN32)
/* Make compressed file sparse, on Windows.
In 10.1, we do not use sparse files. */
if (local_file->compressed) {

View File

@ -288,11 +288,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
thd->system_thread = static_cast<enum_thread_type>(1<<30UL);
memset(&thd->net, 0, sizeof(thd->net));
if (for_write_flag) {
#if MYSQL_VERSION_ID >= 50505
thd->variables.option_bits |= OPTION_BIN_LOG;
#else
thd->options |= OPTION_BIN_LOG;
#endif
safeFree((char*) thd->db.str);
thd->db.str= my_strdup(PSI_NOT_INSTRUMENTED, "handlersocket", MYF(0));
thd->db.length= sizeof("handlersocket")-1;
@ -382,13 +378,7 @@ dbcontext::lock_tables_if()
}
table_vec[i].modified = false;
}
#if MYSQL_VERSION_ID >= 50505
lock = thd->lock = mysql_lock_tables(thd, &tables[0], num_open, 0);
#else
bool need_reopen= false;
lock = thd->lock = mysql_lock_tables(thd, &tables[0], num_open,
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN, &need_reopen);
#endif
statistic_increment(lock_tables_count, &LOCK_status);
thd_proc_info(thd, &info_message_buf[0]);
DENA_VERBOSE(100, fprintf(stderr, "HNDSOCK lock tables %p %p %zu %zu\n",
@ -399,11 +389,7 @@ dbcontext::lock_tables_if()
thd));
}
if (for_write_flag) {
#if MYSQL_VERSION_ID >= 50505
thd->set_current_stmt_binlog_format_row();
#else
thd->current_stmt_binlog_row_based = 1;
#endif
}
DENA_ALLOCA_FREE(tables);
}
@ -426,11 +412,7 @@ dbcontext::unlock_tables_if()
}
{
bool suc = true;
#if MYSQL_VERSION_ID >= 50505
suc = (trans_commit_stmt(thd) == 0);
#else
suc = (ha_autocommit_or_rollback(thd, 0) == 0);
#endif
if (!suc) {
commit_error = true;
DENA_VERBOSE(10, fprintf(stderr,
@ -996,7 +978,6 @@ dbcontext::cmd_open(dbcallback_i& cb, const cmd_open_args& arg)
TABLE *table = 0;
bool refresh = true;
const thr_lock_type lock_type = for_write_flag ? TL_WRITE : TL_READ;
#if MYSQL_VERSION_ID >= 50505
LEX_CSTRING db_name= { arg.dbn, strlen(arg.dbn) };
LEX_CSTRING tbl_name= { arg.tbl, strlen(arg.tbl) };
tables.init_one_table(&db_name, &tbl_name, 0, lock_type);
@ -1006,11 +987,6 @@ dbcontext::cmd_open(dbcallback_i& cb, const cmd_open_args& arg)
if (!open_table(thd, &tables, &ot_act)) {
table = tables.table;
}
#else
tables.init_one_table(arg.dbn, arg.tbl, lock_type);
table = open_table(thd, &tables, thd->mem_root, &refresh,
OPEN_VIEW_NO_PARSE);
#endif
if (table == 0) {
DENA_VERBOSE(20, fprintf(stderr,
"HNDSOCK failed to open %p [%s] [%s] [%d]\n",

View File

@ -22,7 +22,6 @@
#include <my_global.h>
#include <mysql_version.h>
#if MYSQL_VERSION_ID >= 50505
#include <my_pthread.h>
#include <sql_priv.h>
#include "sql_class.h"
@ -44,10 +43,6 @@
#define current_stmt_binlog_row_based is_current_stmt_binlog_format_row
#define clear_current_stmt_binlog_row_based clear_current_stmt_binlog_format_row
#else
#include "mysql_priv.h"
#endif
#undef min
#undef max

View File

@ -52,13 +52,8 @@ class ha_oqgraph: public handler
int fill_record(byte*, const open_query::row&);
public:
#if MYSQL_VERSION_ID >= 50100
ha_oqgraph(handlerton *hton, TABLE_SHARE *table);
ulonglong table_flags() const override;
#else
ha_oqgraph(TABLE *table);
Table_flags table_flags() const;
#endif
virtual ~ha_oqgraph();
const char *index_type(uint inx) override
{
@ -111,11 +106,6 @@ public:
void fprint_error(const char* fmt, ...);
#if MYSQL_VERSION_ID < 100000
// Allow compatibility for build with 5.5.32
virtual const char *table_type() const { return hton_name(ht)->str; }
#endif
my_bool register_query_cache_table(THD *thd, const char *table_key,
uint key_length,
qc_engine_callback

View File

@ -34,11 +34,6 @@
#include "field.h"
#include "key.h"
#if MYSQL_VERSION_ID < 100000
// Allow compatibility with build for 5.5.32
#define user_defined_key_parts key_parts
#endif
static int debugid = 0;
oqgraph3::vertex_id oqgraph3::edge_info::origid() const

View File

@ -2,19 +2,9 @@
// $Id: ha_sphinx.h 4818 2014-09-24 08:53:38Z tomat $
//
#if MYSQL_VERSION_ID>=50515
#define TABLE_ARG TABLE_SHARE
#elif MYSQL_VERSION_ID>50100
#define TABLE_ARG st_table_share
#else
#define TABLE_ARG st_table
#endif
#if MYSQL_VERSION_ID>=50120
typedef uchar byte;
#endif
/// forward decls
class THD;
@ -43,22 +33,14 @@ protected:
bool m_bUnpackError; ///< any errors while unpacking response
public:
#if MYSQL_VERSION_ID<50100
ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
#else
ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
#endif
~ha_sphinx ();
const char * table_type () const override { return "SPHINX"; } ///< SE name for display purposes
const char * index_type ( uint ) override { return "HASH"; } ///< index type name for display purposes
#if MYSQL_VERSION_ID>50100
ulonglong table_flags () const override { return HA_CAN_INDEX_BLOBS |
HA_CAN_TABLE_CONDITION_PUSHDOWN; } ///< bitmap of implemented flags (see handler.h for more info)
#else
ulong table_flags () const { return HA_CAN_INDEX_BLOBS; } ///< bitmap of implemented flags (see handler.h for more info)
#endif
ulong index_flags ( uint, uint, bool ) const override { return 0; } ///< bitmap of flags that says how SE implements indexes
uint max_supported_record_length () const override { return HA_MAX_REC_LENGTH; }
@ -117,14 +99,8 @@ public:
int rnd_end () override;
int rnd_next ( byte * buf ) override;
int rnd_pos ( byte * buf, byte * pos ) override;
void position ( const byte * record ) override;
#if MYSQL_VERSION_ID>=50030
void position ( const byte * record ) override;
int info ( uint ) override;
#else
void info ( uint );
#endif
int reset() override;
int external_lock ( THD * thd, int lock_type ) override;
int delete_all_rows () override;
@ -137,11 +113,7 @@ public:
THR_LOCK_DATA ** store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type ) override;
public:
#if MYSQL_VERSION_ID<50610
virtual const COND * cond_push ( const COND *cond );
#else
const Item * cond_push ( const Item *cond ) override;
#endif
void cond_pop () override;
private:
@ -168,11 +140,6 @@ private:
CSphSEThreadTable * GetTls ();
};
#if MYSQL_VERSION_ID < 50100
bool sphinx_show_status ( THD * thd );
#endif
//
// $Id: ha_sphinx.h 4818 2014-09-24 08:53:38Z tomat $
//

View File

@ -26,22 +26,13 @@
#include <mysql_version.h>
#if MYSQL_VERSION_ID>=50515
#include "sql_class.h"
#include "sql_array.h"
#elif MYSQL_VERSION_ID>50100
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "../mysql_priv.h"
#endif
#include <mysys_err.h>
#include <my_sys.h>
#if MYSQL_VERSION_ID>=50120
typedef uchar byte;
#endif
/// partially copy-pasted stuff that should be moved elsewhere
@ -389,7 +380,6 @@ int CSphUrl::Connect()
int tmp_errno;
bool bError = false;
#if MYSQL_VERSION_ID>=50515
struct addrinfo *hp = NULL;
tmp_errno = getaddrinfo ( m_sHost, NULL, NULL, &hp );
if ( !tmp_errno || !hp || !hp->ai_addr )
@ -398,16 +388,6 @@ int CSphUrl::Connect()
if ( hp )
freeaddrinfo ( hp );
}
#else
struct hostent tmp_hostent, *hp;
char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
hp = my_gethostbyname_r ( m_sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
if ( !hp )
{
my_gethostbyname_r_free();
bError = true;
}
#endif
if ( bError )
{
@ -418,13 +398,8 @@ int CSphUrl::Connect()
return -1;
}
#if MYSQL_VERSION_ID>=50515
memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
freeaddrinfo ( hp );
#else
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
my_gethostbyname_r_free();
#endif
}
} else
{