Fixed error in fetchXXX methods

This commit is contained in:
Federico Di Gregorio 2009-05-09 14:28:40 +02:00
parent 06eb574cec
commit 3935c019fe
3 changed files with 17 additions and 9 deletions

View File

@ -1,5 +1,8 @@
2009-05-10 Federico Di Gregorio <fog@initd.org>
* psycopg/cursor_ext.c: now raise correct exception when fetching
using a custom row factory results in an error.
* lib/extras.py: applied DictRow "diet" patch from Marko Kreen.
2009-04-21 Federico Di Gregorio <fog@initd.org>

View File

@ -326,7 +326,7 @@ _psyco_curs_execute(cursorObject *self,
/* Any failure from here forward should 'goto fail' rather than 'return 0'
directly. */
if (operation == NULL) { goto fail; }
IFCLEARPGRES(self->pgres);
@ -425,7 +425,7 @@ _psyco_curs_execute(cursorObject *self,
}
/* At this point, the SQL statement must be str, not unicode */
res = pq_execute(self, PyString_AS_STRING(self->query), async);
Dprintf("psyco_curs_execute: res = %d, pgres = %p", res, self->pgres);
if (res == -1) { goto fail; }
@ -713,8 +713,13 @@ _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res,
PyTuple_SET_ITEM(res, i, val);
}
else {
PySequence_SetItem(res, i, val);
int err = PySequence_SetItem(res, i, val);
Py_DECREF(val);
if (err == -1) {
Py_DECREF(res);
res = NULL;
break;
}
}
}
else {

View File

@ -7,7 +7,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CFD80D18-3EE5-49ED-992A-E6D433BC7641}</ProjectGuid>
<Compiler>
<Compiler ctype="GccCompiler" xmlns="" />
<Compiler ctype="GccCompiler" />
</Compiler>
<Language>C</Language>
<Target>Bin</Target>
@ -17,11 +17,11 @@
<OutputPath>.</OutputPath>
<DefineSymbols>DEBUG MONODEVELOP</DefineSymbols>
<CodeGeneration>
<CodeGeneration ctype="CCompilationParameters" xmlns="" />
<CodeGeneration ctype="CCompilationParameters" />
</CodeGeneration>
<CompileTarget>Bin</CompileTarget>
<CustomCommands>
<CustomCommands xmlns="">
<CustomCommands>
<Command type="Build" command="/usr/bin/python setup.py build" workingdir="${ProjectDir}" />
<Command type="Clean" command="/usr/bin/python setup.py clean -a" workingdir="${ProjectDir}" />
</CustomCommands>
@ -32,7 +32,7 @@
<OutputPath>bin\Release</OutputPath>
<DefineSymbols>MONODEVELOP</DefineSymbols>
<CodeGeneration>
<CodeGeneration ctype="CCompilationParameters" xmlns="" />
<CodeGeneration ctype="CCompilationParameters" />
</CodeGeneration>
<OptimizationLevel>3</OptimizationLevel>
<OutputName>psycopg2</OutputName>
@ -170,12 +170,12 @@
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties xmlns="">
<Properties>
<Policies>
<ChangeLogPolicy UpdateMode="Nearest" VcsIntegration="None" inheritsSet="Mono">
<MessageStyle FileSeparator=", " LineAlign="0" />
</ChangeLogPolicy>
<TextStylePolicy FileWidth="120" TabWidth="4" TabsToSpaces="False" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Native" />
<TextStylePolicy FileWidth="144" TabWidth="4" TabsToSpaces="True" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Native" />
</Policies>
</Properties>
</MonoDevelop>