Date: Thursday, January 12, 2006 @ 17:21:58
Author: csaba
Path: /cvsroot/carob/libmysequoia/src
Modified: Utils.cpp (1.14 -> 1.15)
Update the bind->error only when it's necessary :-)
-----------+
Utils.cpp | 24 ++++--------------------
1 files changed, 4 insertions(+), 20 deletions(-)
Index: libmysequoia/src/Utils.cpp
diff -u libmysequoia/src/Utils.cpp:1.14 libmysequoia/src/Utils.cpp:1.15
--- libmysequoia/src/Utils.cpp:1.14 Thu Jan 12 17:04:47 2006
+++ libmysequoia/src/Utils.cpp Thu Jan 12 17:21:58 2006
@@ -242,14 +242,12 @@
void getFromTiny(MYSQL_BIND *bind, MYSQL_FIELD *field, void *data)
{
bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
-
- *bind->error = bind->is_unsigned != is_unsigned;
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
*(unsigned char *)bind->buffer = is_unsigned ? *(unsigned char *)data :
*(char *)data;
- *bind->error = *bind->error && *(unsigned char *)data > SCHAR_MAX;
+ *bind->error = bind->is_unsigned != is_unsigned && *(unsigned char
*)data > SCHAR_MAX;
break;
case MYSQL_TYPE_SHORT:
@@ -293,8 +291,6 @@
{
bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
- *bind->error = bind->is_unsigned != is_unsigned;
-
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
@@ -302,7 +298,7 @@
case MYSQL_TYPE_SHORT:
*(unsigned short int *)bind->buffer = is_unsigned ? *(unsigned short int
*)data : *(short int *)data;
- *bind->error = *bind->error && *(unsigned short int *)data > SHRT_MAX;
+ *bind->error = bind->is_unsigned != is_unsigned && *(unsigned short int
*)data > SHRT_MAX;
break;
case MYSQL_TYPE_LONG:
@@ -342,8 +338,6 @@
{
bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
- *bind->error = bind->is_unsigned != is_unsigned;
-
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
@@ -354,7 +348,7 @@
case MYSQL_TYPE_LONG:
*(unsigned int *)bind->buffer = is_unsigned ? *(unsigned int *)data :
*(int *)data;
- *bind->error = *bind->error && *(unsigned int *)data > INT_MAX;
+ *bind->error = bind->is_unsigned != is_unsigned && *(unsigned int *)data
> INT_MAX;
break;
case MYSQL_TYPE_LONGLONG:
@@ -390,8 +384,6 @@
{
bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
- *bind->error = bind->is_unsigned != is_unsigned;
-
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
@@ -405,7 +397,7 @@
case MYSQL_TYPE_LONGLONG:
*(unsigned long long int *)bind->buffer = is_unsigned ? *(unsigned long
long int *)data : *(long long int *)data;
- *bind->error = *bind->error && *(unsigned long long int *)data >
LONG_MAX;
+ *bind->error = bind->is_unsigned != is_unsigned && *(unsigned long long
int *)data > LONG_MAX;
break;
case MYSQL_TYPE_FLOAT:
@@ -435,10 +427,6 @@
void getFromFloat(MYSQL_BIND *bind, MYSQL_FIELD *field, void *data)
{
- bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
-
- *bind->error = bind->is_unsigned != is_unsigned;
-
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
@@ -480,10 +468,6 @@
void getFromDouble(MYSQL_BIND *bind, MYSQL_FIELD *field, void *data)
{
- bool is_unsigned = (field->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG;
-
- *bind->error = bind->is_unsigned != is_unsigned;
-
switch (bind->buffer_type)
{
case MYSQL_TYPE_TINY:
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits