summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-03-21 15:18:52 +0400
committerunknown <bar@bar.mysql.r18.ru>2003-03-21 15:18:52 +0400
commit0148b062c7ef33f6fa155b838ba1b25c37004841 (patch)
tree5280bb31238ad54a66021579da84445dab7fbe68 /sql/protocol.cc
parent74f46acedfbc5c122024adc70cb0c02f6b8e2b9f (diff)
downloadmariadb-git-0148b062c7ef33f6fa155b838ba1b25c37004841.tar.gz
New variable to turn off automatic charset conversion of query results
Some speed improvements
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index af8f966a4b6..2d53d545066 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -703,11 +703,13 @@ bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
field_pos++;
#endif
- if (cs != this->thd->charset())
+ if (!my_charset_same(cs, this->thd->charset()) &&
+ (cs != &my_charset_bin) &&
+ (this->thd->charset() != &my_charset_bin) &&
+ (this->thd->variables.convert_result_charset))
{
- String tmp;
- tmp.copy(from, length, cs, this->thd->charset());
- return net_store_data(tmp.ptr(), tmp.length());
+ convert.copy(from, length, cs, this->thd->charset());
+ return net_store_data(convert.ptr(), convert.length());
}
else
return net_store_data(from, length);
@@ -800,16 +802,18 @@ bool Protocol_simple::store(Field *field)
field_pos++;
#endif
char buff[MAX_FIELD_WIDTH];
- String tmp1(buff,sizeof(buff), &my_charset_bin);
- field->val_str(&tmp1,&tmp1);
- if (field->charset() != this->thd->charset())
+ String str(buff,sizeof(buff), &my_charset_bin);
+ field->val_str(&str,&str);
+ if (!my_charset_same(field->charset(), this->thd->charset()) &&
+ (field->charset() != &my_charset_bin) &&
+ (this->thd->charset() != &my_charset_bin) &&
+ (this->thd->variables.convert_result_charset))
{
- String tmp;
- tmp.copy(tmp1.ptr(), tmp1.length(), tmp1.charset(), this->thd->charset());
- return net_store_data(tmp.ptr(), tmp.length());
+ convert.copy(str.ptr(), str.length(), str.charset(), this->thd->charset());
+ return net_store_data(convert.ptr(), convert.length());
}
else
- return net_store_data(tmp1.ptr(), tmp1.length());
+ return net_store_data(str.ptr(), str.length());
}