summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2005-02-23 19:40:31 +0100
committerunknown <mats@mysql.com>2005-02-23 19:40:31 +0100
commit6a0e1def63b56f0c4c4c5873e70146c731189478 (patch)
tree29b59f02afbf433865e6e94649d1e0a8653f143a /sql
parent8a8d476453437b27df0bc7ff63d138c743df11f1 (diff)
parent41a329f9a190c05767332b816496c52ee40b3ab9 (diff)
downloadmariadb-git-6a0e1def63b56f0c4c4c5873e70146c731189478.tar.gz
Merge mysql.com:/home/bkroot/mysql-4.0
into mysql.com:/home/bk/b8412-mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/sql_delete.cc1
-rw-r--r--sql/sql_parse.cc23
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/sql_yacc.yy4
5 files changed, 21 insertions, 14 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 1a870ce3abf..81a803e36b9 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -424,7 +424,7 @@ innobase_mysql_tmpfile(void)
{
char filename[FN_REFLEN];
int fd2 = -1;
- File fd = create_temp_file(filename, NullS, "ib",
+ File fd = create_temp_file(filename, mysql_tmpdir, "ib",
#ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL |
O_TEMPORARY | O_SHORT_LIVED |
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 92193e3abf2..475df34dc4f 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -111,6 +111,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
bzero((char*) &tables,sizeof(tables));
tables.table = table;
+ tables.alias = table_list->alias;
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index cd0abafc0c9..613484ebf50 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -504,8 +504,6 @@ check_connections(THD *thd)
DBUG_PRINT("info",("New connection received on %s",
vio_description(net->vio)));
- vio_in_addr(net->vio,&thd->remote.sin_addr);
-
if (!thd->host) // If TCP/IP connection
{
char ip[30];
@@ -515,6 +513,7 @@ check_connections(THD *thd)
if (!(thd->ip = my_strdup(ip,MYF(0))))
return (ER_OUT_OF_RESOURCES);
thd->host_or_ip=thd->ip;
+ vio_in_addr(net->vio, &thd->remote.sin_addr);
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
/* Fast local hostname resolve for Win32 */
if (!strcmp(thd->ip,"127.0.0.1"))
@@ -524,17 +523,19 @@ check_connections(THD *thd)
}
else
#endif
- if (!(specialflag & SPECIAL_NO_RESOLVE))
{
- thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
- /* Cut very long hostnames to avoid possible overflows */
- if (thd->host)
+ if (!(specialflag & SPECIAL_NO_RESOLVE))
{
- thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
- thd->host_or_ip= thd->host;
+ thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
+ /* Cut very long hostnames to avoid possible overflows */
+ if (thd->host)
+ {
+ thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
+ thd->host_or_ip= thd->host;
+ }
+ if (connect_errors > max_connect_errors)
+ return(ER_HOST_IS_BLOCKED);
}
- if (connect_errors > max_connect_errors)
- return(ER_HOST_IS_BLOCKED);
}
DBUG_PRINT("info",("Host: %s ip: %s",
thd->host ? thd->host : "unknown host",
@@ -547,6 +548,8 @@ check_connections(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host;
thd->ip= 0;
+ /* Reset sin_addr */
+ bzero((char*) &thd->remote, sizeof(thd->remote));
}
vio_keepalive(net->vio, TRUE);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index b1b30a29639..b2b10a9b59a 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -473,7 +473,10 @@ int mysql_multi_update_lock(THD *thd,
else
{
DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias));
- tl->lock_type= TL_READ;
+ // If we are using the binary log, we need TL_READ_NO_INSERT to get
+ // correct order of statements. Otherwise, we use a TL_READ lock to
+ // improve performance.
+ tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ;
tl->updating= 0;
wants= SELECT_ACL;
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6d0237f5615..39b57061507 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -822,7 +822,7 @@ create_select:
SELECT_SYM
{
LEX *lex=Lex;
- lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
+ lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ;
if (lex->sql_command == SQLCOM_INSERT)
lex->sql_command= SQLCOM_INSERT_SELECT;
else if (lex->sql_command == SQLCOM_REPLACE)
@@ -1532,7 +1532,7 @@ select_part2:
{
LEX *lex=Lex;
lex->lock_option=TL_READ;
- mysql_init_select(lex);
+ mysql_init_select(lex);
}
select_options select_item_list select_into select_lock_type;