Ignore:
Timestamp:
Jan 9, 2016, 9:48:47 AM (4 years ago)
Author:
cito
Message:

Simplify code by removing case distinctions for PG < 8.2

In PyGres? 5 (the trunk) we support only PG 9.0 and above, so we shouldn't
worry about PG 8.1 and below any more (PG 8.2 was released 10 years ago).
People who need to request old databases can still use PyGres? 4.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pgmodule.c

    r703 r704  
    8181
    8282#define MAX_BUFFER_SIZE 8192    /* maximum transaction size */
    83 
    84 #ifndef PG_VERSION_NUM
    85 #ifdef PQnoPasswordSupplied
    86 #define PG_VERSION_NUM 80000
    87 #else
    88 #define PG_VERSION_NUM 70400
    89 #endif
    90 #endif
    91 
    92 /* Before 8.0, PQsetdbLogin was not thread-safe with kerberos. */
    93 #if PG_VERSION_NUM >= 80000 || !(defined(KRB4) || defined(KRB5))
    94 #define PQsetdbLoginIsThreadSafe 1
    95 #endif
    9683
    9784/* MODULE GLOBAL VARIABLES */
     
    24232410        /* backend version */
    24242411        if (!strcmp(name, "server_version"))
    2425 #if PG_VERSION_NUM < 80000
    2426                 return PyInt_FromLong(PG_VERSION_NUM);
    2427 #else
    24282412                return PyInt_FromLong(PQserverVersion(self->cnx));
    2429 #endif
    24302413
    24312414        return PyObject_GenericGetAttr((PyObject *) self, nameobj);
     
    34473430        }
    34483431
    3449 #ifdef PQsetdbLoginIsThreadSafe
    34503432        Py_BEGIN_ALLOW_THREADS
    3451 #endif
    34523433        npgobj->cnx = PQsetdbLogin(pghost, pgport == -1 ? NULL : port_buffer,
    34533434                pgopt, NULL, pgdbname, pguser, pgpasswd);
    3454 #ifdef PQsetdbLoginIsThreadSafe
    34553435        Py_END_ALLOW_THREADS
    3456 #endif
    34573436
    34583437        if (PQstatus(npgobj->cnx) == CONNECTION_BAD)
Note: See TracChangeset for help on using the changeset viewer.