diff options
author | Guido van Rossum <guido@python.org> | 2007-10-08 02:46:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-10-08 02:46:15 (GMT) |
commit | bae07c9baf3e53164de6f85a18ce747a76b9ffde (patch) | |
tree | e0bf84063848730026bea64461fe3920dbe8ecb8 /Modules/_sqlite/statement.c | |
parent | 85c1ba5d742779eec3148377ce6d8d359d318263 (diff) | |
download | cpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.zip cpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.tar.gz cpython-bae07c9baf3e53164de6f85a18ce747a76b9ffde.tar.bz2 |
Breaking ground for PEP 3137 implementation:
Get rid of buffer(). Use memoryview() in its place where possible.
In a few places, do things a bit different, because memoryview()
can't slice (yet).
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r-- | Modules/_sqlite/statement.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index b1a4e76..9080c9b 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -102,13 +102,6 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec #endif } else if (PyFloat_Check(parameter)) { rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); - } else if (PyBuffer_Check(parameter)) { - if (PyObject_AsCharBuffer(parameter, &buffer, &buflen) == 0) { - rc = sqlite3_bind_blob(self->st, pos, buffer, buflen, SQLITE_TRANSIENT); - } else { - PyErr_SetString(PyExc_ValueError, "could not convert BLOB to buffer"); - rc = -1; - } } else if PyString_Check(parameter) { string = PyString_AsString(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); @@ -118,6 +111,13 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); + } else if (PyObject_CheckBuffer(parameter)) { + if (PyObject_AsCharBuffer(parameter, &buffer, &buflen) == 0) { + rc = sqlite3_bind_blob(self->st, pos, buffer, buflen, SQLITE_TRANSIENT); + } else { + PyErr_SetString(PyExc_ValueError, "could not convert BLOB to buffer"); + rc = -1; + } } else { rc = -1; } |