mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 09:47:30 +03:00 
			
		
		
		
	Fix multiple misspellings
Conflicts: NEWS doc/src/usage.rst psycopg/pqpath.c setup.cfg
This commit is contained in:
		
							parent
							
								
									802381358a
								
							
						
					
					
						commit
						5a74117118
					
				
							
								
								
									
										2
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								INSTALL
									
									
									
									
									
								
							| 
						 | 
					@ -93,7 +93,7 @@ You can compile psycopg under Windows platform with mingw32
 | 
				
			||||||
Dev-C++ (http://www.bloodshed.net/devcpp.html) and Code::Blocks
 | 
					Dev-C++ (http://www.bloodshed.net/devcpp.html) and Code::Blocks
 | 
				
			||||||
(http://www.codeblocks.org). gcc binaries should be in your PATH.
 | 
					(http://www.codeblocks.org). gcc binaries should be in your PATH.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need a PostgreSQL with include and libary files installed. At least v8.0
 | 
					You need a PostgreSQL with include and library files installed. At least v8.0
 | 
				
			||||||
is required.
 | 
					is required.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
First you need to create a libpython2X.a as described in
 | 
					First you need to create a libpython2X.a as described in
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								NEWS
									
									
									
									
									
								
							| 
						 | 
					@ -151,7 +151,7 @@ What's new in psycopg 2.4
 | 
				
			||||||
      ISO885916, LATIN10, SHIFT_JIS_2004.
 | 
					      ISO885916, LATIN10, SHIFT_JIS_2004.
 | 
				
			||||||
    - Dropped repeated dictionary lookups with unicode query/parameters.
 | 
					    - Dropped repeated dictionary lookups with unicode query/parameters.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - Improvements to the named cusors:
 | 
					  - Improvements to the named cursors:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - More efficient iteration on named cursors, fetching 'itersize'
 | 
					    - More efficient iteration on named cursors, fetching 'itersize'
 | 
				
			||||||
      records at time from the backend.
 | 
					      records at time from the backend.
 | 
				
			||||||
| 
						 | 
					@ -214,7 +214,7 @@ psycopg 2.3 aims to expose some new features introduced in PostgreSQL 9.0.
 | 
				
			||||||
  - `dict` to `hstore` adapter and `hstore` to `dict` typecaster, using both
 | 
					  - `dict` to `hstore` adapter and `hstore` to `dict` typecaster, using both
 | 
				
			||||||
    9.0 and pre-9.0 syntax.
 | 
					    9.0 and pre-9.0 syntax.
 | 
				
			||||||
  - Two-phase commit protocol support as per DBAPI specification.
 | 
					  - Two-phase commit protocol support as per DBAPI specification.
 | 
				
			||||||
  - Support for payload in notifications received from the backed.
 | 
					  - Support for payload in notifications received from the backend.
 | 
				
			||||||
  - `namedtuple`-returning cursor.
 | 
					  - `namedtuple`-returning cursor.
 | 
				
			||||||
  - Query execution cancel.
 | 
					  - Query execution cancel.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -254,7 +254,7 @@ What's new in psycopg 2.2.2
 | 
				
			||||||
    The old register_tstz_w_secs() function is deprecated and will raise a
 | 
					    The old register_tstz_w_secs() function is deprecated and will raise a
 | 
				
			||||||
    warning if called.
 | 
					    warning if called.
 | 
				
			||||||
  - Exceptions raised by the column iterator are propagated.
 | 
					  - Exceptions raised by the column iterator are propagated.
 | 
				
			||||||
  - Exceptions raised by executemany() interators are propagated.
 | 
					  - Exceptions raised by executemany() iterators are propagated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
What's new in psycopg 2.2.1
 | 
					What's new in psycopg 2.2.1
 | 
				
			||||||
| 
						 | 
					@ -363,7 +363,7 @@ What's new in psycopg 2.0.11
 | 
				
			||||||
    go back to old memory usage.
 | 
					    go back to old memory usage.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Bug fixes:
 | 
					* Bug fixes:
 | 
				
			||||||
  - Fixed exeception in setup.py.
 | 
					  - Fixed exception in setup.py.
 | 
				
			||||||
  - More robust detection of PostgreSQL development versions.
 | 
					  - More robust detection of PostgreSQL development versions.
 | 
				
			||||||
  - Fixed exception in RealDictCursor, introduced in 2.0.10.
 | 
					  - Fixed exception in RealDictCursor, introduced in 2.0.10.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -727,7 +727,7 @@ What's new in psycopg 1.99.11
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* changed 'tuple_factory' cursor attribute name to 'row_factory'.
 | 
					* changed 'tuple_factory' cursor attribute name to 'row_factory'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* the .cursor attribute is gone and connections and cursors are propely
 | 
					* the .cursor attribute is gone and connections and cursors are properly
 | 
				
			||||||
  gc-managed.
 | 
					  gc-managed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* fixes to the async core.
 | 
					* fixes to the async core.
 | 
				
			||||||
| 
						 | 
					@ -780,7 +780,7 @@ What's new in psycopg 1.99.8
 | 
				
			||||||
  select() calls.
 | 
					  select() calls.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* .copy_from() and .copy_in() methods are back in (still using the old
 | 
					* .copy_from() and .copy_in() methods are back in (still using the old
 | 
				
			||||||
  protocol, will be updated to use new one in next releasae.)
 | 
					  protocol, will be updated to use new one in next release.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* fixed memory corruption bug reported on win32 platform.
 | 
					* fixed memory corruption bug reported on win32 platform.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@ Date: 	23 Oct 2001 09:53:11 +0600
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We use psycopg and psycopg zope adapter since fisrt public
 | 
					We use psycopg and psycopg zope adapter since fisrt public
 | 
				
			||||||
release (it seems version 0.4). Now it works on 3 our sites and in intranet
 | 
					release (it seems version 0.4). Now it works on 3 our sites and in intranet
 | 
				
			||||||
applications. We had few problems, but all problems were quckly
 | 
					applications. We had few problems, but all problems were quickly
 | 
				
			||||||
solved. The strong side of psycopg is that it's code is well organized
 | 
					solved. The strong side of psycopg is that it's code is well organized
 | 
				
			||||||
and easy to understand. When I found a problem with non-ISO datestyle in first
 | 
					and easy to understand. When I found a problem with non-ISO datestyle in first
 | 
				
			||||||
version of psycopg, it took for me 15 or 20 minutes to learn code and
 | 
					version of psycopg, it took for me 15 or 20 minutes to learn code and
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -255,7 +255,7 @@ Cursor Objects
 | 
				
			||||||
            display_size, internal_size, precision, scale,
 | 
					            display_size, internal_size, precision, scale,
 | 
				
			||||||
            null_ok). The first two items (name and type_code) are
 | 
					            null_ok). The first two items (name and type_code) are
 | 
				
			||||||
            mandatory, the other five are optional and must be set to
 | 
					            mandatory, the other five are optional and must be set to
 | 
				
			||||||
            None if meaningfull values are not provided.
 | 
					            None if meaningful values are not provided.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            This attribute will be None for operations that
 | 
					            This attribute will be None for operations that
 | 
				
			||||||
            do not return rows or if the cursor has not had an
 | 
					            do not return rows or if the cursor has not had an
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -657,7 +657,7 @@ The ``connection`` class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Return one of the constants defined in :ref:`poll-constants`. If it
 | 
					        Return one of the constants defined in :ref:`poll-constants`. If it
 | 
				
			||||||
        returns `~psycopg2.extensions.POLL_OK` then the connection has been
 | 
					        returns `~psycopg2.extensions.POLL_OK` then the connection has been
 | 
				
			||||||
        estabilished or the query results are available on the client.
 | 
					        established or the query results are available on the client.
 | 
				
			||||||
        Otherwise wait until the file descriptor returned by `fileno()` is
 | 
					        Otherwise wait until the file descriptor returned by `fileno()` is
 | 
				
			||||||
        ready to read or to write, as explained in :ref:`async-support`.
 | 
					        ready to read or to write, as explained in :ref:`async-support`.
 | 
				
			||||||
        `poll()` should be also used by the function installed by
 | 
					        `poll()` should be also used by the function installed by
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@ functionalities defined by the |DBAPI|_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. class:: cursor
 | 
					.. class:: cursor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    It is the class usually returnded by the `connection.cursor()`
 | 
					    It is the class usually returned by the `connection.cursor()`
 | 
				
			||||||
    method. It is exposed by the `extensions` module in order to allow
 | 
					    method. It is exposed by the `extensions` module in order to allow
 | 
				
			||||||
    subclassing to extend its behaviour: the subclass should be passed to the
 | 
					    subclassing to extend its behaviour: the subclass should be passed to the
 | 
				
			||||||
    `!cursor()` method using the `cursor_factory` parameter. See
 | 
					    `!cursor()` method using the `cursor_factory` parameter. See
 | 
				
			||||||
| 
						 | 
					@ -398,7 +398,7 @@ The module exports a few exceptions in addition to the :ref:`standard ones
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (subclasses `~psycopg2.OperationalError`)
 | 
					    (subclasses `~psycopg2.OperationalError`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Error causing transaction rollback (deadlocks, serialisation failures,
 | 
					    Error causing transaction rollback (deadlocks, serialization failures,
 | 
				
			||||||
    etc).  It can be trapped specifically to detect a deadlock.
 | 
					    etc).  It can be trapped specifically to detect a deadlock.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .. versionadded:: 2.0.7
 | 
					    .. versionadded:: 2.0.7
 | 
				
			||||||
| 
						 | 
					@ -486,7 +486,7 @@ set to one of the following constants:
 | 
				
			||||||
    :sql:`SERIALIZABLE` isolation level. This is the strictest transactions
 | 
					    :sql:`SERIALIZABLE` isolation level. This is the strictest transactions
 | 
				
			||||||
    isolation level, equivalent to having the transactions executed serially
 | 
					    isolation level, equivalent to having the transactions executed serially
 | 
				
			||||||
    rather than concurrently. However applications using this level must be
 | 
					    rather than concurrently. However applications using this level must be
 | 
				
			||||||
    prepared to retry reansactions due to serialization failures.
 | 
					    prepared to retry transactions due to serialization failures.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Starting from PostgreSQL 9.1, this mode monitors for conditions which
 | 
					    Starting from PostgreSQL 9.1, this mode monitors for conditions which
 | 
				
			||||||
    could make execution of a concurrent set of serializable transactions
 | 
					    could make execution of a concurrent set of serializable transactions
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ method of a regular `!connection`.
 | 
				
			||||||
Dictionary-like cursor
 | 
					Dictionary-like cursor
 | 
				
			||||||
^^^^^^^^^^^^^^^^^^^^^^
 | 
					^^^^^^^^^^^^^^^^^^^^^^
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The dict cursors allow to access to the retrieved records using an iterface
 | 
					The dict cursors allow to access to the retrieved records using an interface
 | 
				
			||||||
similar to the Python dictionaries instead of the tuples.
 | 
					similar to the Python dictionaries instead of the tuples.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    >>> dict_cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
 | 
					    >>> dict_cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,7 +117,7 @@ Psycopg converts :sql:`decimal`\/\ :sql:`numeric` database types into Python `!D
 | 
				
			||||||
        psycopg2.extensions.register_type(DEC2FLOAT)
 | 
					        psycopg2.extensions.register_type(DEC2FLOAT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    See :ref:`type-casting-from-sql-to-python` to read the relevant
 | 
					    See :ref:`type-casting-from-sql-to-python` to read the relevant
 | 
				
			||||||
    documentation. If you find `!psycopg2.extensions.DECIMAL` not avalable, use
 | 
					    documentation. If you find `!psycopg2.extensions.DECIMAL` not available, use
 | 
				
			||||||
    `!psycopg2._psycopg.DECIMAL` instead.
 | 
					    `!psycopg2._psycopg.DECIMAL` instead.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,7 +79,7 @@ for row in curs.fetchall():
 | 
				
			||||||
    print "done"
 | 
					    print "done"
 | 
				
			||||||
    print "  python type of image data is", type(row[0])
 | 
					    print "  python type of image data is", type(row[0])
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
# this rollback is required because we can't drop a table with a binary cusor
 | 
					# this rollback is required because we can't drop a table with a binary cursor
 | 
				
			||||||
# declared and still open
 | 
					# declared and still open
 | 
				
			||||||
conn.rollback()
 | 
					conn.rollback()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
# encoding.py - show to change client enkoding (and test it works)
 | 
					# encoding.py - show to change client encoding (and test it works)
 | 
				
			||||||
# -*- encoding: utf8 -*-
 | 
					# -*- encoding: utf8 -*-
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (C) 2004-2010 Federico Di Gregorio  <fog@debian.org>
 | 
					# Copyright (C) 2004-2010 Federico Di Gregorio  <fog@debian.org>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,7 +82,7 @@ STATUS_SYNC     = 3  # currently unused
 | 
				
			||||||
STATUS_ASYNC    = 4  # currently unused
 | 
					STATUS_ASYNC    = 4  # currently unused
 | 
				
			||||||
STATUS_PREPARED = 5
 | 
					STATUS_PREPARED = 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This is a usefull mnemonic to check if the connection is in a transaction
 | 
					# This is a useful mnemonic to check if the connection is in a transaction
 | 
				
			||||||
STATUS_IN_TRANSACTION = STATUS_BEGIN
 | 
					STATUS_IN_TRANSACTION = STATUS_BEGIN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""psycopg asynchronous connection polling values"""
 | 
					"""psycopg asynchronous connection polling values"""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
"""Miscellaneous goodies for psycopg2
 | 
					"""Miscellaneous goodies for psycopg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This module is a generic place used to hold little helper functions
 | 
					This module is a generic place used to hold little helper functions
 | 
				
			||||||
and classes untill a better place in the distribution is found.
 | 
					and classes until a better place in the distribution is found.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
# psycopg/extras.py - miscellaneous extra goodies for psycopg
 | 
					# psycopg/extras.py - miscellaneous extra goodies for psycopg
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ class DictCursor(DictCursorBase):
 | 
				
			||||||
            self._query_executed = 0
 | 
					            self._query_executed = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DictRow(list):
 | 
					class DictRow(list):
 | 
				
			||||||
    """A row object that allow by-colmun-name access to data."""
 | 
					    """A row object that allow by-column-name access to data."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __slots__ = ('_index',)
 | 
					    __slots__ = ('_index',)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -407,7 +407,7 @@ class MinTimeLoggingConnection(LoggingConnection):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    This is just an example of how to sub-class `LoggingConnection` to
 | 
					    This is just an example of how to sub-class `LoggingConnection` to
 | 
				
			||||||
    provide some extra filtering for the logged queries. Both the
 | 
					    provide some extra filtering for the logged queries. Both the
 | 
				
			||||||
    `inizialize()` and `filter()` methods are overwritten to make sure
 | 
					    `initialize()` and `filter()` methods are overwritten to make sure
 | 
				
			||||||
    that only queries executing for more than ``mintime`` ms are logged.
 | 
					    that only queries executing for more than ``mintime`` ms are logged.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Note that this connection uses the specialized cursor
 | 
					    Note that this connection uses the specialized cursor
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ typedef struct {
 | 
				
			||||||
HIDDEN PyObject *psyco_Binary(PyObject *module, PyObject *args);
 | 
					HIDDEN PyObject *psyco_Binary(PyObject *module, PyObject *args);
 | 
				
			||||||
#define psyco_Binary_doc \
 | 
					#define psyco_Binary_doc \
 | 
				
			||||||
    "Binary(buffer) -> new binary object\n\n" \
 | 
					    "Binary(buffer) -> new binary object\n\n" \
 | 
				
			||||||
    "Build an object capable to hold a bynary string value."
 | 
					    "Build an object capable to hold a binary string value."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -226,7 +226,7 @@ conn_get_standard_conforming_strings(PGconn *pgconn)
 | 
				
			||||||
     * The presence of the 'standard_conforming_strings' parameter
 | 
					     * The presence of the 'standard_conforming_strings' parameter
 | 
				
			||||||
     * means that the server _accepts_ the E'' quote.
 | 
					     * means that the server _accepts_ the E'' quote.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * If the paramer is off, the PQescapeByteaConn returns
 | 
					     * If the parameter is off, the PQescapeByteaConn returns
 | 
				
			||||||
     * backslash escaped strings (e.g. '\001' -> "\\001"),
 | 
					     * backslash escaped strings (e.g. '\001' -> "\\001"),
 | 
				
			||||||
     * so the E'' quotes are required to avoid warnings
 | 
					     * so the E'' quotes are required to avoid warnings
 | 
				
			||||||
     * if 'escape_string_warning' is set.
 | 
					     * if 'escape_string_warning' is set.
 | 
				
			||||||
| 
						 | 
					@ -1177,7 +1177,7 @@ conn_set_client_encoding(connectionObject *self, const char *enc)
 | 
				
			||||||
        goto endlock;
 | 
					        goto endlock;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* no error, we can proceeed and store the new encoding */
 | 
					    /* no error, we can proceed and store the new encoding */
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        char *tmp = self->encoding;
 | 
					        char *tmp = self->encoding;
 | 
				
			||||||
        self->encoding = clean_enc;
 | 
					        self->encoding = clean_enc;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ _mogrify(PyObject *var, PyObject *fmt, cursorObject *curs, PyObject **new)
 | 
				
			||||||
        /* if we find '%(' then this is a dictionary, we:
 | 
					        /* if we find '%(' then this is a dictionary, we:
 | 
				
			||||||
           1/ find the matching ')' and extract the key name
 | 
					           1/ find the matching ')' and extract the key name
 | 
				
			||||||
           2/ locate the value in the dictionary (or return an error)
 | 
					           2/ locate the value in the dictionary (or return an error)
 | 
				
			||||||
           3/ mogrify the value into something usefull (quoting)...
 | 
					           3/ mogrify the value into something useful (quoting)...
 | 
				
			||||||
           4/ ...and add it to the new dictionary to be used as argument
 | 
					           4/ ...and add it to the new dictionary to be used as argument
 | 
				
			||||||
        */
 | 
					        */
 | 
				
			||||||
        case '(':
 | 
					        case '(':
 | 
				
			||||||
| 
						 | 
					@ -315,7 +315,7 @@ _psyco_curs_merge_query_args(cursorObject *self,
 | 
				
			||||||
           "not all arguments converted"
 | 
					           "not all arguments converted"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       and return the appropriate ProgrammingError. we do that by grabbing
 | 
					       and return the appropriate ProgrammingError. we do that by grabbing
 | 
				
			||||||
       the curren exception (we will later restore it if the type or the
 | 
					       the current exception (we will later restore it if the type or the
 | 
				
			||||||
       strings do not match.) */
 | 
					       strings do not match.) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(fquery = Bytes_Format(query, args))) {
 | 
					    if (!(fquery = Bytes_Format(query, args))) {
 | 
				
			||||||
| 
						 | 
					@ -1730,7 +1730,7 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* FIXME: why does this raise an excpetion on the _next_ line of code?
 | 
					    /* FIXME: why does this raise an exception on the _next_ line of code?
 | 
				
			||||||
    if (PyObject_IsInstance((PyObject*)conn,
 | 
					    if (PyObject_IsInstance((PyObject*)conn,
 | 
				
			||||||
                             (PyObject *)&connectionType) == 0) {
 | 
					                             (PyObject *)&connectionType) == 0) {
 | 
				
			||||||
        PyErr_SetString(PyExc_TypeError,
 | 
					        PyErr_SetString(PyExc_TypeError,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
/* microporotocols_proto.h - definiton for psycopg's protocols
 | 
					/* microporotocols_proto.h - definition for psycopg's protocols
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Copyright (C) 2003-2010 Federico Di Gregorio <fog@debian.org>
 | 
					 * Copyright (C) 2003-2010 Federico Di Gregorio <fog@debian.org>
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* IMPORTANT NOTE: no function in this file do its own connection locking
 | 
					/* IMPORTANT NOTE: no function in this file do its own connection locking
 | 
				
			||||||
   except for pg_execute and pq_fetch (that are somehow high-level). This means
 | 
					   except for pg_execute and pq_fetch (that are somehow high-level). This means
 | 
				
			||||||
   that all the othe functions should be called while holding a lock to the
 | 
					   that all the other functions should be called while holding a lock to the
 | 
				
			||||||
   connection.
 | 
					   connection.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -748,7 +748,7 @@ exit:
 | 
				
			||||||
   means that there is data available to be collected. -1 means an error, the
 | 
					   means that there is data available to be collected. -1 means an error, the
 | 
				
			||||||
   exception will be set accordingly.
 | 
					   exception will be set accordingly.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   this fucntion locks the connection object
 | 
					   this function locks the connection object
 | 
				
			||||||
   this function call Py_*_ALLOW_THREADS macros */
 | 
					   this function call Py_*_ALLOW_THREADS macros */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
| 
						 | 
					@ -941,7 +941,7 @@ pq_execute(cursorObject *curs, const char *query, int async, int no_result)
 | 
				
			||||||
    /* if the execute was sync, we call pq_fetch() immediately,
 | 
					    /* if the execute was sync, we call pq_fetch() immediately,
 | 
				
			||||||
       to respect the old DBAPI-2.0 compatible behaviour */
 | 
					       to respect the old DBAPI-2.0 compatible behaviour */
 | 
				
			||||||
    if (async == 0) {
 | 
					    if (async == 0) {
 | 
				
			||||||
        Dprintf("pq_execute: entering syncronous DBAPI compatibility mode");
 | 
					        Dprintf("pq_execute: entering synchronous DBAPI compatibility mode");
 | 
				
			||||||
        if (pq_fetch(curs, no_result) < 0) return -1;
 | 
					        if (pq_fetch(curs, no_result) < 0) return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
| 
						 | 
					@ -1008,7 +1008,7 @@ pq_get_last_result(connectionObject *conn)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* pq_fetch - fetch data after a query
 | 
					/* pq_fetch - fetch data after a query
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   this fucntion locks the connection object
 | 
					   this function locks the connection object
 | 
				
			||||||
   this function call Py_*_ALLOW_THREADS macros
 | 
					   this function call Py_*_ALLOW_THREADS macros
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   return value:
 | 
					   return value:
 | 
				
			||||||
| 
						 | 
					@ -1302,7 +1302,7 @@ _pq_copy_in_v3(cursorObject *curs)
 | 
				
			||||||
    else if (error == 2)
 | 
					    else if (error == 2)
 | 
				
			||||||
        res = PQputCopyEnd(curs->conn->pgconn, "error in PQputCopyData() call");
 | 
					        res = PQputCopyEnd(curs->conn->pgconn, "error in PQputCopyData() call");
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        /* XXX would be nice to propagate the exeption */
 | 
					        /* XXX would be nice to propagate the exception */
 | 
				
			||||||
        res = PQputCopyEnd(curs->conn->pgconn, "error in .read() call");
 | 
					        res = PQputCopyEnd(curs->conn->pgconn, "error in .read() call");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IFCLEARPGRES(curs->pgres);
 | 
					    IFCLEARPGRES(curs->pgres);
 | 
				
			||||||
| 
						 | 
					@ -1310,7 +1310,7 @@ _pq_copy_in_v3(cursorObject *curs)
 | 
				
			||||||
    Dprintf("_pq_copy_in_v3: copy ended; res = %d", res);
 | 
					    Dprintf("_pq_copy_in_v3: copy ended; res = %d", res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* if the result is -1 we should not even try to get a result from the
 | 
					    /* if the result is -1 we should not even try to get a result from the
 | 
				
			||||||
       bacause that will lock the current thread forever */
 | 
					       because that will lock the current thread forever */
 | 
				
			||||||
    if (res == -1) {
 | 
					    if (res == -1) {
 | 
				
			||||||
        pq_raise(curs->conn, curs, NULL);
 | 
					        pq_raise(curs->conn, curs, NULL);
 | 
				
			||||||
        /* FIXME: pq_raise check the connection but for some reason even
 | 
					        /* FIXME: pq_raise check the connection but for some reason even
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ extern "C" {
 | 
				
			||||||
HIDDEN psyco_errors_fill_RETURN psyco_errors_fill psyco_errors_fill_PROTO;
 | 
					HIDDEN psyco_errors_fill_RETURN psyco_errors_fill psyco_errors_fill_PROTO;
 | 
				
			||||||
HIDDEN psyco_errors_set_RETURN psyco_errors_set psyco_errors_set_PROTO;
 | 
					HIDDEN psyco_errors_set_RETURN psyco_errors_set psyco_errors_set_PROTO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* global excpetions */
 | 
					/* global exceptions */
 | 
				
			||||||
extern HIDDEN PyObject *Error, *Warning, *InterfaceError, *DatabaseError,
 | 
					extern HIDDEN PyObject *Error, *Warning, *InterfaceError, *DatabaseError,
 | 
				
			||||||
    *InternalError, *OperationalError, *ProgrammingError,
 | 
					    *InternalError, *OperationalError, *ProgrammingError,
 | 
				
			||||||
    *IntegrityError, *DataError, *NotSupportedError;
 | 
					    *IntegrityError, *DataError, *NotSupportedError;
 | 
				
			||||||
| 
						 | 
					@ -169,7 +169,7 @@ STEALS(1) HIDDEN PyObject * psycopg_ensure_text(PyObject *obj);
 | 
				
			||||||
"Error related to SQL query cancellation."
 | 
					"Error related to SQL query cancellation."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TransactionRollbackError_doc \
 | 
					#define TransactionRollbackError_doc \
 | 
				
			||||||
"Error causing transaction rollback (deadlocks, serialisation failures, etc)."
 | 
					"Error causing transaction rollback (deadlocks, serialization failures, etc)."
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -491,7 +491,7 @@ error:
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
psyco_errors_init(void)
 | 
					psyco_errors_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* the names of the exceptions here reflect the oranization of the
 | 
					    /* the names of the exceptions here reflect the organization of the
 | 
				
			||||||
       psycopg2 module and not the fact the the original error objects
 | 
					       psycopg2 module and not the fact the the original error objects
 | 
				
			||||||
       live in _psycopg */
 | 
					       live in _psycopg */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ chunk_getreadbuffer(chunkObject *self, Py_ssize_t segment, void **ptr)
 | 
				
			||||||
    if (segment != 0)
 | 
					    if (segment != 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PyErr_SetString(PyExc_SystemError,
 | 
					        PyErr_SetString(PyExc_SystemError,
 | 
				
			||||||
                        "acessing non-existant buffer segment");
 | 
					                        "accessing non-existant buffer segment");
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    *ptr = self->base;
 | 
					    *ptr = self->base;
 | 
				
			||||||
| 
						 | 
					@ -156,7 +156,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        /* This is a buffer in the classic bytea format. So we can handle it
 | 
					        /* This is a buffer in the classic bytea format. So we can handle it
 | 
				
			||||||
         * to the PQunescapeBytea to have it parsed, rignt? ...Wrong. We
 | 
					         * to the PQunescapeBytea to have it parsed, right? ...Wrong. We
 | 
				
			||||||
         * could, but then we'd have to record whether buffer was allocated by
 | 
					         * could, but then we'd have to record whether buffer was allocated by
 | 
				
			||||||
         * Python or by the libpq to dispose it properly. Furthermore the
 | 
					         * Python or by the libpq to dispose it properly. Furthermore the
 | 
				
			||||||
         * PQunescapeBytea interface is not the most brilliant as it wants a
 | 
					         * PQunescapeBytea interface is not the most brilliant as it wants a
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ typecastObject_initlist typecast_builtins[] = {
 | 
				
			||||||
FOOTER = """    {NULL, NULL, NULL, NULL}\n};\n"""
 | 
					FOOTER = """    {NULL, NULL, NULL, NULL}\n};\n"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# usefull error reporting function
 | 
					# useful error reporting function
 | 
				
			||||||
def error(msg):
 | 
					def error(msg):
 | 
				
			||||||
    """Report an error on stderr."""
 | 
					    """Report an error on stderr."""
 | 
				
			||||||
    sys.stderr.write(msg+'\n')
 | 
					    sys.stderr.write(msg+'\n')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								setup.py
									
									
									
									
									
								
							| 
						 | 
					@ -21,7 +21,7 @@ and stable as a rock.
 | 
				
			||||||
psycopg2 is different from the other database adapter because it was
 | 
					psycopg2 is different from the other database adapter because it was
 | 
				
			||||||
designed for heavily multi-threaded applications that create and destroy
 | 
					designed for heavily multi-threaded applications that create and destroy
 | 
				
			||||||
lots of cursors and make a conspicuous number of concurrent INSERTs or
 | 
					lots of cursors and make a conspicuous number of concurrent INSERTs or
 | 
				
			||||||
UPDATEs. psycopg2 also provide full asycronous operations and support
 | 
					UPDATEs. psycopg2 also provide full asynchronous operations and support
 | 
				
			||||||
for coroutine libraries.
 | 
					for coroutine libraries.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,7 +210,7 @@ or with the pg_config option in 'setup.cfg'.
 | 
				
			||||||
class psycopg_build_ext(build_ext):
 | 
					class psycopg_build_ext(build_ext):
 | 
				
			||||||
    """Conditionally complement the setup.cfg options file.
 | 
					    """Conditionally complement the setup.cfg options file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    This class configures the include_dirs, libray_dirs, libraries
 | 
					    This class configures the include_dirs, library_dirs, libraries
 | 
				
			||||||
    options as required by the system. Most of the configuration happens
 | 
					    options as required by the system. Most of the configuration happens
 | 
				
			||||||
    in finalize_options() method.
 | 
					    in finalize_options() method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -361,7 +361,7 @@ class psycopg_build_ext(build_ext):
 | 
				
			||||||
    finalize_linux3 = finalize_linux2
 | 
					    finalize_linux3 = finalize_linux2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def finalize_options(self):
 | 
					    def finalize_options(self):
 | 
				
			||||||
        """Complete the build system configuation."""
 | 
					        """Complete the build system configuration."""
 | 
				
			||||||
        build_ext.finalize_options(self)
 | 
					        build_ext.finalize_options(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pg_config_helper = PostgresConfig(self)
 | 
					        pg_config_helper = PostgresConfig(self)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ import sys
 | 
				
			||||||
# - Now a subclass of TestCase, to avoid requiring the driver stub
 | 
					# - Now a subclass of TestCase, to avoid requiring the driver stub
 | 
				
			||||||
#   to use multiple inheritance
 | 
					#   to use multiple inheritance
 | 
				
			||||||
# - Reversed the polarity of buggy test in test_description
 | 
					# - Reversed the polarity of buggy test in test_description
 | 
				
			||||||
# - Test exception heirarchy correctly
 | 
					# - Test exception hierarchy correctly
 | 
				
			||||||
# - self.populate is now self._populate(), so if a driver stub
 | 
					# - self.populate is now self._populate(), so if a driver stub
 | 
				
			||||||
#   overrides self.ddl1 this change propogates
 | 
					#   overrides self.ddl1 this change propogates
 | 
				
			||||||
# - VARCHAR columns now have a width, which will hopefully make the
 | 
					# - VARCHAR columns now have a width, which will hopefully make the
 | 
				
			||||||
| 
						 | 
					@ -188,7 +188,7 @@ class DatabaseAPI20Test(unittest.TestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_Exceptions(self):
 | 
					    def test_Exceptions(self):
 | 
				
			||||||
        # Make sure required exceptions exist, and are in the
 | 
					        # Make sure required exceptions exist, and are in the
 | 
				
			||||||
        # defined heirarchy.
 | 
					        # defined hierarchy.
 | 
				
			||||||
        if sys.version[0] == '3': #under Python 3 StardardError no longer exists
 | 
					        if sys.version[0] == '3': #under Python 3 StardardError no longer exists
 | 
				
			||||||
            self.failUnless(issubclass(self.driver.Warning,Exception))
 | 
					            self.failUnless(issubclass(self.driver.Warning,Exception))
 | 
				
			||||||
            self.failUnless(issubclass(self.driver.Error,Exception))
 | 
					            self.failUnless(issubclass(self.driver.Error,Exception))
 | 
				
			||||||
| 
						 | 
					@ -504,7 +504,7 @@ class DatabaseAPI20Test(unittest.TestCase):
 | 
				
			||||||
            self.assertRaises(self.driver.Error,cur.fetchone)
 | 
					            self.assertRaises(self.driver.Error,cur.fetchone)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # cursor.fetchone should raise an Error if called after
 | 
					            # cursor.fetchone should raise an Error if called after
 | 
				
			||||||
            # executing a query that cannnot return rows
 | 
					            # executing a query that cannot return rows
 | 
				
			||||||
            self.executeDDL1(cur)
 | 
					            self.executeDDL1(cur)
 | 
				
			||||||
            self.assertRaises(self.driver.Error,cur.fetchone)
 | 
					            self.assertRaises(self.driver.Error,cur.fetchone)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -516,7 +516,7 @@ class DatabaseAPI20Test(unittest.TestCase):
 | 
				
			||||||
            self.failUnless(cur.rowcount in (-1,0))
 | 
					            self.failUnless(cur.rowcount in (-1,0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # cursor.fetchone should raise an Error if called after
 | 
					            # cursor.fetchone should raise an Error if called after
 | 
				
			||||||
            # executing a query that cannnot return rows
 | 
					            # executing a query that cannot return rows
 | 
				
			||||||
            cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
 | 
					            cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
 | 
				
			||||||
                self.table_prefix
 | 
					                self.table_prefix
 | 
				
			||||||
                ))
 | 
					                ))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user