@@ -21,7 +21,7 @@ pub fn (db DB) select(config orm.SelectConfig, data orm.QueryData, where orm.Que
21
21
metadata := stmt.gen_metadata ()
22
22
fields := stmt.fetch_fields (metadata)
23
23
num_fields := stmt.get_field_count ()
24
- mut data_pointers := []& u8 {}
24
+ mut data_pointers := []& u8 {cap: int (num_fields) }
25
25
26
26
// Allocate memory for each column.
27
27
for i in 0 .. num_fields {
@@ -71,25 +71,18 @@ pub fn (db DB) select(config orm.SelectConfig, data orm.QueryData, where orm.Que
71
71
field_type := unsafe { FieldType (field.type ) }
72
72
field_types << field_type
73
73
74
- match types[i] {
75
- orm.type_string {
74
+ match field_type {
75
+ .type_string, .type_var_string, .type_blob, .type_tiny_blob, .type_medium_blob,
76
+ .type_long_blob {
76
77
string_binds_map[i] = mysql_bind
77
78
}
78
- orm.time_ {
79
- match field_type {
80
- .type_long {
81
- mysql_bind.buffer_type = C.MYSQL_TYPE_LONG
82
- }
83
- .type_time, .type_date, .type_datetime, .type_timestamp {
84
- // FIXME: Allocate memory for blobs dynamically.
85
- mysql_bind.buffer_type = C.MYSQL_TYPE_BLOB
86
- mysql_bind.buffer_length = FieldType.type_blob.get_len ()
87
- }
88
- .type_string, .type_blob {}
89
- else {
90
- return error ('Unknown type ${field.type} ' )
91
- }
92
- }
79
+ .type_long {
80
+ mysql_bind.buffer_type = C.MYSQL_TYPE_LONG
81
+ }
82
+ .type_time, .type_date, .type_datetime, .type_timestamp {
83
+ // FIXME: Allocate memory for blobs dynamically.
84
+ mysql_bind.buffer_type = C.MYSQL_TYPE_BLOB
85
+ mysql_bind.buffer_length = FieldType.type_blob.get_len ()
93
86
}
94
87
else {}
95
88
}
0 commit comments