summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-02-12 23:18:00 +0200
committerunknown <monty@mashka.mysql.fi>2003-02-12 23:18:00 +0200
commit86ec3c8f085c65b9ac2ef8776cad956465abddd7 (patch)
tree924512c54bd3a6090a69986d62adfd8be7ce1fdd /libmysql
parent0a10f78f1245fef3b2a3f5ca9a413ab830ea088e (diff)
parentc5040dddee0e84076ec7860a9e8ce5df0ced581d (diff)
downloadmariadb-git-86ec3c8f085c65b9ac2ef8776cad956465abddd7.tar.gz
Merge work:/home/bk/mysql-4.1 into mashka.mysql.fi:/home/my/mysql-4.1
libmysql/libmysql.c: Auto merged scripts/mysqld_safe.sh: Auto merged sql/field.cc: Auto merged sql/lex.h: Auto merged sql/sql_derived.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 53c97aff27b..fe435616532 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2084,7 +2084,7 @@ Try also with PIPE or TCP/IP
}
sock_addr.sin_port = (ushort) htons((ushort) port);
if (my_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
- mysql->options.connect_timeout) <0)
+ mysql->options.connect_timeout))
{
DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,host));
net->last_errno= CR_CONN_HOST_ERROR;
@@ -4043,6 +4043,7 @@ unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
field->org_table= strdup_root(alloc,fields->org_table);
field->name = strdup_root(alloc,fields->name);
field->org_name = strdup_root(alloc,fields->org_name);
+ field->charsetnr= fields->charsetnr;
field->length = fields->length;
field->type = fields->type;
field->flags = fields->flags;
@@ -4767,13 +4768,13 @@ static void send_data_long(MYSQL_BIND *param, longlong value)
*param->buffer= (uchar) value;
break;
case MYSQL_TYPE_SHORT:
- int2store(buffer, (short)value);
+ int2store(buffer, value);
break;
case MYSQL_TYPE_LONG:
- int4store(buffer, (int32)value);
+ int4store(buffer, value);
break;
case MYSQL_TYPE_LONGLONG:
- int8store(buffer, (longlong)value);
+ int8store(buffer, value);
break;
case MYSQL_TYPE_FLOAT:
{
@@ -4810,7 +4811,7 @@ static void send_data_double(MYSQL_BIND *param, double value)
int2store(buffer, (short)value);
break;
case MYSQL_TYPE_LONG:
- int4store(buffer, (int32)value);
+ int4store(buffer, (long)value);
break;
case MYSQL_TYPE_LONGLONG:
int8store(buffer, (longlong)value);
@@ -4947,30 +4948,37 @@ static void send_data_time(MYSQL_BIND *param, MYSQL_TIME ltime,
/* Fetch data to buffers */
-static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row)
+static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row,
+ my_bool field_is_unsigned)
{
ulong length;
switch (field_type) {
case MYSQL_TYPE_TINY:
{
- uchar value= (uchar) **row;
- send_data_long(param,(longlong)value);
+ char value= (char) **row;
+ longlong data= (field_is_unsigned) ? (longlong) (unsigned char) value:
+ (longlong) value;
+ send_data_long(param,data);
length= 1;
break;
}
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_YEAR:
{
- short value= (short)sint2korr(*row);
- send_data_long(param,(longlong)value);
- length= 2;
+ short value= sint2korr(*row);
+ longlong data= (field_is_unsigned) ? (longlong) (unsigned short) value:
+ (longlong) value;
+ send_data_long(param,data);
+ length= 2;
break;
}
case MYSQL_TYPE_LONG:
{
- int32 value= (int32)sint4korr(*row);
- send_data_long(param,(int32)value);
+ long value= sint4korr(*row);
+ longlong data= (field_is_unsigned) ? (longlong) (unsigned long) value:
+ (longlong) value;
+ send_data_long(param,data);
length= 4;
break;
}
@@ -4985,7 +4993,7 @@ static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row)
{
float value;
float4get(value,*row);
- send_data_double(param,(double)value);
+ send_data_double(param,value);
length= 4;
break;
}
@@ -4993,7 +5001,7 @@ static void fetch_results(MYSQL_BIND *param, uint field_type, uchar **row)
{
double value;
float8get(value,*row);
- send_data_double(param,(double)value);
+ send_data_double(param,value);
length= 8;
break;
}
@@ -5241,7 +5249,10 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
if (field->type == bind->buffer_type)
(*bind->fetch_result)(bind, &row);
else
- fetch_results(bind, field->type, &row);
+ {
+ my_bool field_is_unsigned= (field->flags & UNSIGNED_FLAG) ? 1: 0;
+ fetch_results(bind, field->type, &row, field_is_unsigned);
+ }
}
if (! ((bit<<=1) & 255))
{