diff options
author | unknown <konstantin@bodhi.netgear> | 2006-07-06 22:55:48 +0400 |
---|---|---|
committer | unknown <konstantin@bodhi.netgear> | 2006-07-06 22:55:48 +0400 |
commit | df9b4754b7680fae685d34a9ed1210452f6f8088 (patch) | |
tree | a054d3ff659c59af94637b315fc1234edc00dbcf /sql/sql_class.h | |
parent | d2b4e9c8e22f3d06848701e8fa1e9c800c471960 (diff) | |
parent | 7982816b8adac32e055849f0e8d15a973889ad1d (diff) | |
download | mariadb-git-df9b4754b7680fae685d34a9ed1210452f6f8088.tar.gz |
Merge bodhi.netgear:/opt/local/work/tmp_merge
into bodhi.netgear:/opt/local/work/mysql-5.1-runtime-merge-with-5.0
mysql-test/r/create.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp.h:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/table.h:
Auto merged
sql/tztime.cc:
Auto merged
include/my_sys.h:
Manual merge (second attempt).
mysql-test/r/bdb.result:
Manual merge (second attempt).
mysql-test/t/bdb.test:
Manual merge (second attempt).
mysys/my_malloc.c:
Manual merge (second attempt).
mysys/safemalloc.c:
Manual merge (second attempt).
sql/ha_federated.cc:
Manual merge (second attempt).
sql/log_event.cc:
Manual merge (second attempt).
sql/set_var.cc:
Manual merge (second attempt).
sql/set_var.h:
Manual merge (second attempt).
sql/slave.cc:
Manual merge (second attempt).
sql/slave.h:
Manual merge (second attempt).
sql/sql_class.h:
Manual merge (second attempt).
sql/sql_table.cc:
Manual merge (second attempt).
sql/sql_udf.cc:
Manual merge (second attempt).
sql/sql_yacc.yy:
Manual merge (second attempt).
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 5222e75f309..b79f0753603 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1135,7 +1135,7 @@ public: uint tmp_table, global_read_lock; uint server_status,open_options; enum enum_thread_type system_thread; - uint32 db_length; + uint db_length; uint select_number; //number of select (used for EXPLAIN) /* variables.transaction_isolation is reset to this after each commit */ enum_tx_isolation session_tx_isolation; @@ -1443,6 +1443,47 @@ public: current_stmt_binlog_row_based= FALSE; #endif } + + /* + Initialize the current database from a NULL-terminated string with length + */ + void set_db(const char *new_db, uint new_db_len) + { + if (new_db) + { + /* Do not reallocate memory if current chunk is big enough. */ + if (db && db_length >= new_db_len) + memcpy(db, new_db, new_db_len+1); + else + { + safeFree(db); + db= my_strndup(new_db, new_db_len, MYF(MY_WME)); + } + db_length= db ? new_db_len: 0; + } + } + void reset_db(char *new_db, uint new_db_len) + { + db= new_db; + db_length= new_db_len; + } + /* + Copy the current database to the argument. Use the current arena to + allocate memory for a deep copy: current database may be freed after + a statement is parsed but before it's executed. + */ + bool copy_db_to(char **p_db, uint *p_db_length) + { + if (db == NULL) + { + my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); + return TRUE; + } + *p_db= strmake(db, db_length); + if (p_db_length) + *p_db_length= db_length; + return FALSE; + } }; @@ -1790,7 +1831,7 @@ typedef struct st_sort_buffer { class Table_ident :public Sql_alloc { - public: +public: LEX_STRING db; LEX_STRING table; SELECT_LEX_UNIT *sel; |