Skip to content

Commit 51665eb

Browse files
junarugasodabrew
authored andcommitted
Fix wrong value of type YEAR on big endian environment. (#921)
1 parent e9c1e1f commit 51665eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/mysql2/result.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ static void rb_mysql_result_alloc_result_buffers(VALUE self, MYSQL_FIELD *fields
234234
wrapper->result_buffers[i].buffer_length = sizeof(signed char);
235235
break;
236236
case MYSQL_TYPE_SHORT: // short int
237+
case MYSQL_TYPE_YEAR: // short int
237238
wrapper->result_buffers[i].buffer = xcalloc(1, sizeof(short int));
238239
wrapper->result_buffers[i].buffer_length = sizeof(short int);
239240
break;
240241
case MYSQL_TYPE_INT24: // int
241242
case MYSQL_TYPE_LONG: // int
242-
case MYSQL_TYPE_YEAR: // int
243243
wrapper->result_buffers[i].buffer = xcalloc(1, sizeof(int));
244244
wrapper->result_buffers[i].buffer_length = sizeof(int);
245245
break;
@@ -365,6 +365,7 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
365365
}
366366
break;
367367
case MYSQL_TYPE_SHORT: // short int
368+
case MYSQL_TYPE_YEAR: // short int
368369
if (result_buffer->is_unsigned) {
369370
val = UINT2NUM(*((unsigned short int*)result_buffer->buffer));
370371
} else {
@@ -373,7 +374,6 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
373374
break;
374375
case MYSQL_TYPE_INT24: // int
375376
case MYSQL_TYPE_LONG: // int
376-
case MYSQL_TYPE_YEAR: // int
377377
if (result_buffer->is_unsigned) {
378378
val = UINT2NUM(*((unsigned int*)result_buffer->buffer));
379379
} else {

0 commit comments

Comments
 (0)