Skip to content

Commit deecab9

Browse files
author
Jim Flood
committed
Use CLASS_OF cSqlite3Blob too as done in statement.c
1 parent 73344ed commit deecab9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/sqlite3/database.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,25 +322,25 @@ static void set_sqlite3_func_result(sqlite3_context * ctx, VALUE result)
322322
sqlite3_result_double(ctx, NUM2DBL(result));
323323
break;
324324
case T_STRING:
325+
if(CLASS_OF(result) == cSqlite3Blob
325326
#ifdef HAVE_RUBY_ENCODING_H
326-
if (rb_enc_get_index(result) == rb_ascii8bit_encindex()) {
327+
|| rb_enc_get_index(result) == rb_ascii8bit_encindex()
328+
#endif
329+
) {
327330
sqlite3_result_blob(
328331
ctx,
329332
(const void *)StringValuePtr(result),
330333
(int)RSTRING_LEN(result),
331334
SQLITE_TRANSIENT
332335
);
333336
} else {
334-
#endif
335337
sqlite3_result_text(
336338
ctx,
337339
(const char *)StringValuePtr(result),
338340
(int)RSTRING_LEN(result),
339341
SQLITE_TRANSIENT
340342
);
341-
#ifdef HAVE_RUBY_ENCODING_H
342343
}
343-
#endif
344344
break;
345345
default:
346346
rb_raise(rb_eRuntimeError, "can't return %s",

0 commit comments

Comments
 (0)