From dce4b8a89d090228f5145a36c66a272e897c82df Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Mon, 24 Jan 2022 07:34:30 +0100 Subject: [PATCH] Fix/replacement for PR 107: Instead of calculating size with packlen for date/time types, we need to use the max. value of the corresponding type. --- libmariadb/mariadb_stmt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c index 0ecf701c..fe24af5e 100644 --- a/libmariadb/mariadb_stmt.c +++ b/libmariadb/mariadb_stmt.c @@ -808,6 +808,16 @@ unsigned char* mysql_stmt_execute_generate_simple_request(MYSQL_STMT *stmt, size size+= 9; /* max 8 bytes for size */ size+= (size_t)ma_get_length(stmt, i, 0); break; + case MYSQL_TYPE_TIME: + size+= MAX_TIME_STR_LEN; + break; + case MYSQL_TYPE_DATE: + size+= MAX_DATE_STR_LEN; + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + size+= MAX_DATETIME_STR_LEN; + break; default: size+= mysql_ps_fetch_functions[stmt->params[i].buffer_type].pack_len; break;