diff options
author | unknown <monty@hundin.mysql.fi> | 2002-06-17 09:46:38 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-06-17 09:46:38 +0300 |
commit | 19e7bb150fffc487337d9b96cde681e6beb7e9c4 (patch) | |
tree | c4192ea1dc766c5876a63b0bb65cdd30a84a36e7 | |
parent | 83e965bd238f9b9597a6cc5fc274f47e7194f92a (diff) | |
parent | 3ee08e707afe5d15422a653723cc3563955aa476 (diff) | |
download | mariadb-git-19e7bb150fffc487337d9b96cde681e6beb7e9c4.tar.gz |
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Docs/manual.texi:
Auto merged
sql/sql_select.cc:
Auto merged
-rw-r--r-- | Docs/manual.texi | 8 | ||||
-rw-r--r-- | myisam/myisamchk.c | 1 | ||||
-rw-r--r-- | mysys/my_pthread.c | 7 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 2 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sh | 4 | ||||
-rw-r--r-- | sql/sql_lex.cc | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 46 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 |
8 files changed, 35 insertions, 37 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 915e3830f63..4f2ef5c2432 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -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 diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 379a985705d..f2b5525f22a 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -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 diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index e1345b96627..38451f1f79a 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -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 diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 2bd02ad957f..9f91f7a392d 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -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 diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index ead0350093a..7fc18aa1e2f 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -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 diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7015ce3f98b..575aea5c947 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -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; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6c09100b0da..a29e1e6930f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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(¤t_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections", + net_printf(¤t_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; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9bb1365e4c3..94fa08b769a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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); |