diff options
| author | Gerhard Häring <gh@ghaering.de> | 2008-05-04 13:42:44 +0000 |
|---|---|---|
| committer | Gerhard Häring <gh@ghaering.de> | 2008-05-04 13:42:44 +0000 |
| commit | e11c9b3dfd5a17eb4dba21dcc54e4ad0e79a8c87 (patch) | |
| tree | 17c25cc209f253b90514355d5f9f4c3751daea11 /Modules/_sqlite | |
| parent | 5a366c3b8bf1e8afb2d48a02b498f2eaab812c49 (diff) | |
| download | cpython-git-e11c9b3dfd5a17eb4dba21dcc54e4ad0e79a8c87.tar.gz | |
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
Diffstat (limited to 'Modules/_sqlite')
| -rw-r--r-- | Modules/_sqlite/cursor.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 2681fc79f5..308823c50d 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -202,7 +202,11 @@ int pysqlite_build_row_cast_map(pysqlite_Cursor* self) decltype = sqlite3_column_decltype(self->statement->st, i); if (decltype) { for (pos = decltype;;pos++) { - if (*pos == ' ' || *pos == 0) { + /* Converter names are split at '(' and blanks. + * This allows 'INTEGER NOT NULL' to be treated as 'INTEGER' and + * 'NUMBER(10)' to be treated as 'NUMBER', for example. + * In other words, it will work as people expect it to work.*/ + if (*pos == ' ' || *pos == '(' || *pos == 0) { py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; |
