You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Merge branch '3.3' into 3.4
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include "mysql.h"
|
||||
#include <math.h> /* ceil() */
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <malloc.h>
|
||||
@@ -1145,29 +1146,25 @@ void ps_fetch_datetime(MYSQL_BIND *r_param, const MYSQL_FIELD * field,
|
||||
length= sprintf(dtbuffer, "%04u-%02u-%02u", tm.year, tm.month, tm.day);
|
||||
break;
|
||||
case MYSQL_TYPE_TIME:
|
||||
length= sprintf(dtbuffer, "%s%02u:%02u:%02u", (tm.neg ? "-" : ""), tm.hour, tm.minute, tm.second);
|
||||
if (field->decimals && field->decimals <= 6)
|
||||
if (field->decimals && (field->decimals <= SEC_PART_DIGITS ||
|
||||
(field->decimals == AUTO_SEC_PART_DIGITS && tm.second_part)))
|
||||
{
|
||||
char ms[8];
|
||||
sprintf(ms, ".%06lu", tm.second_part);
|
||||
if (field->decimals < 6)
|
||||
ms[field->decimals + 1]= 0;
|
||||
length+= strlen(ms);
|
||||
strcat(dtbuffer, ms);
|
||||
}
|
||||
uint8_t decimals= (field->decimals == AUTO_SEC_PART_DIGITS) ? SEC_PART_DIGITS : field->decimals;
|
||||
length= sprintf(dtbuffer, "%s%02u:%02u:%02u.%0*u", (tm.neg ? "-" : ""), tm.hour, tm.minute, tm.second,
|
||||
decimals, (uint32_t)(tm.second_part / pow(10, 6 - decimals)));
|
||||
} else
|
||||
length= sprintf(dtbuffer, "%s%02u:%02u:%02u", (tm.neg ? "-" : ""), tm.hour, tm.minute, tm.second);
|
||||
break;
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
length= sprintf(dtbuffer, "%04u-%02u-%02u %02u:%02u:%02u", tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
|
||||
if (field->decimals && field->decimals <= 6)
|
||||
if (field->decimals && (field->decimals <= SEC_PART_DIGITS ||
|
||||
(field->decimals == AUTO_SEC_PART_DIGITS && tm.second_part)))
|
||||
{
|
||||
char ms[8];
|
||||
sprintf(ms, ".%06lu", tm.second_part);
|
||||
if (field->decimals < 6)
|
||||
ms[field->decimals + 1]= 0;
|
||||
length+= strlen(ms);
|
||||
strcat(dtbuffer, ms);
|
||||
}
|
||||
uint8_t decimals= (field->decimals == AUTO_SEC_PART_DIGITS) ? SEC_PART_DIGITS : field->decimals;
|
||||
length= sprintf(dtbuffer, "%04u-%02u-%02u %02u:%02u:%02u.%0*u", tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second,
|
||||
decimals, (uint32_t)(tm.second_part / pow(10, 6 - decimals)));
|
||||
} else
|
||||
length= sprintf(dtbuffer, "%04u-%02u-%02u %02u:%02u:%02u", tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
|
||||
break;
|
||||
default:
|
||||
dtbuffer[0]= 0;
|
||||
|
@@ -2054,6 +2054,12 @@ error:
|
||||
if (!(client_flag & CLIENT_REMEMBER_OPTIONS) &&
|
||||
!(IS_MYSQL_ASYNC(mysql)))
|
||||
mysql_close_options(mysql);
|
||||
|
||||
/* CONC-703: If no error was set, we set CR_SERVER_LOST by default */
|
||||
if (!mysql_errno(mysql))
|
||||
my_set_error(mysql, CR_SERVER_LOST, SQLSTATE_UNKNOWN,
|
||||
"Can't connect to server (%d).",
|
||||
errno);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@@ -2543,6 +2543,8 @@ int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt)
|
||||
stmt->upsert_status.server_status= stmt->mysql->server_status;
|
||||
ma_status_callback(stmt->mysql, last_status);
|
||||
stmt->upsert_status.warning_count= stmt->mysql->warning_count;
|
||||
if (!mysql_stmt_more_results(stmt))
|
||||
stmt->state= MYSQL_STMT_FETCH_DONE;
|
||||
}
|
||||
|
||||
stmt->field_count= stmt->mysql->field_count;
|
||||
|
Reference in New Issue
Block a user