summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-03-03 03:03:12 +0200
committerunknown <monty@donna.mysql.fi>2001-03-03 03:03:12 +0200
commit73e3499987b138af0bd6ab7df2c69999e2ffbeec (patch)
treecd2f65141c35a1998982970704a3f854a987c568 /sql/field.cc
parent3ab1788501f7d967a0260e78230674aaa67ec16e (diff)
downloadmariadb-git-73e3499987b138af0bd6ab7df2c69999e2ffbeec.tar.gz
Fixes for innobase usage
Fixed bug when using TEXT columns with BDB tables Allow LOAD DATA INFILE to use numbers with ENUM and SET columns BUILD/compile-pentium: Added --with-innobase-db Docs/manual.texi: Added more documentation to Innobase and KILL client/mysqladmin.c: Quote database names for CREATE and DROP mysql-test/install_test_db.sh: Don't use innobase, bdb or gemini when installing privilege tables mysql-test/mysql-test-run.sh: Added testing of innobase tables mysql-test/r/bdb.result: Added test of TEXT column bug mysql-test/t/bdb.test: Added test of TEXT column bug mysql-test/t/innobase.test: Cleanup innobase tests scripts/mysql_install_db.sh: Added testing of innobase tables sql/field.cc: Allow LOAD DATA INFILE to use numbers with ENUM and SET columns sql/filesort.cc: Fixed typo sql/ha_berkeley.cc: Fixed problem with TEXT columns in BDB tables sql/mysqld.cc: Always support the --innobase-data-file-path option sql/share/swedish/errmsg.OLD: Added swedish error messages sql/share/swedish/errmsg.txt: Added swedish error messages sql/sql_base.cc: Reset tables after usage (to fix problem with BDB and TEXT columns) sql/sql_delete.cc: Use generate table if --skip-innobase is used
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc44
1 files changed, 39 insertions, 5 deletions
diff --git a/sql/field.cc b/sql/field.cc
index a5eca021695..782b35c5941 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4254,15 +4254,30 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
void Field_enum::store(const char *from,uint length)
{
uint tmp=find_enum(typelib,from,length);
+ if (!tmp)
{
- if (!tmp)
+ if (length < 6) // Can't be more than 99999 enums
{
- current_thd->cuted_fields++;
- Field_enum::store_type((longlong) 0);
+ /* This is for reading numbers with LOAD DATA INFILE */
+ char buff[7], *end;
+ const char *conv=from;
+ if (from[length])
+ {
+ strmake(buff, from, length);
+ conv=buff;
+ }
+ my_errno=0;
+ tmp=strtoul(conv,&end,10);
+ if (my_errno || end != conv+length || tmp > typelib->count)
+ {
+ tmp=0;
+ current_thd->cuted_fields++;
+ }
}
else
- store_type((ulonglong) tmp);
+ current_thd->cuted_fields++;
}
+ store_type((ulonglong) tmp);
}
@@ -4430,7 +4445,26 @@ ulonglong find_set(TYPELIB *lib,const char *x,uint length)
void Field_set::store(const char *from,uint length)
{
- store_type(find_set(typelib,from,length));
+ ulonglong tmp=find_set(typelib,from,length);
+ if (!tmp && length && length < 22)
+ {
+ /* This is for reading numbers with LOAD DATA INFILE */
+ char buff[22], *end;
+ const char *conv=from;
+ if (from[length])
+ {
+ strmake(buff, from, length);
+ conv=buff;
+ }
+ my_errno=0;
+ tmp=strtoull(conv,&end,10);
+ if (my_errno || end != conv+length ||
+ tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
+ tmp=0;
+ else
+ current_thd->cuted_fields--; // Remove warning from find_set
+ }
+ store_type(tmp);
}