diff options
author | unknown <monty@mashka.mysql.fi> | 2003-09-11 20:31:40 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-09-11 20:31:40 +0300 |
commit | 41824a35338012ff8196eb975f961d5e0f0e2a22 (patch) | |
tree | 1475a169c541e6b7aedb36103dd255fe52fc0517 /sql/sql_table.cc | |
parent | 07bc35e1d024e5e3b81b131a47878510f0521609 (diff) | |
parent | d32bdcb1bfc274476cdd945e66e00f3ec31253c3 (diff) | |
download | mariadb-git-41824a35338012ff8196eb975f961d5e0f0e2a22.tar.gz |
merge with 4.1 tree
client/mysqltest.c:
Auto merged
include/mysql.h:
Auto merged
libmysql/errmsg.c:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/share/portuguese/errmsg.txt:
Auto merged
sql/share/spanish/errmsg.txt:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
tests/client_test.c:
Auto merged
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 571ee371721..5f16377d20a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -920,7 +920,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, thd->proc_info="creating table"; + if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) + create_info->data_file_name= create_info->index_file_name= 0; create_info->table_options=db_options; + if (rea_create_table(thd, path, create_info, fields, key_count, key_info_buffer)) { @@ -2585,7 +2588,8 @@ copy_data_between_tables(TABLE *from,TABLE *to, DBUG_RETURN(error > 0 ? -1 : 0); } -int mysql_checksum_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT *check_opt) + +int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt) { TABLE_LIST *table; List<Item> field_list; @@ -2600,24 +2604,23 @@ int mysql_checksum_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT *check_opt) if (protocol->send_fields(&field_list, 1)) DBUG_RETURN(-1); - for (table = tables; table; table = table->next) + for (table= tables; table; table= table->next) { char table_name[NAME_LEN*2+2]; - char* db = (table->db) ? table->db : thd->db; - bool fatal_error=0; + bool fatal_error= 0; TABLE *t; - strxmov(table_name,db ? db : "",".",table->real_name,NullS); - t=table->table = open_ltable(thd, table, TL_READ_NO_INSERT); -#ifdef EMBEDDED_LIBRARY - thd->net.last_errno= 0; // these errors shouldn't get client -#endif + strxmov(table_name, table->db ,".", table->real_name, NullS); + + t= table->table= open_ltable(thd, table, TL_READ_NO_INSERT); + thd->clear_error(); // these errors shouldn't get client protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); if (!t) { + /* Table didn't exist */ protocol->store_null(); thd->net.last_error[0]=0; } @@ -2629,45 +2632,42 @@ int mysql_checksum_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT *check_opt) !(check_opt->flags & T_EXTEND)) protocol->store((ulonglong)t->file->checksum()); else if (!(t->file->table_flags() & HA_HAS_CHECKSUM) && - check_opt->flags & T_QUICK) + (check_opt->flags & T_QUICK)) protocol->store_null(); else { /* calculating table's checksum */ - ha_checksum crc=0; + ha_checksum crc= 0; if (t->file->rnd_init(1)) protocol->store_null(); else { while (!t->file->rnd_next(t->record[0])) { - ha_checksum row_crc=0; + ha_checksum row_crc= 0; if (t->record[0] != t->field[0]->ptr) - row_crc=my_checksum(row_crc, t->record[0], - t->field[0]->ptr - t->record[0]); + row_crc= my_checksum(row_crc, t->record[0], + t->field[0]->ptr - t->record[0]); - for (uint i=0; i < t->fields; i++ ) + for (uint i= 0; i < t->fields; i++ ) { - Field *f=t->field[i]; + Field *f= t->field[i]; if (f->type() == FIELD_TYPE_BLOB) { String tmp; f->val_str(&tmp,&tmp); - row_crc=my_checksum(row_crc, tmp.ptr(), tmp.length()); + row_crc= my_checksum(row_crc, tmp.ptr(), tmp.length()); } else - row_crc=my_checksum(row_crc, f->ptr, f->pack_length()); + row_crc= my_checksum(row_crc, f->ptr, f->pack_length()); } - crc+=row_crc; + crc+= row_crc; } protocol->store((ulonglong)crc); } } -#ifdef EMBEDDED_LIBRARY - thd->net.last_errno= 0; // these errors shouldn't get client -#endif - + thd->clear_error(); close_thread_tables(thd); table->table=0; // For query cache } @@ -2677,6 +2677,7 @@ int mysql_checksum_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT *check_opt) send_eof(thd); DBUG_RETURN(0); + err: close_thread_tables(thd); // Shouldn't be needed if (table) |