Skip to content

Commit e0401ce

Browse files
Benny.WangBenny.Wang
Benny.Wang
authored and
Benny.Wang
committed
WL#411: Generated columns
Merged with trunk.
1 parent b4f959e commit e0401ce

File tree

1,314 files changed

+32520
-42525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,314 files changed

+32520
-42525
lines changed

client/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ INCLUDE_DIRECTORIES(
2222
${CMAKE_SOURCE_DIR}/libmysql
2323
${CMAKE_SOURCE_DIR}/regex
2424
${CMAKE_SOURCE_DIR}/sql
25+
${CMAKE_SOURCE_DIR}/sql/auth
2526
${CMAKE_SOURCE_DIR}/strings
2627
${EDITLINE_INCLUDE_DIR}
2728
${CMAKE_CURRENT_BINARY_DIR}

client/auth_utils.h

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <iostream>
2121
#include <map>
2222

23+
#include <auth_acls.h>
24+
2325
#define ERR_FILE 1 // File related error
2426
#define ERR_ENCRYPTION 2 // Encryption related error
2527
#define ERR_SYNTAX 3 // Syntax and parsing related error
@@ -64,65 +66,65 @@ class Access_privilege
6466
Access_privilege() : m_priv(0) {}
6567
Access_privilege(uint64_t privileges) : m_priv(privileges) {}
6668
Access_privilege(const Access_privilege &priv) : m_priv(priv.m_priv) {}
67-
bool has_select_ac() { return (m_priv & (1L)) > 0; }
68-
bool has_insert_ac() { return (m_priv & (1L << 1)) > 0; }
69-
bool has_update_ac() { return (m_priv & (1L << 2)) > 0; }
70-
bool has_delete_ac() { return (m_priv & (1L << 3)) > 0; }
71-
bool has_create_ac() { return (m_priv & (1L << 4)) > 0; }
72-
bool has_drop_ac() { return (m_priv & (1L << 5)) > 0; }
73-
bool has_relead_ac() { return (m_priv & (1L << 6)) > 0; }
74-
bool has_shutdown_ac() { return (m_priv & (1L << 7)) > 0; }
75-
bool has_process_ac() { return (m_priv & (1L << 8)) > 0; }
76-
bool has_file_ac() { return (m_priv & (1L << 9)) > 0; }
77-
bool has_grant_ac() { return (m_priv & (1L << 10)) > 0; }
78-
bool has_references_ac() { return (m_priv & (1L << 11)) > 0; }
79-
bool has_index_ac() { return (m_priv & (1L << 12)) > 0; }
80-
bool has_alter_ac() { return (m_priv & (1L << 13)) > 0; }
81-
bool has_show_db_ac() { return (m_priv & (1L << 14)) > 0; }
82-
bool has_super_ac() { return (m_priv & (1L << 15)) > 0; }
83-
bool has_create_tmp_ac() { return (m_priv & (1L << 16)) > 0; }
84-
bool has_lock_tables_ac() { return (m_priv & (1L << 17)) > 0; }
85-
bool has_execute_ac() { return (m_priv & (1L << 18)) > 0; }
86-
bool has_repl_slave_ac() { return (m_priv & (1L << 19)) > 0; }
87-
bool has_repl_client_ac() { return (m_priv & (1L << 20)) > 0; }
88-
bool has_create_view_ac() { return (m_priv & (1L << 21)) > 0; }
89-
bool has_show_view_ac() { return (m_priv & (1L << 22)) > 0; }
90-
bool has_create_proc_ac() { return (m_priv & (1L << 23)) > 0; }
91-
bool has_alter_proc_ac() { return (m_priv & (1L << 24)) > 0; }
92-
bool has_create_user_ac() { return (m_priv & (1L << 25)) > 0; }
93-
bool has_event_ac() { return (m_priv & (1L << 26)) > 0; }
94-
bool has_trigger_ac() { return (m_priv & (1L << 27)) > 0; }
95-
bool has_create_tablespace_ac() { return (m_priv & (1L << 28)) > 0; }
96-
inline static uint64_t select_ac() { return (1L); }
97-
inline uint64_t insert_ac() { return (1L << 1); }
98-
inline uint64_t update_ac() { return (1L << 2); }
99-
inline uint64_t delete_ac() { return (1L << 3); }
100-
inline static uint64_t create_ac() { return (1L << 4); }
101-
inline static uint64_t drop_ac() { return (1L << 5); }
102-
inline static uint64_t relead_ac() { return (1L << 6); }
103-
inline static uint64_t shutdown_ac() { return (1L << 7); }
104-
inline static uint64_t process_ac() { return (1L << 8); }
105-
inline static uint64_t file_ac() { return (1L << 9); }
106-
inline static uint64_t grant_ac() { return (1L << 10); }
107-
inline static uint64_t references_ac() { return (1L << 11); }
108-
inline static uint64_t index_ac() { return (1L << 12); }
109-
inline static uint64_t alter_ac() { return (1L << 13); }
110-
inline static uint64_t show_db_ac() { return (1L << 14); }
111-
inline static uint64_t super_ac() { return (1L << 15); }
112-
inline static uint64_t create_tmp_ac() { return (1L << 16); }
113-
inline static uint64_t lock_tables_ac() { return (1L << 17); }
114-
inline static uint64_t execute_ac() { return (1L << 18); }
115-
inline static uint64_t repl_slave_ac() { return (1L << 19); }
116-
inline static uint64_t repl_client_ac() { return (1L << 20); }
117-
inline static uint64_t create_view_ac() { return (1L << 21); }
118-
inline static uint64_t show_view_ac() { return (1L << 22); }
119-
inline static uint64_t create_proc_ac() { return (1L << 23); }
120-
inline static uint64_t alter_proc_ac() { return (1L << 24); }
121-
inline static uint64_t create_user_ac() { return (1L << 25); }
122-
inline static uint64_t event_ac() { return (1L << 26); }
123-
inline static uint64_t trigger_ac() { return (1L << 27); }
124-
inline static uint64_t create_tablespace_ac() { return (1L << 28); }
125-
inline static uint64_t acl_all() { return 0xfffffff; }
69+
bool has_select_ac() { return (m_priv & SELECT_ACL) > 0; }
70+
bool has_insert_ac() { return (m_priv & INSERT_ACL) > 0; }
71+
bool has_update_ac() { return (m_priv & UPDATE_ACL) > 0; }
72+
bool has_delete_ac() { return (m_priv & DELETE_ACL) > 0; }
73+
bool has_create_ac() { return (m_priv & CREATE_ACL) > 0; }
74+
bool has_drop_ac() { return (m_priv & DROP_ACL) > 0; }
75+
bool has_relead_ac() { return (m_priv & RELOAD_ACL) > 0; }
76+
bool has_shutdown_ac() { return (m_priv & SHUTDOWN_ACL) > 0; }
77+
bool has_process_ac() { return (m_priv & PROCESS_ACL) > 0; }
78+
bool has_file_ac() { return (m_priv & FILE_ACL) > 0; }
79+
bool has_grant_ac() { return (m_priv & GRANT_ACL) > 0; }
80+
bool has_references_ac() { return (m_priv & REFERENCES_ACL) > 0; }
81+
bool has_index_ac() { return (m_priv & INDEX_ACL) > 0; }
82+
bool has_alter_ac() { return (m_priv & ALTER_ACL) > 0; }
83+
bool has_show_db_ac() { return (m_priv & SHOW_DB_ACL) > 0; }
84+
bool has_super_ac() { return (m_priv & SUPER_ACL) > 0; }
85+
bool has_create_tmp_ac() { return (m_priv & CREATE_TMP_ACL) > 0; }
86+
bool has_lock_tables_ac() { return (m_priv & LOCK_TABLES_ACL) > 0; }
87+
bool has_execute_ac() { return (m_priv & EXECUTE_ACL) > 0; }
88+
bool has_repl_slave_ac() { return (m_priv & REPL_SLAVE_ACL) > 0; }
89+
bool has_repl_client_ac() { return (m_priv & REPL_CLIENT_ACL) > 0; }
90+
bool has_create_view_ac() { return (m_priv & CREATE_VIEW_ACL) > 0; }
91+
bool has_show_view_ac() { return (m_priv & SHOW_VIEW_ACL) > 0; }
92+
bool has_create_proc_ac() { return (m_priv & CREATE_PROC_ACL) > 0; }
93+
bool has_alter_proc_ac() { return (m_priv & ALTER_PROC_ACL) > 0; }
94+
bool has_create_user_ac() { return (m_priv & CREATE_USER_ACL) > 0; }
95+
bool has_event_ac() { return (m_priv & EVENT_ACL) > 0; }
96+
bool has_trigger_ac() { return (m_priv & TRIGGER_ACL) > 0; }
97+
bool has_create_tablespace_ac() { return (m_priv & CREATE_TABLESPACE_ACL) > 0; }
98+
inline static uint64_t select_ac() { return SELECT_ACL; }
99+
inline uint64_t insert_ac() { return INSERT_ACL; }
100+
inline uint64_t update_ac() { return UPDATE_ACL; }
101+
inline uint64_t delete_ac() { return DELETE_ACL; }
102+
inline static uint64_t create_ac() { return CREATE_ACL; }
103+
inline static uint64_t drop_ac() { return DROP_ACL; }
104+
inline static uint64_t relead_ac() { return RELOAD_ACL; }
105+
inline static uint64_t shutdown_ac() { return SHUTDOWN_ACL; }
106+
inline static uint64_t process_ac() { return PROCESS_ACL; }
107+
inline static uint64_t file_ac() { return FILE_ACL; }
108+
inline static uint64_t grant_ac() { return GRANT_ACL; }
109+
inline static uint64_t references_ac() { return REFERENCES_ACL; }
110+
inline static uint64_t index_ac() { return INDEX_ACL; }
111+
inline static uint64_t alter_ac() { return ALTER_ACL; }
112+
inline static uint64_t show_db_ac() { return SHOW_DB_ACL; }
113+
inline static uint64_t super_ac() { return SUPER_ACL; }
114+
inline static uint64_t create_tmp_ac() { return CREATE_TMP_ACL; }
115+
inline static uint64_t lock_tables_ac() { return LOCK_TABLES_ACL; }
116+
inline static uint64_t execute_ac() { return EXECUTE_ACL; }
117+
inline static uint64_t repl_slave_ac() { return REPL_SLAVE_ACL; }
118+
inline static uint64_t repl_client_ac() { return REPL_CLIENT_ACL; }
119+
inline static uint64_t create_view_ac() { return CREATE_VIEW_ACL; }
120+
inline static uint64_t show_view_ac() { return SHOW_VIEW_ACL; }
121+
inline static uint64_t create_proc_ac() { return CREATE_PROC_ACL; }
122+
inline static uint64_t alter_proc_ac() { return ALTER_PROC_ACL; }
123+
inline static uint64_t create_user_ac() { return CREATE_USER_ACL; }
124+
inline static uint64_t event_ac() { return EVENT_ACL; }
125+
inline static uint64_t trigger_ac() { return TRIGGER_ACL; }
126+
inline static uint64_t create_tablespace_ac() { return CREATE_TABLESPACE_ACL; }
127+
inline static uint64_t acl_all() { return ~NO_ACCESS; }
126128
uint64_t to_int() const { return m_priv; };
127129
private:
128130
uint64_t m_priv;

client/base/help_options.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ void Mysql::Tools::Base::Options::Help_options::print_usage()
7474
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
7575
copyright.c_str(),
7676
this->m_program->get_description().c_str());
77+
/*
78+
Turn default for zombies off so that the help on how to
79+
turn them off text won't show up.
80+
This is safe to do since it's followed by a call to exit().
81+
*/
82+
for (struct my_option *optp= this->m_program->get_options_array();
83+
optp->name; optp++)
84+
{
85+
if (!strcmp(optp->name, "secure-auth"))
86+
{
87+
optp->def_value= 0;
88+
break;
89+
}
90+
}
7791
my_print_help(this->m_program->get_options_array());
7892
print_defaults("my", load_default_groups);
7993
my_print_variables(this->m_program->get_options_array());

