Check for issue #2. No problem... Fixes #2

This commit is contained in:
Maas-Maarten Zeeman
2013-01-01 14:42:43 +01:00
parent d5cb6b103d
commit ec04d67632
4 changed files with 49 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011, 2012 Maas-Maarten Zeeman
* Copyright 2011, 2012, 2013 Maas-Maarten Zeeman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -326,8 +326,8 @@ bind_cell(ErlNifEnv *env, const ERL_NIF_TERM cell, sqlite3_stmt *stmt, unsigned
}
if(enif_inspect_iolist_as_binary(env, cell, &the_blob)) {
/* Bind lists which have the same length as the binary as text */
if(enif_is_list(env, cell) && (strlen((char *) the_blob.data) == the_blob.size)) {
/* Bind lists which have the same length as the binary as text. */
if(enif_is_list(env, cell) && (strnlen((char *) the_blob.data, the_blob.size) == the_blob.size)) {
return sqlite3_bind_text(stmt, i, (char *) the_blob.data, the_blob.size, SQLITE_TRANSIENT);
}