1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0

into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/r/heap_btree.result:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/r/lock_multi.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/view_grant.result:
  Auto merged
mysql-test/t/lock_multi.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/view_grant.test:
  Auto merged
mysys/default.c:
  Auto merged
server-tools/instance-manager/guardian.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/heap/hp_write.c:
  Auto merged
storage/ndb/src/ndbapi/DictCache.cpp:
  Auto merged
storage/ndb/src/ndbapi/DictCache.hpp:
  Auto merged
client/mysqlbinlog.cc:
  Manual merge from 5.0
client/mysqldump.c:
  Manual merge from 5.0
configure.in:
  Manual merge from 5.0
mysql-test/r/mysqldump.result:
  Manual merge from 5.0
mysql-test/t/mysqldump.test:
  Manual merge from 5.0
mysql-test/t/rpl_insert_id.test:
  Manual merge from 5.0
server-tools/instance-manager/manager.cc:
  Manual merge from 5.0
sql/field.cc:
  Manual merge from 5.0
sql/ha_ndbcluster.cc:
  Manual merge from 5.0
sql/mysqld.cc:
  Manual merge from 5.0
sql/sql_base.cc:
  Manual merge from 5.0
sql/sql_lex.cc:
  Manual merge from 5.0
sql/sql_select.cc:
  Manual merge from 5.0
sql/sql_table.cc:
  Manual merge from 5.0
This commit is contained in:
unknown
2006-05-30 16:07:49 +03:00
57 changed files with 1378 additions and 403 deletions

View File

@ -3063,14 +3063,13 @@ static my_bool dump_all_views_in_db(char *database)
different case (e.g. T1 vs t1)
RETURN
int - 0 if a tablename was retrieved. 1 if not
pointer to the table name
0 if error
*/
static int get_actual_table_name(const char *old_table_name,
char *new_table_name,
int buf_size)
static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
{
int retval;
char *name= 0;
MYSQL_RES *table_res;
MYSQL_ROW row;
char query[50 + 2*NAME_LEN];
@ -3087,66 +3086,55 @@ static int get_actual_table_name(const char *old_table_name,
safe_exit(EX_MYSQLERR);
}
retval = 1;
if ((table_res= mysql_store_result(sock)))
{
my_ulonglong num_rows= mysql_num_rows(table_res);
if (num_rows > 0)
{
ulong *lengths;
/*
Return first row
TODO: Return all matching rows
*/
row= mysql_fetch_row(table_res);
strmake(new_table_name, row[0], buf_size-1);
retval= 0;
lengths= mysql_fetch_lengths(table_res);
name= strmake_root(root, row[0], lengths[0]);
}
mysql_free_result(table_res);
}
DBUG_RETURN(retval);
DBUG_PRINT("exit", ("new_table_name: %s", name));
DBUG_RETURN(name);
}
static int dump_selected_tables(char *db, char **table_names, int tables)
{
uint i;
char table_buff[NAME_LEN*+3];
char new_table_name[NAME_LEN];
DYNAMIC_STRING lock_tables_query;
HASH dump_tables;
char *table_name;
MEM_ROOT root;
char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db))
DBUG_RETURN(1);
/* Init hash table for storing the actual name of tables to dump */
if (hash_init(&dump_tables, charset_info, 16, 0, 0,
(hash_get_key) get_table_key, (hash_free_key) free_table_ent,
0))
init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
exit(EX_EOM);
init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024);
for (; tables > 0 ; tables-- , table_names++)
{
/* the table name passed on commandline may be wrong case */
if (!get_actual_table_name(*table_names,
new_table_name, sizeof(new_table_name)))
if ((*pos= get_actual_table_name(*table_names, &root)))
{
/* Add found table name to lock_tables_query */
if (lock_tables)
{
dynstr_append(&lock_tables_query,
quote_name(new_table_name, table_buff, 1));
dynstr_append(&lock_tables_query, quote_name(*pos, table_buff, 1));
dynstr_append(&lock_tables_query, " READ /*!32311 LOCAL */,");
}
/* Add found table name to dump_tables list */
if (my_hash_insert(&dump_tables,
(byte*)my_strdup(new_table_name, MYF(0))))
exit(EX_EOM);
pos++;
}
else
{
@ -3156,6 +3144,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
/* We shall countinue here, if --force was given */
}
}
end= pos;
if (lock_tables)
{
@ -3175,24 +3164,20 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
print_xml_tag1(md_result_file, "", "database name=", db, "\n");
/* Dump each selected table */
for (i= 0; i < dump_tables.records; i++)
for (pos= dump_tables; pos < end; pos++)
{
table_name= hash_element(&dump_tables, i);
DBUG_PRINT("info",("Dumping table %s", table_name));
dump_table(table_name,db);
DBUG_PRINT("info",("Dumping table %s", *pos));
dump_table(*pos, db);
if (opt_dump_triggers &&
mysql_get_server_version(sock) >= 50009)
dump_triggers_for_table(table_name, db);
dump_triggers_for_table(*pos, db);
}
/* Dump each selected view */
if (was_views)
{
for(i=0; i < dump_tables.records; i++)
{
table_name= hash_element(&dump_tables, i);
get_view_structure(table_name, db);
}
for (pos= dump_tables; pos < end; pos++)
get_view_structure(*pos, db);
}
if (opt_events && !opt_xml &&
mysql_get_server_version(sock) >= 50106)
@ -3207,7 +3192,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
}
hash_free(&dump_tables);
free_root(&root, MYF(0));
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
if (opt_xml)