summaryrefslogtreecommitdiff
path: root/sql/structs.h
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2004-12-29 22:35:16 +0300
committerunknown <dlenev@mysql.com>2004-12-29 22:35:16 +0300
commitf174d5a2414e22b6cf452a2e8cbb6b72395a56dc (patch)
tree1a687bd272d791651de5a4a1716efef6eebbe4b6 /sql/structs.h
parent44728324f0abe3e327fc2095a99e647b1c44dd8d (diff)
parent05b709fc77e2f321fa3fa45ee5b2ec2ceae54055 (diff)
downloadmariadb-git-f174d5a2414e22b6cf452a2e8cbb6b72395a56dc.tar.gz
Manual merge of patch implementing WL#1339 with main tree.
client/mysqltest.c: Auto merged mysql-test/r/system_mysql_db.result: Auto merged sql/lex.h: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/structs.h: Auto merged mysql-test/r/grant.result: Manual merge scripts/mysql_create_system_tables.sh: Manual merge scripts/mysql_fix_privilege_tables.sql: Manual merge sql/mysql_priv.h: Manual merge sql/mysqld.cc: Manual merge sql/sql_parse.cc: Manual merge
Diffstat (limited to 'sql/structs.h')
-rw-r--r--sql/structs.h55
1 files changed, 52 insertions, 3 deletions
diff --git a/sql/structs.h b/sql/structs.h
index 0b59c3abeb3..cbc7161ee20 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -206,16 +206,65 @@ typedef struct st_lex_user {
} LEX_USER;
+/*
+ This structure specifies the maximum amount of resources which
+ can be consumed by each account. Zero value of a member means
+ there is no limit.
+*/
typedef struct user_resources {
- uint questions, updates, connections, bits;
+ /* Maximum number of queries/statements per hour. */
+ uint questions;
+ /*
+ Maximum number of updating statements per hour (which statements are
+ updating is defined by uc_update_queries array).
+ */
+ uint updates;
+ /* Maximum number of connections established per hour. */
+ uint conn_per_hour;
+ /* Maximum number of concurrent connections. */
+ uint user_conn;
+ /*
+ Values of this enum and specified_limits member are used by the
+ parser to store which user limits were specified in GRANT statement.
+ */
+ enum {QUERIES_PER_HOUR= 1, UPDATES_PER_HOUR= 2, CONNECTIONS_PER_HOUR= 4,
+ USER_CONNECTIONS= 8};
+ uint specified_limits;
} USER_RESOURCES;
+
+/*
+ This structure is used for counting resources consumed and for checking
+ them against specified user limits.
+*/
typedef struct user_conn {
- char *user, *host;
- uint len, connections, conn_per_hour, updates, questions, user_len;
+ /*
+ Pointer to user+host key (pair separated by '\0') defining the entity
+ for which resources are counted (By default it is user account thus
+ priv_user/priv_host pair is used. If --old-style-user-limits option
+ is enabled, resources are counted for each user+host separately).
+ */
+ char *user;
+ /* Pointer to host part of the key. */
+ char *host;
+ /* Total length of the key. */
+ uint len;
+ /* Current amount of concurrent connections for this account. */
+ uint connections;
+ /*
+ Current number of connections per hour, number of updating statements
+ per hour and total number of statements per hour for this account.
+ */
+ uint conn_per_hour, updates, questions;
+ /* Maximum amount of resources which account is allowed to consume. */
USER_RESOURCES user_resources;
+ /*
+ The moment of time when per hour counters were reset last time
+ (i.e. start of "hour" for conn_per_hour, updates, questions counters).
+ */
time_t intime;
} USER_CONN;
+
/* Bits in form->update */
#define REG_MAKE_DUPP 1 /* Make a copy of record when read */
#define REG_NEW_RECORD 2 /* Write a new record if not found */