Skip to content

Commit

Permalink
Fix a compilation issue under OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jul 8, 2017
1 parent f491d4b commit b9798ff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
29 changes: 15 additions & 14 deletions docs/contents/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version 5.0.4 (to be released)
named tuples now works more accurately in Python 2.6 and 3.0.
- Fixed error checks for unlink() and export() methods of large objects
(bug report by Justin Pryzby).
- Fixed a compilation issue under OS X (bug report by Josh Johnston).

Version 5.0.3 (2016-12-10)
--------------------------
Expand Down Expand Up @@ -57,13 +58,13 @@ Version 5.0 (2016-03-20)
- The supported versions are Python 2.6 to 2.7, and 3.3 to 3.5.
- PostgreSQL is supported in all versions from 9.0 to 9.5.
- Changes in the classic PyGreSQL module (pg):
- The classic interface got two new methods get_as_list() and get_as_dict()
returning a database table as a Python list or dict. The amount of data
returned can be controlled with various parameters.
- A method upsert() has been added to the DB wrapper class that utilizes
the "upsert" feature that is new in PostgreSQL 9.5. The new method nicely
complements the existing get/insert/update/delete() methods.
- When using insert/update/upsert(), you can now pass PostgreSQL arrays as
- The classic interface got two new methods get_as_list() and get_as_dict()
returning a database table as a Python list or dict. The amount of data
returned can be controlled with various parameters.
- A method upsert() has been added to the DB wrapper class that utilizes
the "upsert" feature that is new in PostgreSQL 9.5. The new method nicely
complements the existing get/insert/update/delete() methods.
- When using insert/update/upsert(), you can now pass PostgreSQL arrays as
lists and PostgreSQL records as tuples in the classic module.
- Conversely, when the query method returns a PostgreSQL array, it is passed
to Python as a list. PostgreSQL records are converted to named tuples as
Expand Down Expand Up @@ -346,13 +347,13 @@ Improvement of pgdb module:
Major improvements and clean-up in classic pg module:

- All members of the underlying connection directly available in `DB`
- Fixes to quoting function
- Add checks for valid database connection to methods
- Improved namespace support, handle `search_path` correctly
- Removed old dust and unnecessary imports, added docstrings
- Internal sql statements as one-liners, smoothed out ugly code

Version 3.6.2 (2005-02-23)
- Fixes to quoting function
- Add checks for valid database connection to methods
- Improved namespace support, handle `search_path` correctly
- Removed old dust and unnecessary imports, added docstrings
- Internal sql statements as one-liners, smoothed out ugly code

Version 3.6.2 (2005-02-23)
--------------------------
- Further fixes to namespace handling

Expand Down
24 changes: 14 additions & 10 deletions pgmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3693,9 +3693,6 @@ sourceExecute(sourceObject *self, PyObject *sql)
/* checks result status */
switch (PQresultStatus(self->result))
{
long num_rows;
char *temp;

/* query succeeded */
case PGRES_TUPLES_OK: /* DQL: returns None (DB-SIG compliant) */
self->result_type = RESULT_DQL;
Expand All @@ -3706,15 +3703,22 @@ sourceExecute(sourceObject *self, PyObject *sql)
case PGRES_COMMAND_OK: /* other requests */
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
self->result_type = RESULT_DDL;
temp = PQcmdTuples(self->result);
num_rows = -1;
if (temp[0])
{
self->result_type = RESULT_DML;
num_rows = atol(temp);
long num_rows;
char *temp;
temp = PQcmdTuples(self->result);
if (temp[0])
{
self->result_type = RESULT_DML;
num_rows = atol(temp);
}
else
{
self->result_type = RESULT_DDL;
num_rows = -1;
}
return PyInt_FromLong(num_rows);
}
return PyInt_FromLong(num_rows);

/* query failed */
case PGRES_EMPTY_QUERY:
Expand Down

0 comments on commit b9798ff

Please sign in to comment.