summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
committerunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
commitf095274fe8c3d3394d6c0ce0a68f4bea04311999 (patch)
tree23bcc9a71fe7237887a111b158e30f5a6bb665d3 /sql/table.cc
parentf41bba8c6156a7adf4c67dfa75e16112767a5d3c (diff)
parent5be6c328f5a9f78f37176bbbd88a538fa3b65fe9 (diff)
downloadmariadb-git-f095274fe8c3d3394d6c0ce0a68f4bea04311999.tar.gz
merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/triggers/post-commit: Auto merged Docs/Support/texi2html: Auto merged Makefile.am: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/my_time.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged mysql-test/include/ps_modify.inc: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/insert.test: merge with 4.1 Fixed test case to not use 'if exists' when it shouldn't mysql-test/t/range.test: merge with 4.1 Added missing drop table sql/ha_ndbcluster.cc: merge with 4.1 Simple optimization: use max() instead of ? : sql/item_func.cc: merge with 4.1 (Added back old variable names for easier merges) sql/opt_range.cc: merge with 4.1 Removed argument 'parent_alloc' from QUICK_RANGE_SELECT as this was not used Added assert if using QUICK_GROUP_MIN_MAX_SELECT with parent_alloc as the init() function can't handle this Changed back get_quick_select_for_ref() to use it's own alloc root becasue this function may be called several times for one query sql/sql_handler.cc: merge with 4.1 change variable 'err' to 'error' as same function had a label named 'err' sql/sql_update.cc: Use multi-update code from 5.0 instead of 4.1 We will fix the locking code shortly in 5.0 to be faster than in 4.1
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc39
1 files changed, 35 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc
index e372de57177..0116cf180c1 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -379,6 +379,24 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
fix_type_pointers(&int_array,&outparam->fieldnames,1,&names);
fix_type_pointers(&int_array,outparam->intervals,interval_count,
&names);
+
+ {
+ /* Set ENUM and SET lengths */
+ TYPELIB *interval;
+ for (interval= outparam->intervals;
+ interval < outparam->intervals + interval_count;
+ interval++)
+ {
+ uint count= (uint) (interval->count + 1) * sizeof(uint);
+ if (!(interval->type_lengths= (uint *) alloc_root(&outparam->mem_root,
+ count)))
+ goto err_not_open;
+ for (count= 0; count < interval->count; count++)
+ interval->type_lengths[count]= strlen(interval->type_names[count]);
+ interval->type_lengths[count]= 0;
+ }
+ }
+
if (keynames)
fix_type_pointers(&int_array,&outparam->keynames,1,&keynames);
VOID(my_close(file,MYF(MY_WME)));
@@ -731,6 +749,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
outparam->crashed=((err == HA_ERR_CRASHED_ON_USAGE) &&
outparam->file->auto_repair() &&
!(ha_open_flags & HA_OPEN_FOR_REPAIR));
+
+ if (err==HA_ERR_NO_SUCH_TABLE)
+ {
+ /* The table did not exists in storage engine, use same error message
+ as if the .frm file didn't exist */
+ error= 1;
+ my_errno= ENOENT;
+ }
goto err_not_open; /* purecov: inspected */
}
}
@@ -1030,14 +1056,19 @@ TYPELIB *typelib(List<String> &strings)
return 0;
result->count=strings.elements;
result->name="";
- if (!(result->type_names=(const char **) sql_alloc(sizeof(char *)*
- (result->count+1))))
+ uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1);
+ if (!(result->type_names= (const char**) sql_alloc(nbytes)))
return 0;
+ result->type_lengths= (uint*) (result->type_names + result->count + 1);
List_iterator<String> it(strings);
String *tmp;
for (uint i=0; (tmp=it++) ; i++)
- result->type_names[i]=tmp->ptr();
- result->type_names[result->count]=0; // End marker
+ {
+ result->type_names[i]= tmp->ptr();
+ result->type_lengths[i]= tmp->length();
+ }
+ result->type_names[result->count]= 0; // End marker
+ result->type_lengths[result->count]= 0;
return result;
}