client/base/mysql_connection_options.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,14 @@ void Mysql_connection_options::protocol_callback(
210210
void Mysql_connection_options::secure_auth_callback(
211211
char* not_used __attribute__((unused)))
212212
{
213-
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
214-
if (!this->m_secure_auth)
215-
{
216-
this->m_program->print_usage();
217-
exit(1);
213+
/* --secure-auth is a zombie option. */
214+
if (!this->m_secure_auth)
215+
{
216+
my_printf_error(0, "--skip-secure-auth is not supported.\n", MYF(0));
217+
exit(1);
218218
}
219+
else
220+
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
219221
}
220222

221223

client/check/mysqlcheck.cc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,19 @@ static void usage(void)
247247
my_progname);
248248
printf("OR %s [OPTIONS] --all-databases\n", my_progname);
249249
print_defaults("my", load_default_groups);
250+
/*
251+
Turn default for zombies off so that the help on how to
252+
turn them off text won't show up.
253+
This is safe to do since it's followed by a call to exit().
254+
*/
255+
for (struct my_option *optp= my_long_options; optp->name; optp++)
256+
{
257+
if (optp->id == OPT_SECURE_AUTH)
258+
{
259+
optp->def_value= 0;
260+
break;
261+
}
262+
}
250263
my_print_help(my_long_options);
251264
my_print_variables(my_long_options);
252265
} /* usage */
@@ -333,12 +346,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
333346
opt->name);
334347
break;
335348
case OPT_SECURE_AUTH:
336-
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
349+
/* --secure-auth is a zombie option. */
337350
if (!opt_secure_auth)
338351
{
339-
usage();
352+
fprintf(stderr, "mysql: [ERROR] --skip-secure-auth is not supported.\n");
340353
exit(1);
341354
}
355+
else
356+
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
342357
break;
343358
}
344359

