summaryrefslogtreecommitdiff
path: root/sql/protocol_cursor.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-08-28 10:32:27 +0400
committerunknown <konstantin@mysql.com>2004-08-28 10:32:27 +0400
commitca37e1c3778cd151bf61339042767a81d8bf2369 (patch)
tree13c65391e577a6f0f6d311a89a844a981c824b95 /sql/protocol_cursor.cc
parentd41092796332f1a9de32c56eeff16dc8e49b69b1 (diff)
downloadmariadb-git-ca37e1c3778cd151bf61339042767a81d8bf2369.tar.gz
Microsoft VC++ won't compile class C { static const int I=1; }.
Putting initialization into .cc will reduce compiler's abilities to optimize this constant away. Defines are not OK as they bloat global namespace. Looking for a way to declare an efficient named constant in reduced namespace (i. e. in a class). Let's try enums: normally they should be implicitly casted to int. Let's see if we really have a compiler which won't do that. libmysqld/lib_sql.cc: Added explicit cast to int for Protocol::{SEND_DEFAULTS,SEND_NUM_ROWS, SEND_EOF} flags argument of send_fields() is now int. sql/protocol.cc: flags argument of send_fields is now int. sql/protocol.h: Catch22: Microsoft VC++ won't compile class C { static const int I=1; }. Putting initialization into .cc will reduce compiler's abilities to optimize this constant away. Defines are not OK as they bloat global namespace. Looking for a way to declare an efficient named constant in reduced namespace (i. e. in a class). Let's try enums: normally they should be implicitly casted to int. Let's see if we really have a compiler which won't do that. sql/protocol_cursor.cc: flags are now int.
Diffstat (limited to 'sql/protocol_cursor.cc')
-rw-r--r--sql/protocol_cursor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc
index d2c99dcaebc..31eaa894045 100644
--- a/sql/protocol_cursor.cc
+++ b/sql/protocol_cursor.cc
@@ -26,7 +26,7 @@
#include "mysql_priv.h"
#include <mysql.h>
-bool Protocol_cursor::send_fields(List<Item> *list, uint flags)
+bool Protocol_cursor::send_fields(List<Item> *list, int flags)
{
List_iterator_fast<Item> it(*list);
Item *item;
@@ -67,7 +67,7 @@ bool Protocol_cursor::send_fields(List<Item> *list, uint flags)
if (INTERNAL_NUM_FIELD(client_field))
client_field->flags|= NUM_FLAG;
- if (flags & Protocol::SEND_DEFAULTS)
+ if (flags & (int) Protocol::SEND_DEFAULTS)
{
char buff[80];
String tmp(buff, sizeof(buff), default_charset_info), *res;