diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2001-12-26 16:49:10 +0200 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2001-12-26 16:49:10 +0200 |
commit | 71ce58a3b1f0b2d4ec776bc7864076603b3170f4 (patch) | |
tree | 1924b9282a4aed314ccafcecea76220ffcee2576 /sql/sql_acl.cc | |
parent | 1baa552749eab973ce7814a47d4f3826ffd71bfe (diff) | |
download | mariadb-git-71ce58a3b1f0b2d4ec776bc7864076603b3170f4.tar.gz |
This is a large push. Included are :
* multi-table updates
* new paid feature for limiting number of queries per hour for users
* optional syntax for multi-table deletes
* optimization for SQL_CALC_FOUND_ROWS
* a small addition for CREATE .. SELECT that will be of future use
I know that all this will require many additions to documentation,
which I have not done, but I am at Arjen's disposal to help him document
all this.
libmysqld/lib_sql.cc:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
mysql-test/r/multi_update.result:
Change of the result to accomodate multi-table updates
mysql-test/t/multi_update.test:
Change in multi-table tests to accomodate multi-table updates
BitKeeper/etc/ignore:
Added 50 sql/new.cc to the ignore list
scripts/mysql_install_db.sh:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/item_timefunc.h:
This is a small feature that will be of use later in the proper
creation of the tables out of CREATE ... SELECT...
Further changes will come after this resolve/push/test passes ..
sql/lex.h:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/mysql_priv.h:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/mysqld.cc:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/sql_acl.cc:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/sql_acl.h:
This is a small change required due to new paid feature of limiting
number of queries per hour for each user.
sql/sql_class.h:
These are changes required for multi-table updates.
sql/sql_lex.h:
Changes required for both multi-table updates and limiting number of
queries per hour (paid feature).
sql/sql_parse.cc:
Ha ! So many changes.
* multi-table updates
* limiting number of queries per hour for users
sql/sql_select.cc:
Optimisation for SQL_CALC_FOUND_ROWS, when a query involves a single
table, without WHERE or GROUP clause
sql/sql_update.cc:
multi-table updates
sql/sql_yacc.yy:
Many things :
* multi-table updates
* limiting number of queries per hour for users
* new optional syntax for multi-table deletes. This one is different
from the one demanded by user. USING clause MUST include ALL tables,
not just the ones that are used and not deleted from.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 888ccf7b482..e0c62838618 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -58,7 +58,7 @@ class ACL_USER :public ACL_ACCESS { public: acl_host_and_ip host; - uint hostname_length; + uint hostname_length, questions, updates; char *user,*password; ulong salt[2]; #ifdef HAVE_OPENSSL @@ -240,6 +240,15 @@ int acl_init(bool dont_read_acl_tables) user.access=get_access(table,3); user.sort=get_sort(2,user.host.hostname,user.user); user.hostname_length=user.host.hostname ? (uint) strlen(user.host.hostname) : 0; + if (table->fields >=23) + { + char *ptr = get_field(&mem, table, 21); + user.questions=atoi(ptr); + ptr = get_field(&mem, table, 22); + user.updates=atoi(ptr); + if (user.questions) + mqh_used=true; + } #ifndef TO_BE_REMOVED if (table->fields <= 13) { // Without grant @@ -423,7 +432,7 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b) /* Get master privilges for user (priviliges for all tables). Required to connect */ uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user, const char *password,const char *message,char **priv_user, - bool old_ver) + bool old_ver, uint *max) { uint user_access=NO_ACCESS; *priv_user=(char*) user; @@ -536,6 +545,7 @@ uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user, #else /* HAVE_OPENSSL */ user_access=acl_user->access; #endif /* HAVE_OPENSSL */ + *max=acl_user->questions; if (!acl_user->user) *priv_user=(char*) ""; // Change to anonymous user /* purecov: inspected */ break; @@ -569,6 +579,7 @@ static void acl_update_user(const char *user, const char *host, const char *ssl_cipher, const char *x509_issuer, const char *x509_subject, + unsigned int mqh, uint privileges) { for (uint i=0 ; i < acl_users.elements ; i++) @@ -582,6 +593,7 @@ static void acl_update_user(const char *user, const char *host, acl_user->host.hostname && !strcmp(host,acl_user->host.hostname)) { acl_user->access=privileges; + acl_user->questions=mqh; #ifdef HAVE_OPENSSL acl_user->ssl_type=ssl_type; acl_user->ssl_cipher=ssl_cipher; @@ -611,6 +623,7 @@ static void acl_insert_user(const char *user, const char *host, const char *ssl_cipher, const char *x509_issuer, const char *x509_subject, + unsigned int mqh, uint privileges) { ACL_USER acl_user; @@ -618,6 +631,7 @@ static void acl_insert_user(const char *user, const char *host, update_hostname(&acl_user.host,strdup_root(&mem,host)); acl_user.password=0; acl_user.access=privileges; + acl_user.questions=mqh; acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user); acl_user.hostname_length=(uint) strlen(acl_user.host.hostname); #ifdef HAVE_OPENSSL @@ -1192,6 +1206,13 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, } } #endif /* HAVE_OPENSSL */ + if (table->fields>=23 && thd->lex.mqh) + { + char buff[33]; + int len =int2str((long)thd->lex.mqh,buff,10) - buff; + table->field[21]->store(buff,len); + mqh_used=true; + } if (old_row_exists) { /* @@ -1230,6 +1251,7 @@ end: thd->lex.ssl_cipher, thd->lex.x509_issuer, thd->lex.x509_subject, + thd->lex.mqh, rights); else acl_insert_user(combo.user.str,combo.host.str,password, @@ -1237,6 +1259,7 @@ end: thd->lex.ssl_cipher, thd->lex.x509_issuer, thd->lex.x509_subject, + thd->lex.mqh, rights); } table->file->index_end(); |