client/mysql.cc

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ int main(int argc,char *argv[])
12761276
my_end(0);
12771277
exit(1);
12781278
}
1279-
glob_buffer.realloc(512);
1279+
glob_buffer.mem_realloc(512);
12801280
completion_hash_init(&ht, 128);
12811281
init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_mem_root, 16384, 0);
12821282
memset(&mysql, 0, sizeof(mysql));
@@ -1439,9 +1439,9 @@ void mysql_end(int sig)
14391439

14401440
if (sig >= 0)
14411441
put_info(sig ? "Aborted" : "Bye", INFO_RESULT);
1442-
glob_buffer.free();
1443-
old_buffer.free();
1444-
processed_prompt.free();
1442+
glob_buffer.mem_free();
1443+
old_buffer.mem_free();
1444+
processed_prompt.mem_free();
14451445
my_free(server_version);
14461446
my_free(opt_password);
14471447
my_free(opt_mysql_unix_port);
@@ -1858,6 +1858,19 @@ static void usage(int version)
18581858
return;
18591859
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
18601860
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
1861+
/*
1862+
Turn default for zombies off so that the help on how to
1863+
turn them off text won't show up.
1864+
This is safe to do since it's followed by a call to exit().
1865+
*/
1866+
for (struct my_option *optp= my_long_options; optp->name; optp++)
1867+
{
1868+
if (optp->id == OPT_SECURE_AUTH)
1869+
{
1870+
optp->def_value= 0;
1871+
break;
1872+
}
1873+
}
18611874
my_print_help(my_long_options);
18621875
print_defaults("my", load_default_groups);
18631876
my_print_variables(my_long_options);
@@ -1934,12 +1947,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
19341947
#endif
19351948
break;
19361949
case OPT_SECURE_AUTH:
1937-
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
1950+
/* --secure-auth is a zombie option. */
19381951
if (!opt_secure_auth)
19391952
{
1940-
usage(0);
1953+
fprintf(stderr, "mysql: [ERROR] --skip-secure-auth is not supported.\n");
19411954
exit(1);
19421955
}
1956+
else
1957+
CLIENT_WARN_DEPRECATED_NO_REPLACEMENT("--secure-auth");
19431958
break;
19441959
case OPT_SERVER_ARG:
19451960
#ifdef EMBEDDED_LIBRARY
@@ -2301,8 +2316,8 @@ static int read_and_execute(bool interactive)
23012316
}
23022317

23032318
#if defined(_WIN32)
2304-
buffer.free();
2305-
tmpbuf.free();
2319+
buffer.mem_free();
2320+
tmpbuf.mem_free();
23062321
#else
23072322
if (interactive)
23082323
/*
@@ -2706,7 +2721,7 @@ static bool add_line(String &buffer, char *line, size_t line_length,
27062721
length++;
27072722
}
27082723
if (buffer.length() + length >= buffer.alloced_length())
2709-
buffer.realloc(buffer.length()+length+IO_SIZE);
2724+
buffer.mem_realloc(buffer.length()+length+IO_SIZE);
27102725
if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
27112726
DBUG_RETURN(1);
27122727
}
@@ -5497,7 +5512,7 @@ static void mysql_end_timer(ulong start_time,char *buff)
54975512

54985513
static const char* construct_prompt()
54995514
{
5500-
processed_prompt.free(); // Erase the old prompt
5515+
processed_prompt.mem_free(); // Erase the old prompt
55015516
time_t lclock = time(NULL); // Get the date struct
55025517
struct tm *t = localtime(&lclock);
55035518

0 commit comments

Comments
 (0)