summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc9
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_load.cc2
-rw-r--r--sql/sql_parse.cc13
-rw-r--r--sql/sql_yacc.yy12
-rw-r--r--sql/unireg.cc4
-rw-r--r--sql/unireg.h5
10 files changed, 45 insertions, 16 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index e2657e5cad7..4cf06dfb731 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -987,7 +987,10 @@ ha_innobase::open(
/* Get pointer to a table object in InnoDB dictionary cache */
- if (NULL == (ib_table = dict_table_get(norm_name, NULL))) {
+ ib_table = dict_table_get_and_increment_handle_count(
+ norm_name, NULL);
+
+ if (NULL == ib_table) {
sql_print_error("InnoDB error:\n\
Cannot find table %s from the internal data dictionary\n\
@@ -2831,7 +2834,9 @@ innobase_drop_database(
memcpy(namebuf, ptr, len);
namebuf[len] = '/';
namebuf[len + 1] = '\0';
-
+#ifdef __WIN__
+ casedn_str(namebuf);
+#endif
trx = trx_allocate_for_mysql();
error = row_drop_database_for_mysql(namebuf, trx);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 03ec5ad9381..924f85b0a89 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -583,6 +583,7 @@ extern pthread_cond_t COND_refresh,COND_thread_count;
extern pthread_attr_t connection_attrib;
extern bool opt_endinfo, using_udf_functions, locked_in_memory,
opt_using_transactions, use_temp_pool, mysql_embedded;
+extern bool opt_local_infile;
extern char f_fyllchar;
extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
ha_read_key_count, ha_read_next_count, ha_read_prev_count,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b5789dd0ff8..187a4732aa0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -297,6 +297,7 @@ ulong bytes_sent = 0L, bytes_received = 0L;
bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory;
bool opt_using_transactions, using_update_log, opt_warnings=0;
+bool opt_local_infile=1;
bool volatile abort_loop,select_thread_in_use,grant_option;
bool volatile ready_to_exit,shutdown_in_progress;
ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */
@@ -708,8 +709,9 @@ static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
static sig_handler print_signal_warning(int sig)
{
- sql_print_error("Warning: Got signal %d from thread %d",
- sig,my_thread_id());
+ if (opt_warnings)
+ sql_print_error("Warning: Got signal %d from thread %d",
+ sig,my_thread_id());
#ifdef DONT_REMEMBER_SIGNAL
sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
@@ -2686,7 +2688,7 @@ enum options {
OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE,
OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE,
OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE,
- OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE
+ OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE
};
static struct option long_options[] = {
@@ -2748,6 +2750,7 @@ static struct option long_options[] = {
{"init-file", required_argument, 0, (int) OPT_INIT_FILE},
{"log", optional_argument, 0, 'l'},
{"language", required_argument, 0, 'L'},
+ {"local-infile", optional_argument, 0, (int) OPT_LOCAL_INFILE},
{"log-bin", optional_argument, 0, (int) OPT_BIN_LOG},
{"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX},
{"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG},
@@ -3615,6 +3618,9 @@ static void get_options(int argc,char **argv)
case 'P':
mysql_port= (unsigned int) atoi(optarg);
break;
+ case OPT_LOCAL_INFILE:
+ opt_local_infile= test(!optarg || atoi(optarg) != 0);
+ break;
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(optarg);
break;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index d61e47d0883..a3497d23ee5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -768,6 +768,7 @@ int yylex(void *arg)
return(TEXT_STRING);
case STATE_COMMENT: // Comment
+ lex->options|= OPTION_FOUND_COMMENT;
while ((c = yyGet()) != '\n' && c) ;
yyUnget(); // Safety against eof
state = STATE_START; // Try again
@@ -779,6 +780,7 @@ int yylex(void *arg)
break;
}
yySkip(); // Skip '*'
+ lex->options|= OPTION_FOUND_COMMENT;
if (yyPeek() == '!') // MySQL command in comment
{
ulong version=MYSQL_VERSION_ID;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 6a966336ad7..c0ede015eb8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -57,6 +57,7 @@ enum enum_sql_command {
SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ,
SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_MULTI_UPDATE,
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
+ SQLCOM_EMPTY_QUERY,
SQLCOM_END
};
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 899f2e20469..419e3fccabd 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -145,7 +145,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (read_file_from_client && handle_duplicates == DUP_ERROR)
handle_duplicates=DUP_IGNORE;
- if (read_file_from_client && (thd->client_capabilities & CLIENT_LOCAL_FILES))
+ if (read_file_from_client)
{
(void)net_request_file(&thd->net,ex->file_name);
file = -1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 01327363c59..7f9c8da05c1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1312,6 +1312,10 @@ mysql_execute_command(void)
res=mysql_do(thd, *lex->insert_list);
break;
+ case SQLCOM_EMPTY_QUERY:
+ send_ok(&thd->net);
+ break;
+
case SQLCOM_PURGE:
{
if (check_process_priv(thd))
@@ -2094,13 +2098,20 @@ mysql_execute_command(void)
{
uint privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | UPDATE_ACL | DELETE_ACL : INSERT_ACL);
- if (!(lex->local_file && (thd->client_capabilities & CLIENT_LOCAL_FILES)))
+
+ if (!lex->local_file)
{
if (check_access(thd,privilege | FILE_ACL,tables->db))
goto error;
}
else
{
+ if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) ||
+ ! opt_local_infile)
+ {
+ send_error(&thd->net,ER_NOT_ALLOWED_COMMAND);
+ goto error;
+ }
if (check_access(thd,privilege,tables->db,&tables->grant.privilege) ||
grant_option && check_grant(thd,privilege,tables))
goto error;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 91cf0ae5fc9..c3db58ce20b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -596,9 +596,17 @@ END_OF_INPUT
query:
END_OF_INPUT
{
- if (!current_thd->bootstrap)
+ THD *thd=current_thd;
+ if (!thd->bootstrap &&
+ (!(thd->lex.options & OPTION_FOUND_COMMENT)))
+ {
send_error(&current_thd->net,ER_EMPTY_QUERY);
- YYABORT;
+ YYABORT;
+ }
+ else
+ {
+ thd->lex.sql_command = SQLCOM_EMPTY_QUERY;
+ }
}
| verb_clause END_OF_INPUT {}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 8c72dfc2855..16ba8c7d58b 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -486,11 +486,11 @@ static bool pack_fields(File file,List<create_field> &create_fields)
if (field->interval_id > int_count)
{
int_count=field->interval_id;
- tmp.append('\377');
+ tmp.append(NAMES_SEP_CHAR);
for (const char **pos=field->interval->type_names ; *pos ; pos++)
{
tmp.append(*pos);
- tmp.append('\377');
+ tmp.append(NAMES_SEP_CHAR);
}
tmp.append('\0'); // End of intervall
}
diff --git a/sql/unireg.h b/sql/unireg.h
index 9b220f87918..c4d2052d1da 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -70,11 +70,6 @@
#define FERR -1 /* Error from my_functions */
#define CREATE_MODE 0 /* Default mode on new files */
#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
-#ifdef MSDOS
-#define EXTRA_FIELD_CHAR (char) '\234' /* Interchangebly with '#' */
-#else
-#define EXTRA_FIELD_CHAR '#' /* Interchangebly with '#' */
-#endif
#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */