Skip to content

Commit 18820d1

Browse files
committed
Use mysql types to avoid conversions
1 parent 6d231ce commit 18820d1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ext/mysql2/result.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#include <mysql2_ext.h>
22

3-
#include <stdint.h>
4-
5-
#ifdef HAVE_RUBY_ENCODING_H
63
#include "mysql_enc_to_ruby.h"
74

5+
#ifdef HAVE_RUBY_ENCODING_H
86
static rb_encoding *binaryEncoding;
97
#endif
108

@@ -764,7 +762,7 @@ static VALUE rb_mysql_result_fetch_fields(VALUE self) {
764762
wrapper->fields = rb_ary_new2(wrapper->numberOfFields);
765763
}
766764

767-
if ((unsigned)RARRAY_LEN(wrapper->fields) != wrapper->numberOfFields) {
765+
if ((my_ulonglong)RARRAY_LEN(wrapper->fields) != wrapper->numberOfFields) {
768766
for (i=0; i<wrapper->numberOfFields; i++) {
769767
rb_mysql_result_fetch_field(self, i, symbolizeKeys);
770768
}

ext/mysql2/result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ typedef struct {
1010
VALUE client;
1111
VALUE encoding;
1212
VALUE statement;
13-
unsigned int numberOfFields;
14-
unsigned long numberOfRows;
13+
my_ulonglong numberOfFields;
14+
my_ulonglong numberOfRows;
1515
unsigned long lastRowProcessed;
1616
char is_streaming;
1717
char streamingComplete;

0 commit comments

Comments
 (0)