1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime

into  mysql.com:/opt/local/work/mysql-5.0-17199
This commit is contained in:
konstantin@mysql.com
2006-06-27 00:52:56 +04:00
25 changed files with 634 additions and 290 deletions

View File

@ -1571,6 +1571,47 @@ public:
void restore_sub_statement_state(Sub_statement_state *backup);
void set_n_backup_active_arena(Query_arena *set, Query_arena *backup);
void restore_active_arena(Query_arena *set, Query_arena *backup);
/*
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_strdup_with_length(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;
}
};
@ -1916,7 +1957,7 @@ typedef struct st_sort_buffer {
class Table_ident :public Sql_alloc
{
public:
public:
LEX_STRING db;
LEX_STRING table;
SELECT_LEX_UNIT *sel;