summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/cextension
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-22 18:41:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-22 18:41:46 -0400
commit8f5a31441aed9d223e67d211472445e574fc521f (patch)
tree5f95780d99cf6c77ffd569d34d709514fa98263c /lib/sqlalchemy/cextension
parent477dd0f774f1c2f2f3873924ac0606bf499e0061 (diff)
downloadsqlalchemy-8f5a31441aed9d223e67d211472445e574fc521f.tar.gz
- [bug] Fixed cextension bug whereby the
"ambiguous column error" would fail to function properly if the given index were a Column object and not a string. Note there are still some column-targeting issues here which are fixed in 0.8. [ticket:2553] - find more cases where column targeting is being inaccurate, add more information to result_map to better differentiate "ambiguous" results from "present" or "not present". In particular, result_map is sensitive to dupes, even though no error is raised; the conflicting columns are added to the "obj" member of the tuple so that the two are both directly accessible in the result proxy - handwringing over the damn "name fallback" thing in results. can't really make it perfect yet - fix up oracle returning clause. not sure why its guarding against labels, remove that for now and see what the bot says.
Diffstat (limited to 'lib/sqlalchemy/cextension')
-rw-r--r--lib/sqlalchemy/cextension/resultproxy.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/sqlalchemy/cextension/resultproxy.c b/lib/sqlalchemy/cextension/resultproxy.c
index 8c89baa25..76c785f85 100644
--- a/lib/sqlalchemy/cextension/resultproxy.c
+++ b/lib/sqlalchemy/cextension/resultproxy.c
@@ -244,7 +244,7 @@ BaseRowProxy_subscript(BaseRowProxy *self, PyObject *key)
PyObject *processors, *values;
PyObject *processor, *value, *processed_value;
PyObject *row, *record, *result, *indexobject;
- PyObject *exc_module, *exception;
+ PyObject *exc_module, *exception, *cstr_obj;
char *cstr_key;
long index;
int key_fallback = 0;
@@ -301,9 +301,16 @@ BaseRowProxy_subscript(BaseRowProxy *self, PyObject *key)
if (exception == NULL)
return NULL;
- cstr_key = PyString_AsString(key);
- if (cstr_key == NULL)
+ // wow. this seems quite excessive.
+ cstr_obj = PyObject_Str(key);
+ if (cstr_obj == NULL)
return NULL;
+ cstr_key = PyString_AsString(cstr_obj);
+ if (cstr_key == NULL) {
+ Py_DECREF(cstr_obj);
+ return NULL;
+ }
+ Py_DECREF(cstr_obj);
PyErr_Format(exception,
"Ambiguous column name '%.200s' in result set! "