diff options
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r-- | Modules/_sqlite/statement.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index fc2b4c4..f89fc9a 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -1,6 +1,6 @@ /* statement.c - the statement type * - * Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> + * Copyright (C) 2005-2010 Gerhard Häring <gh@ghaering.de> * * This file is part of pysqlite. * @@ -130,7 +130,10 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec break; case TYPE_UNICODE: string = _PyUnicode_AsString(parameter); - rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); + if (string != NULL) + rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); + else + rc = -1; break; case TYPE_BUFFER: if (PyObject_AsCharBuffer(parameter, &buffer, &buflen) == 0) { |