Commit 6d69e120 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0

parents 7fb87140 fc52abc5
......@@ -29135,16 +29135,16 @@ types the precision and scale can be (and usually is) specified; for
example:
@example
salary DECIMAL(9,2)
salary DECIMAL(5,2)
@end example
In this example, @code{9} (@code{precision}) represents the number of
In this example, @code{5} (@code{precision}) represents the number of
significant decimal digits that will be stored for values, and @code{2}
(@code{scale}) represents the number of digits that will be stored
following the decimal point. In this case, therefore, the range of
values that can be stored in the @code{salary} column is from
@code{-9999999.99} to @code{9999999.99}.
(MySQL can actually store numbers up to @code{9999999.99} in this column
@code{-99.99} to @code{99.99}.
(MySQL can actually store numbers up to @code{999.99} in this column
because it doesn't have to store the sign for positive numbers)
In ANSI/ISO SQL92, the syntax @code{DECIMAL(p)} is equivalent to
......@@ -21,7 +21,6 @@
#include <m_ctype.h>
#include <stdarg.h>
#include <my_getopt.h>
#include <assert.h>
#ifdef HAVE_SYS_VADVICE_H
#include <sys/vadvise.h>
#endif
......
......@@ -426,9 +426,12 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
{
int error=pthread_cond_timedwait(cond, mutex, abstime);
if (error == -1) /* Safety if the lib is fixed */
error=errno;
{
if (!(error=errno))
error= ETIMEDOUT; /* Can happen on HPUX */
}
if (error == EAGAIN) /* Correct errno to Posix */
error=ETIMEDOUT;
error= ETIMEDOUT;
return error;
}
#endif
......
......@@ -123,7 +123,7 @@ my_bool my_thread_init(void)
#if !defined(__WIN__) || defined(USE_TLS)
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
{
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_init() called more than once in thread %ld\n",
pthread_self());
#endif
......
......@@ -151,7 +151,7 @@ add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,
add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
add Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
add Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv,
add Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv
add Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
END_OF_DATA
if test $? -eq "0"
......@@ -160,7 +160,7 @@ then
echo ""
echo "Updating new privileges in MySQL 4.0.2 from old ones"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv
update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv;
END_OF_DATA
echo ""
fi
......
......@@ -151,7 +151,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
lex->slave_thd_opt=0;
lex->sql_command=SQLCOM_END;
bzero(&lex->mi,sizeof(lex->mi));
return lex;
}
......
......@@ -59,7 +59,6 @@ extern "C" int gethostname(char *name, int namelen);
#endif
static int check_for_max_user_connections(USER_CONN *uc);
static bool check_mqh(THD *thd);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables);
......@@ -290,16 +289,19 @@ static int check_for_max_user_connections(USER_CONN *uc)
int error=0;
DBUG_ENTER("check_for_max_user_connections");
if (max_user_connections && ( max_user_connections <= (uint) uc->connections))
if (max_user_connections &&
(max_user_connections <= (uint) uc->connections))
{
net_printf(&(current_thd->net),ER_TOO_MANY_USER_CONNECTIONS, uc->user);
error=1;
goto end;
}
uc->connections++;
if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
if (uc->user_resources.connections &&
uc->conn_per_hour++ >= uc->user_resources.connections)
{
net_printf(&current_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections",
net_printf(&current_thd->net, ER_USER_LIMIT_REACHED, uc->user,
"max_connections",
(long) uc->user_resources.connections);
error=1;
goto end;
......@@ -311,12 +313,8 @@ end:
static void decrease_user_connections(USER_CONN *uc)
{
/* if (!max_user_connections)
return;
*/
DBUG_ENTER("decrease_user_connections");
if (!mqh_used && uc->connections && !--uc->connections)
if ((uc->connections && !--uc->connections) && !mqh_used)
{
/* Last connection for user; Delete it */
(void) pthread_mutex_lock(&LOCK_user_conn);
......@@ -337,21 +335,19 @@ void free_max_user_conn(void)
Check if maximum queries per hour limit has been reached
returns 0 if OK.
In theory we would need a mutex in the USER_CONN structure for this to be 100 %
safe, but as the worst scenario is that we would miss counting a couple of
queries, this isn't critical.
In theory we would need a mutex in the USER_CONN structure for this to
be 100 % safe, but as the worst scenario is that we would miss counting
a couple of queries, this isn't critical.
*/
char uc_update_queries[SQLCOM_END];
static bool check_mqh(THD *thd)
static bool check_mqh(THD *thd, uint check_command)
{
bool error=0;
DBUG_ENTER("check_mqh");
USER_CONN *uc=thd->user_connect;
DBUG_ASSERT(uc != 0);
uint check_command = thd->lex.sql_command;
if (check_command < (uint) SQLCOM_END)
{
......@@ -378,7 +374,8 @@ static bool check_mqh(THD *thd)
uc->intime=check_time;
(void) pthread_mutex_unlock(&LOCK_user_conn);
}
else if (uc->user_resources.questions && ++(uc->questions) > uc->user_resources.questions)
else if (uc->user_resources.questions &&
uc->questions++ >= uc->user_resources.questions)
{
net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_questions",
(long) uc->user_resources.questions);
......@@ -742,7 +739,7 @@ pthread_handler_decl(handle_bootstrap,arg)
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
thd->query[length] = '\0';
thd->query_id=query_id++;
if (mqh_used && thd->user_connect && check_mqh(thd))
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
{
thd->net.error = 0;
close_thread_tables(thd); // Free tables
......@@ -982,12 +979,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
mysql_log.write(thd,command,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
if (mqh_used && thd->user_connect && check_mqh(thd))
{
error = TRUE; // Abort client
net->error = 0; // Don't give abort message
break;
}
/* thd->query_length is set by mysql_parse() */
mysql_parse(thd,thd->query,packet_length);
if (!(specialflag & SPECIAL_NO_PRIOR))
......@@ -2360,7 +2351,8 @@ mysql_execute_command(void)
Query_log_event qinfo(thd, thd->query);
mysql_bin_log.write(&qinfo);
}
if (mqh_used && (lex->mqh.questions || lex->mqh.updates || lex->mqh.connections) && lex->sql_command == SQLCOM_GRANT)
if (mqh_used && lex->sql_command == SQLCOM_GRANT &&
(lex->mqh.questions || lex->mqh.updates || lex->mqh.connections))
{
List_iterator <LEX_USER> str_list(lex->users_list);
LEX_USER *user;
......@@ -2741,6 +2733,7 @@ mysql_init_select(LEX *lex)
select_lex->next = (SELECT_LEX *)NULL;
}
bool
mysql_new_select(LEX *lex)
{
......@@ -2759,6 +2752,7 @@ mysql_new_select(LEX *lex)
return 0;
}
void mysql_init_multi_delete(LEX *lex)
{
lex->sql_command = SQLCOM_DELETE_MULTI;
......@@ -2770,6 +2764,7 @@ void mysql_init_multi_delete(LEX *lex)
lex->select->table_list.next= (byte**) &(lex->select->table_list.first);
}
void
mysql_parse(THD *thd,char *inBuf,uint length)
{
......@@ -2782,7 +2777,8 @@ mysql_parse(THD *thd,char *inBuf,uint length)
LEX *lex=lex_start(thd, (uchar*) inBuf, length);
if (!yyparse() && ! thd->fatal_error)
{
if (mqh_used && thd->user_connect && check_mqh(thd))
if (mqh_used && thd->user_connect &&
check_mqh(thd, thd->lex.sql_command))
{
thd->net.error = 0;
}
......
......@@ -4786,7 +4786,8 @@ join_read_last(JOIN_TAB *tab)
{
TABLE *table=tab->table;
int error;
if (!table->key_read && (table->used_keys & ((key_map) 1 << tab->index)))
if (!table->key_read && (table->used_keys & ((key_map) 1 << tab->index)) &&
!table->no_keyread)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment