summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-08-19 16:00:12 +0300
committerunknown <monty@mashka.mysql.fi>2003-08-19 16:00:12 +0300
commitaa900a5ecee00b40e5add6c88805587a850b057a (patch)
tree7e42515465680bf9479f44de0c710044aa122610 /sql/table.cc
parent755e72a0f55b593cf930ae9bd69998f82b70d5cf (diff)
downloadmariadb-git-aa900a5ecee00b40e5add6c88805587a850b057a.tar.gz
After merge fixes + bugs from last merge
mysql-test/mysql-test-run.sh: Use --skip-bdb with valgrind (as bdb tables causes valgrind to hang) Fix --ddd option mysql-test/t/union.test: After merge fix sql/item.cc: Fixed typo sql/log_event.cc: Move current_tablenr to open_tables() sql/protocol.h: Fixed wrong memory reference sql/set_var.cc: After merge fix sql/slave.cc: Reset thd->lex.current_select before execute sql/sql_base.cc: Move current_tablenr to open_tables() sql/sql_class.cc: Move current_tablenr to open_tables() Add missing update_charset() sql/sql_parse.cc: Move current_tablenr to open_tables() Simple cleanup sql/table.cc: Code cleanup
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/sql/table.cc b/sql/table.cc
index a76bdc84690..9d12de1f6c7 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1173,23 +1173,25 @@ rename_file_ext(const char * from,const char * to,const char * ext)
res result String
RETURN VALUES
- true string is empty
- false all ok
+ 1 string is empty
+ 0 all ok
*/
bool get_field(MEM_ROOT *mem, Field *field, String *res)
{
- char buff[MAX_FIELD_WIDTH];
+ char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
+ uint length;
+
field->val_str(&str,&str);
- uint length=str.length();
- if (!length)
- return true;
- char *to= strmake_root(mem, str.ptr(), length);
- res->set(to,length,((Field_str*)field)->charset());
- return false;
+ if (!(length= str.length()))
+ return 1;
+ to= strmake_root(mem, str.ptr(), length);
+ res->set(to, length, ((Field_str*)field)->charset());
+ return 0;
}
+
/*
Allocate string field in MEM_ROOT and return it as NULL-terminated string
@@ -1205,14 +1207,15 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
char *get_field(MEM_ROOT *mem, Field *field)
{
- char buff[MAX_FIELD_WIDTH];
+ char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
+ uint length;
+
field->val_str(&str,&str);
- uint length=str.length();
- if (!length)
+ if (!(length= str.length()))
return NullS;
- char *to= (char*) alloc_root(mem,length+1);
- memcpy(to,str.ptr(),(uint) length);
+ to= (char*) alloc_root(mem,length+1);
+ memcpy(to, str.ptr(), (uint) length);
to[length]=0;
return to;
}