Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fc52abc5
Commit
fc52abc5
authored
Jun 16, 2002
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup of checking of user resources
Added missing checking of no_keyread
parent
33a377c7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
37 deletions
+35
-37
Docs/manual.texi
Docs/manual.texi
+4
-4
myisam/myisamchk.c
myisam/myisamchk.c
+0
-1
mysys/my_pthread.c
mysys/my_pthread.c
+5
-2
mysys/my_thr_init.c
mysys/my_thr_init.c
+1
-1
scripts/mysql_fix_privilege_tables.sh
scripts/mysql_fix_privilege_tables.sh
+2
-2
sql/sql_lex.cc
sql/sql_lex.cc
+0
-1
sql/sql_parse.cc
sql/sql_parse.cc
+21
-25
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
Docs/manual.texi
View file @
fc52abc5
...
@@ -29121,16 +29121,16 @@ types the precision and scale can be (and usually is) specified; for
...
@@ -29121,16 +29121,16 @@ types the precision and scale can be (and usually is) specified; for
example:
example:
@example
@example
salary DECIMAL(
9
,2)
salary DECIMAL(
5
,2)
@end example
@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}
significant decimal digits that will be stored for values, and @code{2}
(@code{scale}) represents the number of digits that will be stored
(@code{scale}) represents the number of digits that will be stored
following the decimal point. In this case, therefore, the range of
following the decimal point. In this case, therefore, the range of
values that can be stored in the @code{salary} column is from
values that can be stored in the @code{salary} column is from
@code{-99
99999.99} to @code{99999
99.99}.
@code{-99
.99} to @code{
99.99}.
(MySQL can actually store numbers up to @code{999
9999
.99} in this column
(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)
because it doesn't have to store the sign for positive numbers)
In ANSI/ISO SQL92, the syntax @code{DECIMAL(p)} is equivalent to
In ANSI/ISO SQL92, the syntax @code{DECIMAL(p)} is equivalent to
myisam/myisamchk.c
View file @
fc52abc5
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#include <m_ctype.h>
#include <m_ctype.h>
#include <stdarg.h>
#include <stdarg.h>
#include <my_getopt.h>
#include <my_getopt.h>
#include <assert.h>
#ifdef HAVE_SYS_VADVICE_H
#ifdef HAVE_SYS_VADVICE_H
#include <sys/vadvise.h>
#include <sys/vadvise.h>
#endif
#endif
...
...
mysys/my_pthread.c
View file @
fc52abc5
...
@@ -426,9 +426,12 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
...
@@ -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
);
int
error
=
pthread_cond_timedwait
(
cond
,
mutex
,
abstime
);
if
(
error
==
-
1
)
/* Safety if the lib is fixed */
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 */
if
(
error
==
EAGAIN
)
/* Correct errno to Posix */
error
=
ETIMEDOUT
;
error
=
ETIMEDOUT
;
return
error
;
return
error
;
}
}
#endif
#endif
...
...
mysys/my_thr_init.c
View file @
fc52abc5
...
@@ -123,7 +123,7 @@ my_bool my_thread_init(void)
...
@@ -123,7 +123,7 @@ my_bool my_thread_init(void)
#if !defined(__WIN__) || defined(USE_TLS)
#if !defined(__WIN__) || defined(USE_TLS)
if
(
my_pthread_getspecific
(
struct
st_my_thread_var
*
,
THR_KEY_mysys
))
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
"
,
fprintf
(
stderr
,
"my_thread_init() called more than once in thread %ld
\n
"
,
pthread_self
());
pthread_self
());
#endif
#endif
...
...
scripts/mysql_fix_privilege_tables.sh
View file @
fc52abc5
...
@@ -151,7 +151,7 @@ add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,
...
@@ -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 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 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_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
END_OF_DATA
if
test
$?
-eq
"0"
if
test
$?
-eq
"0"
...
@@ -160,7 +160,7 @@ then
...
@@ -160,7 +160,7 @@ then
echo
""
echo
""
echo
"Updating new privileges in MySQL 4.0.2 from old ones"
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
@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
END_OF_DATA
echo
""
echo
""
fi
fi
...
...
sql/sql_lex.cc
View file @
fc52abc5
...
@@ -151,7 +151,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
...
@@ -151,7 +151,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
ignore_space
=
test
(
thd
->
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
ignore_space
=
test
(
thd
->
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
slave_thd_opt
=
0
;
lex
->
slave_thd_opt
=
0
;
lex
->
sql_command
=
SQLCOM_END
;
bzero
(
&
lex
->
mi
,
sizeof
(
lex
->
mi
));
bzero
(
&
lex
->
mi
,
sizeof
(
lex
->
mi
));
return
lex
;
return
lex
;
}
}
...
...
sql/sql_parse.cc
View file @
fc52abc5
...
@@ -59,7 +59,6 @@ extern "C" int gethostname(char *name, int namelen);
...
@@ -59,7 +59,6 @@ extern "C" int gethostname(char *name, int namelen);
#endif
#endif
static
int
check_for_max_user_connections
(
USER_CONN
*
uc
);
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
void
decrease_user_connections
(
USER_CONN
*
uc
);
static
bool
check_db_used
(
THD
*
thd
,
TABLE_LIST
*
tables
);
static
bool
check_db_used
(
THD
*
thd
,
TABLE_LIST
*
tables
);
static
bool
check_merge_table_access
(
THD
*
thd
,
char
*
db
,
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)
...
@@ -290,16 +289,19 @@ static int check_for_max_user_connections(USER_CONN *uc)
int
error
=
0
;
int
error
=
0
;
DBUG_ENTER
(
"check_for_max_user_connections"
);
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
);
net_printf
(
&
(
current_thd
->
net
),
ER_TOO_MANY_USER_CONNECTIONS
,
uc
->
user
);
error
=
1
;
error
=
1
;
goto
end
;
goto
end
;
}
}
uc
->
connections
++
;
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
);
(
long
)
uc
->
user_resources
.
connections
);
error
=
1
;
error
=
1
;
goto
end
;
goto
end
;
...
@@ -311,12 +313,8 @@ end:
...
@@ -311,12 +313,8 @@ end:
static
void
decrease_user_connections
(
USER_CONN
*
uc
)
static
void
decrease_user_connections
(
USER_CONN
*
uc
)
{
{
/* if (!max_user_connections)
return;
*/
DBUG_ENTER
(
"decrease_user_connections"
);
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 */
/* Last connection for user; Delete it */
(
void
)
pthread_mutex_lock
(
&
LOCK_user_conn
);
(
void
)
pthread_mutex_lock
(
&
LOCK_user_conn
);
...
@@ -337,21 +335,19 @@ void free_max_user_conn(void)
...
@@ -337,21 +335,19 @@ void free_max_user_conn(void)
Check if maximum queries per hour limit has been reached
Check if maximum queries per hour limit has been reached
returns 0 if OK.
returns 0 if OK.
In theory we would need a mutex in the USER_CONN structure for this to
be 100 %
In theory we would need a mutex in the USER_CONN structure for this to
safe, but as the worst scenario is that we would miss counting a couple of
be 100 % safe, but as the worst scenario is that we would miss counting
queries, this isn't critical.
a couple of
queries, this isn't critical.
*/
*/
char
uc_update_queries
[
SQLCOM_END
];
char
uc_update_queries
[
SQLCOM_END
];
static
bool
check_mqh
(
THD
*
thd
)
static
bool
check_mqh
(
THD
*
thd
,
uint
check_command
)
{
{
bool
error
=
0
;
bool
error
=
0
;
DBUG_ENTER
(
"check_mqh"
);
DBUG_ENTER
(
"check_mqh"
);
USER_CONN
*
uc
=
thd
->
user_connect
;
USER_CONN
*
uc
=
thd
->
user_connect
;
DBUG_ASSERT
(
uc
!=
0
);
DBUG_ASSERT
(
uc
!=
0
);
uint
check_command
=
thd
->
lex
.
sql_command
;
if
(
check_command
<
(
uint
)
SQLCOM_END
)
if
(
check_command
<
(
uint
)
SQLCOM_END
)
{
{
...
@@ -378,7 +374,8 @@ static bool check_mqh(THD *thd)
...
@@ -378,7 +374,8 @@ static bool check_mqh(THD *thd)
uc
->
intime
=
check_time
;
uc
->
intime
=
check_time
;
(
void
)
pthread_mutex_unlock
(
&
LOCK_user_conn
);
(
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"
,
net_printf
(
&
thd
->
net
,
ER_USER_LIMIT_REACHED
,
uc
->
user
,
"max_questions"
,
(
long
)
uc
->
user_resources
.
questions
);
(
long
)
uc
->
user_resources
.
questions
);
...
@@ -742,7 +739,7 @@ pthread_handler_decl(handle_bootstrap,arg)
...
@@ -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
=
thd
->
memdup_w_gap
(
buff
,
length
+
1
,
thd
->
db_length
+
1
);
thd
->
query
[
length
]
=
'\0'
;
thd
->
query
[
length
]
=
'\0'
;
thd
->
query_id
=
query_id
++
;
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
;
thd
->
net
.
error
=
0
;
close_thread_tables
(
thd
);
// Free tables
close_thread_tables
(
thd
);
// Free tables
...
@@ -982,12 +979,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -982,12 +979,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
mysql_log
.
write
(
thd
,
command
,
"%s"
,
thd
->
query
);
mysql_log
.
write
(
thd
,
command
,
"%s"
,
thd
->
query
);
DBUG_PRINT
(
"query"
,(
"%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() */
/* thd->query_length is set by mysql_parse() */
mysql_parse
(
thd
,
thd
->
query
,
packet_length
);
mysql_parse
(
thd
,
thd
->
query
,
packet_length
);
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
...
@@ -2360,7 +2351,8 @@ mysql_execute_command(void)
...
@@ -2360,7 +2351,8 @@ mysql_execute_command(void)
Query_log_event
qinfo
(
thd
,
thd
->
query
);
Query_log_event
qinfo
(
thd
,
thd
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
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
);
List_iterator
<
LEX_USER
>
str_list
(
lex
->
users_list
);
LEX_USER
*
user
;
LEX_USER
*
user
;
...
@@ -2741,6 +2733,7 @@ mysql_init_select(LEX *lex)
...
@@ -2741,6 +2733,7 @@ mysql_init_select(LEX *lex)
select_lex
->
next
=
(
SELECT_LEX
*
)
NULL
;
select_lex
->
next
=
(
SELECT_LEX
*
)
NULL
;
}
}
bool
bool
mysql_new_select
(
LEX
*
lex
)
mysql_new_select
(
LEX
*
lex
)
{
{
...
@@ -2759,6 +2752,7 @@ mysql_new_select(LEX *lex)
...
@@ -2759,6 +2752,7 @@ mysql_new_select(LEX *lex)
return
0
;
return
0
;
}
}
void
mysql_init_multi_delete
(
LEX
*
lex
)
void
mysql_init_multi_delete
(
LEX
*
lex
)
{
{
lex
->
sql_command
=
SQLCOM_DELETE_MULTI
;
lex
->
sql_command
=
SQLCOM_DELETE_MULTI
;
...
@@ -2770,6 +2764,7 @@ void mysql_init_multi_delete(LEX *lex)
...
@@ -2770,6 +2764,7 @@ void mysql_init_multi_delete(LEX *lex)
lex
->
select
->
table_list
.
next
=
(
byte
**
)
&
(
lex
->
select
->
table_list
.
first
);
lex
->
select
->
table_list
.
next
=
(
byte
**
)
&
(
lex
->
select
->
table_list
.
first
);
}
}
void
void
mysql_parse
(
THD
*
thd
,
char
*
inBuf
,
uint
length
)
mysql_parse
(
THD
*
thd
,
char
*
inBuf
,
uint
length
)
{
{
...
@@ -2782,7 +2777,8 @@ 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
);
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
inBuf
,
length
);
if
(
!
yyparse
()
&&
!
thd
->
fatal_error
)
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
;
thd
->
net
.
error
=
0
;
}
}
...
...
sql/sql_select.cc
View file @
fc52abc5
...
@@ -4779,7 +4779,8 @@ join_read_last(JOIN_TAB *tab)
...
@@ -4779,7 +4779,8 @@ join_read_last(JOIN_TAB *tab)
{
{
TABLE
*
table
=
tab
->
table
;
TABLE
*
table
=
tab
->
table
;
int
error
;
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
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment