From eab6ce1fcc0739363c5739c22cd2381cd762590c Mon Sep 17 00:00:00 2001 From: Brian Stubbs Date: Wed, 7 Nov 2012 12:05:13 -0200 Subject: [PATCH 1/2] Allow raw sql in create_table (used for foreign keys). --- src/sqlite3_lib.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sqlite3_lib.erl b/src/sqlite3_lib.erl index bb6b796..dc2addb 100644 --- a/src/sqlite3_lib.erl +++ b/src/sqlite3_lib.erl @@ -349,6 +349,7 @@ constraint_sql(Constraint) -> unique -> "UNIQUE"; not_null -> "NOT NULL"; {default, DefaultValue} -> ["DEFAULT ", value_to_sql(DefaultValue)]; + {raw, S} when is_list(S) -> S; _ when is_list(Constraint) -> map_intersperse(fun constraint_sql/1, Constraint, " ") end. From 7fa65d6712ffb9badcf5c00a927e4ec72d4a32a6 Mon Sep 17 00:00:00 2001 From: Brian Stubbs Date: Wed, 7 Nov 2012 12:24:14 -0200 Subject: [PATCH 2/2] Allocating more memory than required? --- c_src/sqlite3_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_src/sqlite3_drv.c b/c_src/sqlite3_drv.c index a09fbef..a9ac948 100644 --- a/c_src/sqlite3_drv.c +++ b/c_src/sqlite3_drv.c @@ -421,7 +421,7 @@ static int bind_parameters( return output_error(drv, SQLITE_ERROR, "error while binding parameters"); } - acc_string = driver_alloc(sizeof(char*) * (*p_size + 1)); + acc_string = driver_alloc(sizeof(char) * (*p_size + 1)); ei_decode_string(buffer, p_index, acc_string); for (param_index = 1; param_index <= *p_size; param_index++) { sqlite3_bind_int(statement, param_index, (int) (unsigned char) acc_string[param_index - 1]);