diff options
author | tulin@dl145b.mysql.com <> | 2005-07-19 21:56:10 +0200 |
---|---|---|
committer | tulin@dl145b.mysql.com <> | 2005-07-19 21:56:10 +0200 |
commit | a6c21a079163d2d09163cb4084ada38f4ddac929 (patch) | |
tree | 91e9f17b6b183df5ad37be93a13365d7d0f0d7f8 /sql/sql_class.h | |
parent | 519c5564b15cf4b88719eb0e4cb4dc5247891425 (diff) | |
parent | e3af1b6ec6ecd95b6f42192c75af08fcc7c3618a (diff) | |
download | mariadb-git-a6c21a079163d2d09163cb4084ada38f4ddac929.tar.gz |
merge
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 37bfd1656a8..283ae96eebc 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -757,7 +757,7 @@ class Cursor; be used explicitly. */ -class Statement: public Query_arena +class Statement: public ilink, public Query_arena { Statement(const Statement &rhs); /* not implemented: */ Statement &operator=(const Statement &rhs); /* non-copyable */ @@ -841,6 +841,8 @@ public: void restore_backup_statement(Statement *stmt, Statement *backup); /* return class type */ virtual Type type() const; + /* Close the cursor open for this statement, if there is one */ + virtual void close_cursor(); }; @@ -892,15 +894,25 @@ public: } hash_delete(&st_hash, (byte *) statement); } + void add_transient_cursor(Statement *stmt) + { transient_cursor_list.append(stmt); } + void erase_transient_cursor(Statement *stmt) { stmt->unlink(); } + /* + Close all cursors of this connection that use tables of a storage + engine that has transaction-specific state and therefore can not + survive COMMIT or ROLLBACK. Currently all but MyISAM cursors are closed. + */ + void close_transient_cursors(); /* Erase all statements (calls Statement destructor) */ void reset() { my_hash_reset(&names_hash); my_hash_reset(&st_hash); + transient_cursor_list.empty(); last_found_statement= 0; } - ~Statement_map() + void destroy() { hash_free(&names_hash); hash_free(&st_hash); @@ -908,6 +920,7 @@ public: private: HASH st_hash; HASH names_hash; + I_List<Statement> transient_cursor_list; Statement *last_found_statement; }; @@ -1025,8 +1038,7 @@ public: a thread/connection descriptor */ -class THD :public ilink, - public Statement, +class THD :public Statement, public Open_tables_state { public: @@ -1052,6 +1064,10 @@ public: struct rand_struct rand; // used for authentication struct system_variables variables; // Changeable local variables struct system_status_var status_var; // Per thread statistic vars + THR_LOCK_INFO lock_info; // Locking info of this thread + THR_LOCK_OWNER main_lock_id; // To use for conventional queries + THR_LOCK_OWNER *lock_id; // If not main_lock_id, points to + // the lock_id of a cursor. pthread_mutex_t LOCK_delete; // Locked before thd is deleted /* all prepared statements and cursors of this connection */ Statement_map stmt_map; @@ -1475,6 +1491,8 @@ public: (variables.sql_mode & MODE_STRICT_ALL_TABLES))); } void set_status_var_init(); + bool is_context_analysis_only() + { return current_arena->is_stmt_prepare() || lex->view_prepare_mode; } bool push_open_tables_state(); void pop_open_tables_state(); }; |