Changeset 983 for trunk


Ignore:
Timestamp:
Apr 22, 2019, 4:39:48 PM (5 months ago)
Author:
cito
Message:

Consistent naming of functions in the C module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pgmodule.c

    r982 r983  
    111111  Each object has a number of elements.  The naming scheme will be based on
    112112  the object type.  Here are the elements using example object type "foo".
     113   - fooType: Type definition for object.
    113114   - fooObject: A structure to hold local object information.
    114    - fooXxx: Object methods such as Delete and Getattr.
    115    - fooMethods: Methods declaration.
    116    - fooType: Type definition for object.
    117 
    118   This is followed by the object methods.
     115   - foo_methods: Methods declaration.
     116   - foo_method_name: Object methods.
    119117
    120118  The objects that we need to create:
     
    122120   - conn: Connection object returned from pg.connect().
    123121   - notice: Notice object returned from pg.notice().
    124    - large: Large object returned by pg.conn.locreate() and Pg.Conn.loimport().
    125    - query: Query object returned by pg.conn.Conn.query().
     122   - large: Large object returned by pg.conn.locreate() and pg.conn.loimport().
     123   - query: Query object returned by pg.conn.query().
    126124   - source: Source object returned by pg.conn.source().
    127125*/
     
    15321530/* constructor (internal use only) */
    15331531static largeObject *
    1534 largeNew(connObject *pgcnx, Oid oid)
     1532large_new(connObject *pgcnx, Oid oid)
    15351533{
    15361534    largeObject *large_obj;
     
    15501548/* destructor */
    15511549static void
    1552 largeDealloc(largeObject *self)
     1550large_dealloc(largeObject *self)
    15531551{
    15541552    if (self->lo_fd >= 0 && self->pgcnx->valid)
     
    15601558
    15611559/* opens large object */
    1562 static char largeOpen__doc__[] =
     1560static char large_open__doc__[] =
    15631561"open(mode) -- open access to large object with specified mode\n\n"
    15641562"The mode must be one of INV_READ, INV_WRITE (module level constants).\n";
    15651563
    15661564static PyObject *
    1567 largeOpen(largeObject *self, PyObject *args)
     1565large_open(largeObject *self, PyObject *args)
    15681566{
    15691567    int mode, fd;
     
    15941592
    15951593/* close large object */
    1596 static char largeClose__doc__[] =
     1594static char large_close__doc__[] =
    15971595"close() -- close access to large object data";
    15981596
    15991597static PyObject *
    1600 largeClose(largeObject *self, PyObject *noargs)
     1598large_close(largeObject *self, PyObject *noargs)
    16011599{
    16021600    /* checks validity */
     
    16181616
    16191617/* reads from large object */
    1620 static char largeRead__doc__[] =
     1618static char large_read__doc__[] =
    16211619"read(size) -- read from large object to sized string\n\n"
    16221620"Object must be opened in read mode before calling this method.\n";
    16231621
    16241622static PyObject *
    1625 largeRead(largeObject *self, PyObject *args)
     1623large_read(largeObject *self, PyObject *args)
    16261624{
    16271625    int size;
     
    16631661
    16641662/* write to large object */
    1665 static char largeWrite__doc__[] =
     1663static char large_write__doc__[] =
    16661664"write(string) -- write sized string to large object\n\n"
    16671665"Object must be opened in read mode before calling this method.\n";
    16681666
    16691667static PyObject *
    1670 largeWrite(largeObject *self, PyObject *args)
     1668large_write(largeObject *self, PyObject *args)
    16711669{
    16721670    char *buffer;
     
    16991697
    17001698/* go to position in large object */
    1701 static char largeSeek__doc__[] =
     1699static char large_seek__doc__[] =
    17021700"seek(offset, whence) -- move to specified position\n\n"
    17031701"Object must be opened before calling this method. The whence option\n"
     
    17051703
    17061704static PyObject *
    1707 largeSeek(largeObject *self, PyObject *args)
     1705large_seek(largeObject *self, PyObject *args)
    17081706{
    17091707    /* offset and whence are initialized to keep compiler happy */
     
    17351733
    17361734/* gets large object size */
    1737 static char largeSize__doc__[] =
     1735static char large_size__doc__[] =
    17381736"size() -- return large object size\n\n"
    17391737"The object must be opened before calling this method.\n";
    17401738
    17411739static PyObject *
    1742 largeSize(largeObject *self, PyObject *noargs)
     1740large_size(largeObject *self, PyObject *noargs)
    17431741{
    17441742    int start, end;
     
    17751773
    17761774/* gets large object cursor position */
    1777 static char largeTell__doc__[] =
     1775static char large_tell__doc__[] =
    17781776"tell() -- give current position in large object\n\n"
    17791777"The object must be opened before calling this method.\n";
    17801778
    17811779static PyObject *
    1782 largeTell(largeObject *self, PyObject *noargs)
     1780large_tell(largeObject *self, PyObject *noargs)
    17831781{
    17841782    int start;
     
    18001798
    18011799/* exports large object as unix file */
    1802 static char largeExport__doc__[] =
     1800static char large_export__doc__[] =
    18031801"export(filename) -- export large object data to specified file\n\n"
    18041802"The object must be closed when calling this method.\n";
    18051803
    18061804static PyObject *
    1807 largeExport(largeObject *self, PyObject *args)
     1805large_export(largeObject *self, PyObject *args)
    18081806{
    18091807    char *name;
     
    18321830
    18331831/* deletes a large object */
    1834 static char largeUnlink__doc__[] =
     1832static char large_unlink__doc__[] =
    18351833"unlink() -- destroy large object\n\n"
    18361834"The object must be closed when calling this method.\n";
    18371835
    18381836static PyObject *
    1839 largeUnlink(largeObject *self, PyObject *noargs)
     1837large_unlink(largeObject *self, PyObject *noargs)
    18401838{
    18411839    /* checks validity */
     
    18571855/* get the list of large object attributes */
    18581856static PyObject *
    1859 largeDir(largeObject *self, PyObject *noargs)
     1857large_dir(largeObject *self, PyObject *noargs)
    18601858{
    18611859    PyObject *attrs;
     
    18691867
    18701868/* large object methods */
    1871 static struct PyMethodDef largeMethods[] = {
    1872     {"__dir__", (PyCFunction) largeDir,  METH_NOARGS, NULL},
    1873     {"open", (PyCFunction) largeOpen, METH_VARARGS, largeOpen__doc__},
    1874     {"close", (PyCFunction) largeClose, METH_NOARGS, largeClose__doc__},
    1875     {"read", (PyCFunction) largeRead, METH_VARARGS, largeRead__doc__},
    1876     {"write", (PyCFunction) largeWrite, METH_VARARGS, largeWrite__doc__},
    1877     {"seek", (PyCFunction) largeSeek, METH_VARARGS, largeSeek__doc__},
    1878     {"size", (PyCFunction) largeSize, METH_NOARGS, largeSize__doc__},
    1879     {"tell", (PyCFunction) largeTell, METH_NOARGS, largeTell__doc__},
    1880     {"export",(PyCFunction) largeExport, METH_VARARGS, largeExport__doc__},
    1881     {"unlink",(PyCFunction) largeUnlink, METH_NOARGS, largeUnlink__doc__},
     1869static struct PyMethodDef large_methods[] = {
     1870    {"__dir__", (PyCFunction) large_dir,  METH_NOARGS, NULL},
     1871    {"open", (PyCFunction) large_open, METH_VARARGS, large_open__doc__},
     1872    {"close", (PyCFunction) large_close, METH_NOARGS, large_close__doc__},
     1873    {"read", (PyCFunction) large_read, METH_VARARGS, large_read__doc__},
     1874    {"write", (PyCFunction) large_write, METH_VARARGS, large_write__doc__},
     1875    {"seek", (PyCFunction) large_seek, METH_VARARGS, large_seek__doc__},
     1876    {"size", (PyCFunction) large_size, METH_NOARGS, large_size__doc__},
     1877    {"tell", (PyCFunction) large_tell, METH_NOARGS, large_tell__doc__},
     1878    {"export",(PyCFunction) large_export, METH_VARARGS, large_export__doc__},
     1879    {"unlink",(PyCFunction) large_unlink, METH_NOARGS, large_unlink__doc__},
    18821880    {NULL, NULL}
    18831881};
     
    18851883/* gets large object attributes */
    18861884static PyObject *
    1887 largeGetAttr(largeObject *self, PyObject *nameobj)
     1885large_getattr(largeObject *self, PyObject *nameobj)
    18881886{
    18891887    const char *name = PyStr_AsString(nameobj);
     
    19211919/* return large object as string in human readable form */
    19221920static PyObject *
    1923 largeStr(largeObject *self)
     1921large_str(largeObject *self)
    19241922{
    19251923    char str[80];
     
    19351933static PyTypeObject largeType = {
    19361934    PyVarObject_HEAD_INIT(NULL, 0)
    1937     "pg.LargeObject",               /* tp_name */
    1938     sizeof(largeObject),            /* tp_basicsize */
    1939     0,                              /* tp_itemsize */
     1935    "pg.LargeObject",              /* tp_name */
     1936    sizeof(largeObject),           /* tp_basicsize */
     1937    0,                             /* tp_itemsize */
    19401938
    19411939    /* methods */
    1942     (destructor) largeDealloc,      /* tp_dealloc */
    1943     0,                              /* tp_print */
    1944     0,                              /* tp_getattr */
    1945     0,                              /* tp_setattr */
    1946     0,                              /* tp_compare */
    1947     0,                              /* tp_repr */
    1948     0,                              /* tp_as_number */
    1949     0,                              /* tp_as_sequence */
    1950     0,                              /* tp_as_mapping */
    1951     0,                              /* tp_hash */
    1952     0,                              /* tp_call */
    1953     (reprfunc) largeStr,            /* tp_str */
    1954     (getattrofunc) largeGetAttr,    /* tp_getattro */
    1955     0,                              /* tp_setattro */
    1956     0,                              /* tp_as_buffer */
    1957     Py_TPFLAGS_DEFAULT,             /* tp_flags */
    1958     large__doc__,                   /* tp_doc */
    1959     0,                              /* tp_traverse */
    1960     0,                              /* tp_clear */
    1961     0,                              /* tp_richcompare */
    1962     0,                              /* tp_weaklistoffset */
    1963     0,                              /* tp_iter */
    1964     0,                              /* tp_iternext */
    1965     largeMethods,                   /* tp_methods */
     1940    (destructor) large_dealloc,    /* tp_dealloc */
     1941    0,                             /* tp_print */
     1942    0,                             /* tp_getattr */
     1943    0,                             /* tp_setattr */
     1944    0,                             /* tp_compare */
     1945    0,                             /* tp_repr */
     1946    0,                             /* tp_as_number */
     1947    0,                             /* tp_as_sequence */
     1948    0,                             /* tp_as_mapping */
     1949    0,                             /* tp_hash */
     1950    0,                             /* tp_call */
     1951    (reprfunc) large_str,          /* tp_str */
     1952    (getattrofunc) large_getattr,  /* tp_getattro */
     1953    0,                             /* tp_setattro */
     1954    0,                             /* tp_as_buffer */
     1955    Py_TPFLAGS_DEFAULT,            /* tp_flags */
     1956    large__doc__,                  /* tp_doc */
     1957    0,                             /* tp_traverse */
     1958    0,                             /* tp_clear */
     1959    0,                             /* tp_richcompare */
     1960    0,                             /* tp_weaklistoffset */
     1961    0,                             /* tp_iter */
     1962    0,                             /* tp_iternext */
     1963    large_methods,                 /* tp_methods */
    19661964};
    19671965#endif /* LARGE_OBJECTS */
     
    19711969/* --------------------------------------------------------------------- */
    19721970static void
    1973 connDelete(connObject *self)
     1971conn_delete(connObject *self)
    19741972{
    19751973    if (self->cnx) {
     
    19841982
    19851983/* source creation */
    1986 static char connSource__doc__[] =
     1984static char conn_source__doc__[] =
    19871985"source() -- create a new source object for this connection";
    19881986
    19891987static PyObject *
    1990 connSource(connObject *self, PyObject *noargs)
     1988conn_source(connObject *self, PyObject *noargs)
    19911989{
    19921990    sourceObject *source_obj;
     
    20162014/* base method for execution of both unprepared and prepared queries */
    20172015static PyObject *
    2018 _connQuery(connObject *self, PyObject *args, int prepared)
     2016_conn_query(connObject *self, PyObject *args, int prepared)
    20192017{
    20202018    PyObject *query_str_obj, *param_obj = NULL;
     
    22372235
    22382236/* database query */
    2239 static char connQuery__doc__[] =
     2237static char conn_query__doc__[] =
    22402238"query(sql, [arg]) -- create a new query object for this connection\n\n"
    22412239"You must pass the SQL (string) request and you can optionally pass\n"
     
    22432241
    22442242static PyObject *
    2245 connQuery(connObject *self, PyObject *args)
    2246 {
    2247     return _connQuery(self, args, 0);
     2243conn_query(connObject *self, PyObject *args)
     2244{
     2245    return _conn_query(self, args, 0);
    22482246}
    22492247
    22502248/* execute prepared statement */
    2251 static char connQueryPrepared__doc__[] =
     2249static char conn_query_prepared__doc__[] =
    22522250"query_prepared(name, [arg]) -- execute a prepared statement\n\n"
    22532251"You must pass the name (string) of the prepared statement and you can\n"
     
    22552253
    22562254static PyObject *
    2257 connQueryPrepared(connObject *self, PyObject *args)
    2258 {
    2259     return _connQuery(self, args, 1);
     2255conn_query_prepared(connObject *self, PyObject *args)
     2256{
     2257    return _conn_query(self, args, 1);
    22602258}
    22612259
    22622260/* create prepared statement */
    2263 static char connPrepare__doc__[] =
     2261static char conn_prepare__doc__[] =
    22642262"prepare(name, sql) -- create a prepared statement\n\n"
    22652263"You must pass the name (string) of the prepared statement and the\n"
     
    22672265
    22682266static PyObject *
    2269 connPrepare(connObject *self, PyObject *args)
     2267conn_prepare(connObject *self, PyObject *args)
    22702268{
    22712269    char *name, *query;
     
    23042302
    23052303/* describe prepared statement */
    2306 static char connDescribePrepared__doc__[] =
     2304static char conn_describe_prepared__doc__[] =
    23072305"describe_prepared(name) -- describe a prepared statement\n\n"
    23082306"You must pass the name (string) of the prepared statement.\n";
    23092307
    23102308static PyObject *
    2311 connDescribePrepared(connObject *self, PyObject *args)
     2309conn_describe_prepared(connObject *self, PyObject *args)
    23122310{
    23132311    char *name;
     
    23532351
    23542352#ifdef DIRECT_ACCESS
    2355 static char connPutLine__doc__[] =
     2353static char conn_putline__doc__[] =
    23562354"putline(line) -- send a line directly to the backend";
    23572355
    23582356/* direct access function: putline */
    23592357static PyObject *
    2360 connPutLine(connObject *self, PyObject *args)
     2358conn_putline(connObject *self, PyObject *args)
    23612359{
    23622360    char *line;
     
    23852383
    23862384/* direct access function: getline */
    2387 static char connGetLine__doc__[] =
     2385static char conn_getline__doc__[] =
    23882386"getline() -- get a line directly from the backend";
    23892387
    23902388static PyObject *
    2391 connGetLine(connObject *self, PyObject *noargs)
     2389conn_getline(connObject *self, PyObject *noargs)
    23922390{
    23932391    char line[MAX_BUFFER_SIZE];
     
    24182416
    24192417/* direct access function: end copy */
    2420 static char connEndCopy__doc__[] =
     2418static char conn_endcopy__doc__[] =
    24212419"endcopy() -- synchronize client and server";
    24222420
    24232421static PyObject *
    2424 connEndCopy(connObject *self, PyObject *noargs)
     2422conn_endcopy(connObject *self, PyObject *noargs)
    24252423{
    24262424    if (!self->cnx) {
     
    24412439/* return query as string in human readable form */
    24422440static PyObject *
    2443 queryStr(queryObject *self)
     2441query_str(queryObject *self)
    24442442{
    24452443    return format_result(self->result);
     
    24472445
    24482446/* insert table */
    2449 static char connInsertTable__doc__[] =
     2447static char conn_inserttable__doc__[] =
    24502448"inserttable(table, data) -- insert list into table\n\n"
    24512449"The fields in the list must be in the same order as in the table.\n";
    24522450
    24532451static PyObject *
    2454 connInsertTable(connObject *self, PyObject *args)
     2452conn_inserttable(connObject *self, PyObject *args)
    24552453{
    24562454    PGresult *result;
     
    26582656
    26592657/* get transaction state */
    2660 static char connTransaction__doc__[] =
     2658static char conn_transaction__doc__[] =
    26612659"transaction() -- return the current transaction status";
    26622660
    26632661static PyObject *
    2664 connTransaction(connObject *self, PyObject *noargs)
     2662conn_transaction(connObject *self, PyObject *noargs)
    26652663{
    26662664    if (!self->cnx) {
     
    26732671
    26742672/* get parameter setting */
    2675 static char connParameter__doc__[] =
     2673static char conn_parameter__doc__[] =
    26762674"parameter(name) -- look up a current parameter setting";
    26772675
    26782676static PyObject *
    2679 connParameter(connObject *self, PyObject *args)
     2677conn_parameter(connObject *self, PyObject *args)
    26802678{
    26812679    const char *name;
     
    27702768
    27712769/* get current date format */
    2772 static char connDateFormat__doc__[] =
     2770static char conn_date_format__doc__[] =
    27732771"date_format() -- return the current date format";
    27742772
    27752773static PyObject *
    2776 connDateFormat(connObject *self, PyObject *noargs)
     2774conn_date_format(connObject *self, PyObject *noargs)
    27772775{
    27782776    const char *fmt;
     
    27962794
    27972795/* escape literal */
    2798 static char connEscapeLiteral__doc__[] =
     2796static char conn_escape_literal__doc__[] =
    27992797"escape_literal(str) -- escape a literal constant for use within SQL";
    28002798
    28012799static PyObject *
    2802 connEscapeLiteral(connObject *self, PyObject *string)
     2800conn_escape_literal(connObject *self, PyObject *string)
    28032801{
    28042802    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    28062804    char *from,  /* our string argument as encoded string */
    28072805         *to;    /* the result as encoded string */
    2808     Py_ssize_t from_length;   /* length of string */
    2809     size_t to_length;         /* length of result */
    2810     int encoding = -1;        /* client encoding */
     2806    Py_ssize_t from_length;    /* length of string */
     2807    size_t to_length;          /* length of result */
     2808    int encoding = -1;         /* client encoding */
    28112809
    28122810    if (PyBytes_Check(string)) {
     
    28412839
    28422840/* escape identifier */
    2843 static char connEscapeIdentifier__doc__[] =
     2841static char conn_escape_identifier__doc__[] =
    28442842"escape_identifier(str) -- escape an identifier for use within SQL";
    28452843
    28462844static PyObject *
    2847 connEscapeIdentifier(connObject *self, PyObject *string)
     2845conn_escape_identifier(connObject *self, PyObject *string)
    28482846{
    28492847    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    28512849    char *from,  /* our string argument as encoded string */
    28522850         *to;    /* the result as encoded string */
    2853     Py_ssize_t from_length;   /* length of string */
    2854     size_t to_length;         /* length of result */
    2855     int encoding = -1;        /* client encoding */
     2851    Py_ssize_t from_length;    /* length of string */
     2852    size_t to_length;          /* length of result */
     2853    int encoding = -1;         /* client encoding */
    28562854
    28572855    if (PyBytes_Check(string)) {
     
    28882886
    28892887/* escape string */
    2890 static char connEscapeString__doc__[] =
     2888static char conn_escape_string__doc__[] =
    28912889"escape_string(str) -- escape a string for use within SQL";
    28922890
    28932891static PyObject *
    2894 connEscapeString(connObject *self, PyObject *string)
    2895 {
    2896     PyObject *tmp_obj = NULL,  /* auxiliary string object */
    2897              *to_obj;          /* string object to return */
    2898     char *from,  /* our string argument as encoded string */
    2899          *to;    /* the result as encoded string */
    2900     Py_ssize_t from_length;   /* length of string */
    2901     size_t to_length;         /* length of result */
    2902     int encoding = -1;        /* client encoding */
    2903 
    2904     if (PyBytes_Check(string)) {
    2905         PyBytes_AsStringAndSize(string, &from, &from_length);
    2906     }
    2907     else if (PyUnicode_Check(string)) {
    2908         encoding = PQclientEncoding(self->cnx);
    2909         tmp_obj = get_encoded_string(string, encoding);
    2910         if (!tmp_obj) return NULL; /* pass the UnicodeEncodeError */
    2911         PyBytes_AsStringAndSize(tmp_obj, &from, &from_length);
    2912     }
    2913     else {
    2914         PyErr_SetString(
    2915             PyExc_TypeError,
    2916             "Method escape_string() expects a string as argument");
    2917         return NULL;
    2918     }
    2919 
    2920     to_length = 2*from_length + 1;
    2921     if ((Py_ssize_t) to_length < from_length) { /* overflow */
    2922         to_length = from_length;
    2923         from_length = (from_length - 1)/2;
    2924     }
    2925     to = (char *) PyMem_Malloc(to_length);
    2926     to_length = PQescapeStringConn(self->cnx,
    2927         to, from, (size_t) from_length, NULL);
    2928 
    2929     Py_XDECREF(tmp_obj);
    2930 
    2931     if (encoding == -1)
    2932         to_obj = PyBytes_FromStringAndSize(to, to_length);
    2933     else
    2934         to_obj = get_decoded_string(to, to_length, encoding);
    2935     PyMem_Free(to);
    2936     return to_obj;
    2937 }
    2938 
    2939 /* escape bytea */
    2940 static char connEscapeBytea__doc__[] =
    2941 "escape_bytea(data) -- escape binary data for use within SQL as type bytea";
    2942 
    2943 static PyObject *
    2944 connEscapeBytea(connObject *self, PyObject *data)
     2892conn_escape_string(connObject *self, PyObject *string)
    29452893{
    29462894    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    29522900    int encoding = -1;         /* client encoding */
    29532901
     2902    if (PyBytes_Check(string)) {
     2903        PyBytes_AsStringAndSize(string, &from, &from_length);
     2904    }
     2905    else if (PyUnicode_Check(string)) {
     2906        encoding = PQclientEncoding(self->cnx);
     2907        tmp_obj = get_encoded_string(string, encoding);
     2908        if (!tmp_obj) return NULL; /* pass the UnicodeEncodeError */
     2909        PyBytes_AsStringAndSize(tmp_obj, &from, &from_length);
     2910    }
     2911    else {
     2912        PyErr_SetString(
     2913            PyExc_TypeError,
     2914            "Method escape_string() expects a string as argument");
     2915        return NULL;
     2916    }
     2917
     2918    to_length = 2*from_length + 1;
     2919    if ((Py_ssize_t) to_length < from_length) { /* overflow */
     2920        to_length = from_length;
     2921        from_length = (from_length - 1)/2;
     2922    }
     2923    to = (char *) PyMem_Malloc(to_length);
     2924    to_length = PQescapeStringConn(self->cnx,
     2925        to, from, (size_t) from_length, NULL);
     2926
     2927    Py_XDECREF(tmp_obj);
     2928
     2929    if (encoding == -1)
     2930        to_obj = PyBytes_FromStringAndSize(to, to_length);
     2931    else
     2932        to_obj = get_decoded_string(to, to_length, encoding);
     2933    PyMem_Free(to);
     2934    return to_obj;
     2935}
     2936
     2937/* escape bytea */
     2938static char conn_escape_bytea__doc__[] =
     2939"escape_bytea(data) -- escape binary data for use within SQL as type bytea";
     2940
     2941static PyObject *
     2942conn_escape_bytea(connObject *self, PyObject *data)
     2943{
     2944    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     2945             *to_obj;          /* string object to return */
     2946    char *from,  /* our string argument as encoded string */
     2947         *to;    /* the result as encoded string */
     2948    Py_ssize_t from_length;    /* length of string */
     2949    size_t to_length;          /* length of result */
     2950    int encoding = -1;         /* client encoding */
     2951
    29542952    if (PyBytes_Check(data)) {
    29552953        PyBytes_AsStringAndSize(data, &from, &from_length);
     
    29842982#ifdef LARGE_OBJECTS
    29852983/* creates large object */
    2986 static char connCreateLO__doc__[] =
     2984static char conn_locreate__doc__[] =
    29872985"locreate(mode) -- create a new large object in the database";
    29882986
    29892987static PyObject *
    2990 connCreateLO(connObject *self, PyObject *args)
     2988conn_locreate(connObject *self, PyObject *args)
    29912989{
    29922990    int mode;
     
    30123010    }
    30133011
    3014     return (PyObject *) largeNew(self, lo_oid);
     3012    return (PyObject *) large_new(self, lo_oid);
    30153013}
    30163014
    30173015/* init from already known oid */
    3018 static char connGetLO__doc__[] =
     3016static char conn_getlo__doc__[] =
    30193017"getlo(oid) -- create a large object instance for the specified oid";
    30203018
    30213019static PyObject *
    3022 connGetLO(connObject *self, PyObject *args)
     3020conn_getlo(connObject *self, PyObject *args)
    30233021{
    30243022    int oid;
     
    30443042
    30453043    /* creates object */
    3046     return (PyObject *) largeNew(self, lo_oid);
     3044    return (PyObject *) large_new(self, lo_oid);
    30473045}
    30483046
    30493047/* import unix file */
    3050 static char connImportLO__doc__[] =
     3048static char conn_loimport__doc__[] =
    30513049"loimport(name) -- create a new large object from specified file";
    30523050
    30533051static PyObject *
    3054 connImportLO(connObject *self, PyObject *args)
     3052conn_loimport(connObject *self, PyObject *args)
    30553053{
    30563054    char *name;
     
    30763074    }
    30773075
    3078     return (PyObject *) largeNew(self, lo_oid);
     3076    return (PyObject *) large_new(self, lo_oid);
    30793077}
    30803078#endif /* LARGE_OBJECTS */
    30813079
    30823080/* resets connection */
    3083 static char connReset__doc__[] =
     3081static char conn_reset__doc__[] =
    30843082"reset() -- reset connection with current parameters\n\n"
    30853083"All derived queries and large objects derived from this connection\n"
     
    30873085
    30883086static PyObject *
    3089 connReset(connObject *self, PyObject *noargs)
     3087conn_reset(connObject *self, PyObject *noargs)
    30903088{
    30913089    if (!self->cnx) {
     
    31013099
    31023100/* cancels current command */
    3103 static char connCancel__doc__[] =
     3101static char conn_cancel__doc__[] =
    31043102"cancel() -- abandon processing of the current command";
    31053103
    31063104static PyObject *
    3107 connCancel(connObject *self, PyObject *noargs)
     3105conn_cancel(connObject *self, PyObject *noargs)
    31083106{
    31093107    if (!self->cnx) {
     
    31173115
    31183116/* get connection socket */
    3119 static char connFileno__doc__[] =
     3117static char conn_fileno__doc__[] =
    31203118"fileno() -- return database connection socket file handle";
    31213119
    31223120static PyObject *
    3123 connFileno(connObject *self, PyObject *noargs)
     3121conn_fileno(connObject *self, PyObject *noargs)
    31243122{
    31253123    if (!self->cnx) {
     
    31363134
    31373135/* set external typecast callback function */
    3138 static char connSetCastHook__doc__[] =
     3136static char conn_set_cast_hook__doc__[] =
    31393137"set_cast_hook(func) -- set a fallback typecast function";
    31403138
    31413139static PyObject *
    3142 connSetCastHook(connObject *self, PyObject *func)
     3140conn_set_cast_hook(connObject *self, PyObject *func)
    31433141{
    31443142    PyObject *ret = NULL;
     
    31643162
    31653163/* get notice receiver callback function */
    3166 static char connGetCastHook__doc__[] =
     3164static char conn_get_cast_hook__doc__[] =
    31673165"get_cast_hook() -- get the fallback typecast function";
    31683166
    31693167static PyObject *
    3170 connGetCastHook(connObject *self, PyObject *noargs)
     3168conn_get_cast_hook(connObject *self, PyObject *noargs)
    31713169{
    31723170    PyObject *ret = self->cast_hook;;
     
    31803178
    31813179/* set notice receiver callback function */
    3182 static char connSetNoticeReceiver__doc__[] =
     3180static char conn_set_notice_receiver__doc__[] =
    31833181"set_notice_receiver(func) -- set the current notice receiver";
    31843182
    31853183static PyObject *
    3186 connSetNoticeReceiver(connObject *self, PyObject *func)
     3184conn_set_notice_receiver(connObject *self, PyObject *func)
    31873185{
    31883186    PyObject *ret = NULL;
     
    32093207
    32103208/* get notice receiver callback function */
    3211 static char connGetNoticeReceiver__doc__[] =
     3209static char conn_get_notice_receiver__doc__[] =
    32123210"get_notice_receiver() -- get the current notice receiver";
    32133211
    32143212static PyObject *
    3215 connGetNoticeReceiver(connObject *self, PyObject *noargs)
     3213conn_get_notice_receiver(connObject *self, PyObject *noargs)
    32163214{
    32173215    PyObject *ret = self->notice_receiver;
     
    32253223
    32263224/* close without deleting */
    3227 static char connClose__doc__[] =
     3225static char conn_close__doc__[] =
    32283226"close() -- close connection\n\n"
    32293227"All instances of the connection object and derived objects\n"
     
    32313229
    32323230static PyObject *
    3233 connClose(connObject *self, PyObject *noargs)
     3231conn_close(connObject *self, PyObject *noargs)
    32343232{
    32353233    /* connection object cannot already be closed */
     
    32493247
    32503248/* gets asynchronous notify */
    3251 static char connGetNotify__doc__[] =
     3249static char conn_get_notify__doc__[] =
    32523250"getnotify() -- get database notify for this connection";
    32533251
    32543252static PyObject *
    3255 connGetNotify(connObject *self, PyObject *noargs)
     3253conn_get_notify(connObject *self, PyObject *noargs)
    32563254{
    32573255    PGnotify *notify;
     
    33053303/* get the list of connection attributes */
    33063304static PyObject *
    3307 connDir(connObject *self, PyObject *noargs)
     3305conn_dir(connObject *self, PyObject *noargs)
    33083306{
    33093307    PyObject *attrs;
     
    33193317
    33203318/* connection object methods */
    3321 static struct PyMethodDef connMethods[] = {
    3322     {"__dir__", (PyCFunction) connDir,  METH_NOARGS, NULL},
    3323 
    3324     {"source", (PyCFunction) connSource, METH_NOARGS, connSource__doc__},
    3325     {"query", (PyCFunction) connQuery, METH_VARARGS, connQuery__doc__},
    3326     {"query_prepared", (PyCFunction) connQueryPrepared, METH_VARARGS,
    3327             connQueryPrepared__doc__},
    3328     {"prepare", (PyCFunction) connPrepare, METH_VARARGS, connPrepare__doc__},
    3329     {"describe_prepared", (PyCFunction) connDescribePrepared, METH_VARARGS,
    3330             connDescribePrepared__doc__},
    3331     {"reset", (PyCFunction) connReset, METH_NOARGS, connReset__doc__},
    3332     {"cancel", (PyCFunction) connCancel, METH_NOARGS, connCancel__doc__},
    3333     {"close", (PyCFunction) connClose, METH_NOARGS, connClose__doc__},
    3334     {"fileno", (PyCFunction) connFileno, METH_NOARGS, connFileno__doc__},
    3335     {"get_cast_hook", (PyCFunction) connGetCastHook, METH_NOARGS,
    3336             connGetCastHook__doc__},
    3337     {"set_cast_hook", (PyCFunction) connSetCastHook, METH_O,
    3338             connSetCastHook__doc__},
    3339     {"get_notice_receiver", (PyCFunction) connGetNoticeReceiver, METH_NOARGS,
    3340             connGetNoticeReceiver__doc__},
    3341     {"set_notice_receiver", (PyCFunction) connSetNoticeReceiver, METH_O,
    3342             connSetNoticeReceiver__doc__},
    3343     {"getnotify", (PyCFunction) connGetNotify, METH_NOARGS,
    3344             connGetNotify__doc__},
    3345     {"inserttable", (PyCFunction) connInsertTable, METH_VARARGS,
    3346             connInsertTable__doc__},
    3347     {"transaction", (PyCFunction) connTransaction, METH_NOARGS,
    3348             connTransaction__doc__},
    3349     {"parameter", (PyCFunction) connParameter, METH_VARARGS,
    3350             connParameter__doc__},
    3351     {"date_format", (PyCFunction) connDateFormat, METH_NOARGS,
    3352             connDateFormat__doc__},
     3319static struct PyMethodDef conn_methods[] = {
     3320    {"__dir__", (PyCFunction) conn_dir,  METH_NOARGS, NULL},
     3321
     3322    {"source", (PyCFunction) conn_source,
     3323        METH_NOARGS, conn_source__doc__},
     3324    {"query", (PyCFunction) conn_query,
     3325        METH_VARARGS, conn_query__doc__},
     3326    {"query_prepared", (PyCFunction) conn_query_prepared,
     3327        METH_VARARGS, conn_query_prepared__doc__},
     3328    {"prepare", (PyCFunction) conn_prepare,
     3329        METH_VARARGS, conn_prepare__doc__},
     3330    {"describe_prepared", (PyCFunction) conn_describe_prepared,
     3331        METH_VARARGS, conn_describe_prepared__doc__},
     3332    {"reset", (PyCFunction) conn_reset,
     3333        METH_NOARGS, conn_reset__doc__},
     3334    {"cancel", (PyCFunction) conn_cancel,
     3335        METH_NOARGS, conn_cancel__doc__},
     3336    {"close", (PyCFunction) conn_close,
     3337        METH_NOARGS, conn_close__doc__},
     3338    {"fileno", (PyCFunction) conn_fileno,
     3339        METH_NOARGS, conn_fileno__doc__},
     3340    {"get_cast_hook", (PyCFunction) conn_get_cast_hook,
     3341        METH_NOARGS, conn_get_cast_hook__doc__},
     3342    {"set_cast_hook", (PyCFunction) conn_set_cast_hook,
     3343        METH_O, conn_set_cast_hook__doc__},
     3344    {"get_notice_receiver", (PyCFunction) conn_get_notice_receiver,
     3345        METH_NOARGS, conn_get_notice_receiver__doc__},
     3346    {"set_notice_receiver", (PyCFunction) conn_set_notice_receiver,
     3347        METH_O, conn_set_notice_receiver__doc__},
     3348    {"getnotify", (PyCFunction) conn_get_notify,
     3349        METH_NOARGS, conn_get_notify__doc__},
     3350    {"inserttable", (PyCFunction) conn_inserttable,
     3351        METH_VARARGS, conn_inserttable__doc__},
     3352    {"transaction", (PyCFunction) conn_transaction,
     3353        METH_NOARGS, conn_transaction__doc__},
     3354    {"parameter", (PyCFunction) conn_parameter,
     3355        METH_VARARGS, conn_parameter__doc__},
     3356    {"date_format", (PyCFunction) conn_date_format,
     3357        METH_NOARGS, conn_date_format__doc__},
    33533358
    33543359#ifdef ESCAPING_FUNCS
    3355     {"escape_literal", (PyCFunction) connEscapeLiteral, METH_O,
    3356             connEscapeLiteral__doc__},
    3357     {"escape_identifier", (PyCFunction) connEscapeIdentifier, METH_O,
    3358             connEscapeIdentifier__doc__},
     3360    {"escape_literal", (PyCFunction) conn_escape_literal,
     3361        METH_O, conn_escape_literal__doc__},
     3362    {"escape_identifier", (PyCFunction) conn_escape_identifier,
     3363        METH_O, conn_escape_identifier__doc__},
    33593364#endif /* ESCAPING_FUNCS */
    3360     {"escape_string", (PyCFunction) connEscapeString, METH_O,
    3361             connEscapeString__doc__},
    3362     {"escape_bytea", (PyCFunction) connEscapeBytea, METH_O,
    3363             connEscapeBytea__doc__},
     3365    {"escape_string", (PyCFunction) conn_escape_string,
     3366        METH_O, conn_escape_string__doc__},
     3367    {"escape_bytea", (PyCFunction) conn_escape_bytea,
     3368        METH_O, conn_escape_bytea__doc__},
    33643369
    33653370#ifdef DIRECT_ACCESS
    3366     {"putline", (PyCFunction) connPutLine, METH_VARARGS, connPutLine__doc__},
    3367     {"getline", (PyCFunction) connGetLine, METH_NOARGS, connGetLine__doc__},
    3368     {"endcopy", (PyCFunction) connEndCopy, METH_NOARGS, connEndCopy__doc__},
     3371    {"putline", (PyCFunction) conn_putline,
     3372        METH_VARARGS, conn_putline__doc__},
     3373    {"getline", (PyCFunction) conn_getline,
     3374        METH_NOARGS, conn_getline__doc__},
     3375    {"endcopy", (PyCFunction) conn_endcopy,
     3376        METH_NOARGS, conn_endcopy__doc__},
    33693377#endif /* DIRECT_ACCESS */
    33703378
    33713379#ifdef LARGE_OBJECTS
    3372     {"locreate", (PyCFunction) connCreateLO, METH_VARARGS, connCreateLO__doc__},
    3373     {"getlo", (PyCFunction) connGetLO, METH_VARARGS, connGetLO__doc__},
    3374     {"loimport", (PyCFunction) connImportLO, METH_VARARGS, connImportLO__doc__},
     3380    {"locreate", (PyCFunction) conn_locreate,
     3381        METH_VARARGS, conn_locreate__doc__},
     3382    {"getlo", (PyCFunction) conn_getlo,
     3383        METH_VARARGS, conn_getlo__doc__},
     3384    {"loimport", (PyCFunction) conn_loimport,
     3385        METH_VARARGS, conn_loimport__doc__},
    33753386#endif /* LARGE_OBJECTS */
    33763387
     
    33803391/* gets connection attributes */
    33813392static PyObject *
    3382 connGetAttr(connObject *self, PyObject *nameobj)
     3393conn_getattr(connObject *self, PyObject *nameobj)
    33833394{
    33843395    const char *name = PyStr_AsString(nameobj);
     
    33873398     * Although we could check individually, there are only a few
    33883399     * attributes that don't require a live connection and unless someone
    3389      * has an urgent need, this will have to do
     3400     * has an urgent need, this will have to do.
    33903401     */
    33913402
     
    34443455static PyTypeObject connType = {
    34453456    PyVarObject_HEAD_INIT(NULL, 0)
    3446     "pg.Connection",            /* tp_name */
    3447     sizeof(connObject),         /* tp_basicsize */
    3448     0,                          /* tp_itemsize */
    3449     (destructor) connDelete,    /* tp_dealloc */
    3450     0,                          /* tp_print */
    3451     0,                          /* tp_getattr */
    3452     0,                          /* tp_setattr */
    3453     0,                          /* tp_reserved */
    3454     0,                          /* tp_repr */
    3455     0,                          /* tp_as_number */
    3456     0,                          /* tp_as_sequence */
    3457     0,                          /* tp_as_mapping */
    3458     0,                          /* tp_hash */
    3459     0,                          /* tp_call */
    3460     0,                          /* tp_str */
    3461     (getattrofunc) connGetAttr, /* tp_getattro */
    3462     0,                          /* tp_setattro */
    3463     0,                          /* tp_as_buffer */
    3464     Py_TPFLAGS_DEFAULT,         /* tp_flags */
    3465     0,                          /* tp_doc */
    3466     0,                          /* tp_traverse */
    3467     0,                          /* tp_clear */
    3468     0,                          /* tp_richcompare */
    3469     0,                          /* tp_weaklistoffset */
    3470     0,                          /* tp_iter */
    3471     0,                          /* tp_iternext */
    3472     connMethods,                /* tp_methods */
     3457    "pg.Connection",              /* tp_name */
     3458    sizeof(connObject),           /* tp_basicsize */
     3459    0,                            /* tp_itemsize */
     3460    (destructor) conn_delete,     /* tp_dealloc */
     3461    0,                            /* tp_print */
     3462    0,                            /* tp_getattr */
     3463    0,                            /* tp_setattr */
     3464    0,                            /* tp_reserved */
     3465    0,                            /* tp_repr */
     3466    0,                            /* tp_as_number */
     3467    0,                            /* tp_as_sequence */
     3468    0,                            /* tp_as_mapping */
     3469    0,                            /* tp_hash */
     3470    0,                            /* tp_call */
     3471    0,                            /* tp_str */
     3472    (getattrofunc) conn_getattr, /* tp_getattro */
     3473    0,                            /* tp_setattro */
     3474    0,                            /* tp_as_buffer */
     3475    Py_TPFLAGS_DEFAULT,           /* tp_flags */
     3476    0,                            /* tp_doc */
     3477    0,                            /* tp_traverse */
     3478    0,                            /* tp_clear */
     3479    0,                            /* tp_richcompare */
     3480    0,                            /* tp_weaklistoffset */
     3481    0,                            /* tp_iter */
     3482    0,                            /* tp_iternext */
     3483    conn_methods,                 /* tp_methods */
    34733484};
    34743485
     
    35043515/* destructor */
    35053516static void
    3506 sourceDealloc(sourceObject *self)
     3517source_dealloc(sourceObject *self)
    35073518{
    35083519    if (self->result)
     
    35143525
    35153526/* closes object */
    3516 static char sourceClose__doc__[] =
     3527static char source_close__doc__[] =
    35173528"close() -- close query object without deleting it\n\n"
    35183529"All instances of the query object can no longer be used after this call.\n";
    35193530
    35203531static PyObject *
    3521 sourceClose(sourceObject *self, PyObject *noargs)
     3532source_close(sourceObject *self, PyObject *noargs)
    35223533{
    35233534    /* frees result if necessary and invalidates object */
     
    35363547
    35373548/* database query */
    3538 static char sourceExecute__doc__[] =
     3549static char source_execute__doc__[] =
    35393550"execute(sql) -- execute a SQL statement (string)\n\n"
    35403551"On success, this call returns the number of affected rows, or None\n"
     
    35433554
    35443555static PyObject *
    3545 sourceExecute(sourceObject *self, PyObject *sql)
     3556source_execute(sourceObject *self, PyObject *sql)
    35463557{
    35473558    PyObject *tmp_obj = NULL;  /* auxiliary string object */
     
    36493660
    36503661/* gets oid status for last query (valid for INSERTs, 0 for other) */
    3651 static char sourceStatusOID__doc__[] =
     3662static char source_oidstatus__doc__[] =
    36523663"oidstatus() -- return oid of last inserted row (if available)";
    36533664
    36543665static PyObject *
    3655 sourceStatusOID(sourceObject *self, PyObject *noargs)
     3666source_oidstatus(sourceObject *self, PyObject *noargs)
    36563667{
    36573668    Oid oid;
     
    36723683
    36733684/* fetches rows from last result */
    3674 static char sourceFetch__doc__[] =
     3685static char source_fetch__doc__[] =
    36753686"fetch(num) -- return the next num rows from the last result in a list\n\n"
    36763687"If num parameter is omitted arraysize attribute value is used.\n"
     
    36783689
    36793690static PyObject *
    3680 sourceFetch(sourceObject *self, PyObject *args)
    3681 {
    3682     PyObject *reslist;
     3691source_fetch(sourceObject *self, PyObject *args)
     3692{
     3693    PyObject *res_list;
    36833694    int i, k;
    36843695    long size;
     
    37073718
    37083719    /* allocate list for result */
    3709     if (!(reslist = PyList_New(0))) return NULL;
     3720    if (!(res_list = PyList_New(0))) return NULL;
    37103721
    37113722#if IS_PY3
     
    37193730
    37203731        if (!(rowtuple = PyTuple_New(self->num_fields))) {
    3721             Py_DECREF(reslist); return NULL;
     3732            Py_DECREF(res_list); return NULL;
    37223733        }
    37233734
     
    37453756        }
    37463757
    3747         if (PyList_Append(reslist, rowtuple)) {
    3748             Py_DECREF(rowtuple); Py_DECREF(reslist); return NULL;
     3758        if (PyList_Append(res_list, rowtuple)) {
     3759            Py_DECREF(rowtuple); Py_DECREF(res_list); return NULL;
    37493760        }
    37503761        Py_DECREF(rowtuple);
     
    37523763
    37533764    self->current_row = k;
    3754     return reslist;
     3765    return res_list;
    37553766}
    37563767
    37573768/* changes current row (internal wrapper for all "move" methods) */
    37583769static PyObject *
    3759 pgsource_move(sourceObject *self, int move)
     3770_source_move(sourceObject *self, int move)
    37603771{
    37613772    /* checks validity */
     
    37873798
    37883799/* move to first result row */
    3789 static char sourceMoveFirst__doc__[] =
     3800static char source_movefirst__doc__[] =
    37903801"movefirst() -- move to first result row";
    37913802
    37923803static PyObject *
    3793 sourceMoveFirst(sourceObject *self, PyObject *noargs)
    3794 {
    3795     return pgsource_move(self, QUERY_MOVEFIRST);
     3804source_movefirst(sourceObject *self, PyObject *noargs)
     3805{
     3806    return _source_move(self, QUERY_MOVEFIRST);
    37963807}
    37973808
    37983809/* move to last result row */
    3799 static char sourceMoveLast__doc__[] =
     3810static char source_movelast__doc__[] =
    38003811"movelast() -- move to last valid result row";
    38013812
    38023813static PyObject *
    3803 sourceMoveLast(sourceObject *self, PyObject *noargs)
    3804 {
    3805     return pgsource_move(self, QUERY_MOVELAST);
     3814source_movelast(sourceObject *self, PyObject *noargs)
     3815{
     3816    return _source_move(self, QUERY_MOVELAST);
    38063817}
    38073818
    38083819/* move to next result row */
    3809 static char sourceMoveNext__doc__[] =
     3820static char source_movenext__doc__[] =
    38103821"movenext() -- move to next result row";
    38113822
    38123823static PyObject *
    3813 sourceMoveNext(sourceObject *self, PyObject *noargs)
    3814 {
    3815     return pgsource_move(self, QUERY_MOVENEXT);
     3824source_movenext(sourceObject *self, PyObject *noargs)
     3825{
     3826    return _source_move(self, QUERY_MOVENEXT);
    38163827}
    38173828
    38183829/* move to previous result row */
    3819 static char sourceMovePrev__doc__[] =
     3830static char source_moveprev__doc__[] =
    38203831"moveprev() -- move to previous result row";
    38213832
    38223833static PyObject *
    3823 sourceMovePrev(sourceObject *self, PyObject *noargs)
    3824 {
    3825     return pgsource_move(self, QUERY_MOVEPREV);
     3834source_moveprev(sourceObject *self, PyObject *noargs)
     3835{
     3836    return _source_move(self, QUERY_MOVEPREV);
    38263837}
    38273838
    38283839/* put copy data */
    3829 static char sourcePutData__doc__[] =
     3840static char source_putdata__doc__[] =
    38303841"putdata(buffer) -- send data to server during copy from stdin";
    38313842
    38323843static PyObject *
    3833 sourcePutData(sourceObject *self, PyObject *buffer)
     3844source_putdata(sourceObject *self, PyObject *buffer)
    38343845{
    38353846    PyObject *tmp_obj = NULL;  /* an auxiliary object */
     
    39443955
    39453956/* get copy data */
    3946 static char sourceGetData__doc__[] =
     3957static char source_getdata__doc__[] =
    39473958"getdata(decode) -- receive data to server during copy to stdout";
    39483959
    39493960static PyObject *
    3950 sourceGetData(sourceObject *self, PyObject *args)
     3961source_getdata(sourceObject *self, PyObject *args)
    39513962{
    39523963    int *decode = 0;    /* decode flag */
     
    40214032/* finds field number from string/integer (internal use only) */
    40224033static int
    4023 sourceFieldindex(sourceObject *self, PyObject *param, const char *usage)
     4034_source_fieldindex(sourceObject *self, PyObject *param, const char *usage)
    40244035{
    40254036    int num;
     
    40524063/* builds field information from position (internal use only) */
    40534064static PyObject *
    4054 pgsource_buildinfo(sourceObject *self, int num)
     4065_source_buildinfo(sourceObject *self, int num)
    40554066{
    40564067    PyObject *result;
     
    40774088
    40784089/* lists fields info */
    4079 static char sourceListInfo__doc__[] =
     4090static char source_listinfo__doc__[] =
    40804091"listinfo() -- get information for all fields (position, name, type oid)";
    40814092
    40824093static PyObject *
    4083 sourceListInfo(sourceObject *self, PyObject *noargs)
     4094source_listInfo(sourceObject *self, PyObject *noargs)
    40844095{
    40854096    PyObject *result, *info;
     
    40974108
    40984109    for (i = 0; i < self->num_fields; ++i) {
    4099         info = pgsource_buildinfo(self, i);
     4110        info = _source_buildinfo(self, i);
    41004111        if (!info) {
    41014112            Py_DECREF(result);
     
    41104121
    41114122/* list fields information for last result */
    4112 static char sourceFieldInfo__doc__[] =
     4123static char source_fieldinfo__doc__[] =
    41134124"fieldinfo(desc) -- get specified field info (position, name, type oid)";
    41144125
    41154126static PyObject *
    4116 sourceFieldInfo(sourceObject *self, PyObject *desc)
     4127source_fieldinfo(sourceObject *self, PyObject *desc)
    41174128{
    41184129    int num;
    41194130
    41204131    /* checks args and validity */
    4121     if ((num = sourceFieldindex(
     4132    if ((num = _source_fieldindex(
    41224133        self, desc,
    41234134        "Method fieldinfo() needs a string or integer as argument")) == -1)
     
    41274138
    41284139    /* returns result */
    4129     return pgsource_buildinfo(self, num);
     4140    return _source_buildinfo(self, num);
    41304141};
    41314142
    41324143/* retrieve field value */
    4133 static char sourceField__doc__[] =
     4144static char source_field__doc__[] =
    41344145"field(desc) -- return specified field value";
    41354146
    41364147static PyObject *
    4137 sourceField(sourceObject *self, PyObject *desc)
     4148source_field(sourceObject *self, PyObject *desc)
    41384149{
    41394150    int num;
    41404151
    41414152    /* checks args and validity */
    4142     if ((num = sourceFieldindex(
     4153    if ((num = _source_fieldindex(
    41434154        self, desc,
    41444155        "Method field() needs a string or integer as argument")) == -1)
     
    41534164/* get the list of source object attributes */
    41544165static PyObject *
    4155 sourceDir(connObject *self, PyObject *noargs)
     4166source_dir(connObject *self, PyObject *noargs)
    41564167{
    41574168    PyObject *attrs;
     
    41664177
    41674178/* source object methods */
    4168 static PyMethodDef sourceMethods[] = {
    4169     {"__dir__", (PyCFunction) sourceDir,  METH_NOARGS, NULL},
    4170     {"close", (PyCFunction) sourceClose, METH_NOARGS, sourceClose__doc__},
    4171     {"execute", (PyCFunction) sourceExecute, METH_O, sourceExecute__doc__},
    4172     {"oidstatus", (PyCFunction) sourceStatusOID, METH_NOARGS,
    4173             sourceStatusOID__doc__},
    4174     {"fetch", (PyCFunction) sourceFetch, METH_VARARGS,
    4175             sourceFetch__doc__},
    4176     {"movefirst", (PyCFunction) sourceMoveFirst, METH_NOARGS,
    4177             sourceMoveFirst__doc__},
    4178     {"movelast", (PyCFunction) sourceMoveLast, METH_NOARGS,
    4179             sourceMoveLast__doc__},
    4180     {"movenext", (PyCFunction) sourceMoveNext, METH_NOARGS,
    4181             sourceMoveNext__doc__},
    4182     {"moveprev", (PyCFunction) sourceMovePrev, METH_NOARGS,
    4183             sourceMovePrev__doc__},
    4184     {"putdata", (PyCFunction) sourcePutData, METH_O, sourcePutData__doc__},
    4185     {"getdata", (PyCFunction) sourceGetData, METH_VARARGS,
    4186             sourceGetData__doc__},
    4187     {"field", (PyCFunction) sourceField, METH_O,
    4188             sourceField__doc__},
    4189     {"fieldinfo", (PyCFunction) sourceFieldInfo, METH_O,
    4190             sourceFieldInfo__doc__},
    4191     {"listinfo", (PyCFunction) sourceListInfo, METH_NOARGS,
    4192             sourceListInfo__doc__},
     4179static PyMethodDef source_methods[] = {
     4180    {"__dir__", (PyCFunction) source_dir, METH_NOARGS, NULL},
     4181
     4182    {"close", (PyCFunction) source_close,
     4183        METH_NOARGS, source_close__doc__},
     4184    {"execute", (PyCFunction) source_execute,
     4185        METH_O, source_execute__doc__},
     4186    {"oidstatus", (PyCFunction) source_oidstatus,
     4187        METH_NOARGS, source_oidstatus__doc__},
     4188    {"fetch", (PyCFunction) source_fetch,
     4189        METH_VARARGS, source_fetch__doc__},
     4190    {"movefirst", (PyCFunction) source_movefirst,
     4191        METH_NOARGS, source_movefirst__doc__},
     4192    {"movelast", (PyCFunction) source_movelast,
     4193        METH_NOARGS, source_movelast__doc__},
     4194    {"movenext", (PyCFunction) source_movenext,
     4195        METH_NOARGS, source_movenext__doc__},
     4196    {"moveprev", (PyCFunction) source_moveprev,
     4197        METH_NOARGS, source_moveprev__doc__},
     4198    {"putdata", (PyCFunction) source_putdata,
     4199        METH_O, source_putdata__doc__},
     4200    {"getdata", (PyCFunction) source_getdata,
     4201        METH_VARARGS, source_getdata__doc__},
     4202    {"field", (PyCFunction) source_field,
     4203        METH_O, source_field__doc__},
     4204    {"fieldinfo", (PyCFunction) source_fieldinfo,
     4205        METH_O, source_fieldinfo__doc__},
     4206    {"listinfo", (PyCFunction) source_listInfo,
     4207        METH_NOARGS, source_listinfo__doc__},
    41934208    {NULL, NULL}
    41944209};
     
    41964211/* gets source object attributes */
    41974212static PyObject *
    4198 sourceGetAttr(sourceObject *self, PyObject *nameobj)
     4213source_getattr(sourceObject *self, PyObject *nameobj)
    41994214{
    42004215    const char *name = PyStr_AsString(nameobj);
     
    42324247/* sets query object attributes */
    42334248static int
    4234 sourceSetAttr(sourceObject *self, char *name, PyObject *v)
     4249source_setattr(sourceObject *self, char *name, PyObject *v)
    42354250{
    42364251    /* arraysize */
     
    42524267/* return source object as string in human readable form */
    42534268static PyObject *
    4254 sourceStr(sourceObject *self)
     4269source_str(sourceObject *self)
    42554270{
    42564271    switch (self->result_type) {
     
    42754290    0,                              /* tp_itemsize */
    42764291    /* methods */
    4277     (destructor) sourceDealloc,     /* tp_dealloc */
     4292    (destructor) source_dealloc,    /* tp_dealloc */
    42784293    0,                              /* tp_print */
    42794294    0,                              /* tp_getattr */
    4280     (setattrfunc) sourceSetAttr,    /* tp_setattr */
     4295    (setattrfunc) source_setattr,   /* tp_setattr */
    42814296    0,                              /* tp_compare */
    42824297    0,                              /* tp_repr */
     
    42864301    0,                              /* tp_hash */
    42874302    0,                              /* tp_call */
    4288     (reprfunc) sourceStr,           /* tp_str */
    4289     (getattrofunc) sourceGetAttr,   /* tp_getattro */
     4303    (reprfunc) source_str,          /* tp_str */
     4304    (getattrofunc) source_getattr,  /* tp_getattro */
    42904305    0,                              /* tp_setattro */
    42914306    0,                              /* tp_as_buffer */
     
    42984313    0,                              /* tp_iter */
    42994314    0,                              /* tp_iternext */
    4300     sourceMethods,                  /* tp_methods */
     4315    source_methods,                 /* tp_methods */
    43014316};
    43024317
    43034318/* connects to a database */
    4304 static char pgConnect__doc__[] =
     4319static char pg_connect__doc__[] =
    43054320"connect(dbname, host, port, opt) -- connect to a PostgreSQL database\n\n"
    43064321"The connection uses the specified parameters (optional, keywords aware).\n";
    43074322
    43084323static PyObject *
    4309 pgConnect(PyObject *self, PyObject *args, PyObject *dict)
     4324pg_connect(PyObject *self, PyObject *args, PyObject *dict)
    43104325{
    43114326    static const char *kwlist[] =
     
    43874402
    43884403static void
    4389 queryDealloc(queryObject *self)
     4404query_dealloc(queryObject *self)
    43904405{
    43914406    Py_XDECREF(self->pgcnx);
     
    44014416
    44024417/* get number of rows */
    4403 static char queryNtuples__doc__[] =
     4418static char query_ntuples__doc__[] =
    44044419"ntuples() -- return number of tuples returned by query";
    44054420
    44064421static PyObject *
    4407 queryNtuples(queryObject *self, PyObject *noargs)
     4422query_ntuples(queryObject *self, PyObject *noargs)
    44084423{
    44094424    return PyInt_FromLong(self->max_row);
     
    44114426
    44124427/* list fields names from query result */
    4413 static char queryListfields__doc__[] =
     4428static char query_listfields__doc__[] =
    44144429"listfields() -- List field names from result";
    44154430
    44164431static PyObject *
    4417 queryListfields(queryObject *self, PyObject *noargs)
     4432query_listfields(queryObject *self, PyObject *noargs)
    44184433{
    44194434    int i;
     
    44344449
    44354450/* get field name from last result */
    4436 static char queryFieldname__doc__[] =
     4451static char query_fieldname__doc__[] =
    44374452"fieldname(num) -- return name of field from result from its position";
    44384453
    44394454static PyObject *
    4440 queryFieldname(queryObject *self, PyObject *args)
     4455query_fieldname(queryObject *self, PyObject *args)
    44414456{
    44424457    int i;
     
    44624477
    44634478/* gets fields number from name in last result */
    4464 static char queryFieldnum__doc__[] =
     4479static char query_fieldnum__doc__[] =
    44654480"fieldnum(name) -- return position in query for field from its name";
    44664481
    44674482static PyObject *
    4468 queryFieldnum(queryObject *self, PyObject *args)
     4483query_fieldnum(queryObject *self, PyObject *args)
    44694484{
    44704485    int num;
     
    44894504/* The __iter__() method of the queryObject.
    44904505   This returns the default iterator yielding rows as tuples. */
    4491 static PyObject* queryGetIter(queryObject *self)
     4506static PyObject* query_iter(queryObject *self)
    44924507{
    44934508    self->current_row = 0;
     
    44984513/* Return the value in the given column of the current row. */
    44994514static PyObject *
    4500 getValueInColumn(queryObject *self, int column)
     4515_query_value_in_column(queryObject *self, int column)
    45014516{
    45024517    char *s;
     
    45354550/* Return the current row as a tuple. */
    45364551static PyObject *
    4537 queryGetRowAsTuple(queryObject *self)
     4552_query_row_as_tuple(queryObject *self)
    45384553{
    45394554    PyObject *row_tuple = NULL;
     
    45454560
    45464561    for (j = 0; j < self->num_fields; ++j) {
    4547         PyObject *val = getValueInColumn(self, j);
     4562        PyObject *val = _query_value_in_column(self, j);
    45484563        if (!val) {
    45494564            Py_DECREF(row_tuple); return NULL;
     
    45584573   Returns the current current row as a tuple and moves to the next one. */
    45594574static PyObject *
    4560 queryNext(queryObject *self, PyObject *noargs)
     4575query_next(queryObject *self, PyObject *noargs)
    45614576{
    45624577    PyObject *row_tuple = NULL;
     
    45674582    }
    45684583
    4569     row_tuple = queryGetRowAsTuple(self);
     4584    row_tuple = _query_row_as_tuple(self);
    45704585    if (row_tuple) ++self->current_row;
    45714586    return row_tuple;
     
    45734588
    45744589/* Retrieves one row from the result as a tuple. */
    4575 static char queryOne__doc__[] =
     4590static char query_one__doc__[] =
    45764591"one() -- Get one row from the result of a query\n\n"
    45774592"Only one row from the result is returned as a tuple of fields.\n"
     
    45804595
    45814596static PyObject *
    4582 queryOne(queryObject *self, PyObject *noargs)
     4597query_one(queryObject *self, PyObject *noargs)
    45834598{
    45844599    PyObject *row_tuple;
     
    45884603    }
    45894604
    4590     row_tuple = queryGetRowAsTuple(self);
     4605    row_tuple = _query_row_as_tuple(self);
    45914606    if (row_tuple) ++self->current_row;
    45924607    return row_tuple;
     
    45944609
    45954610/* Retrieves the single row from the result as a tuple. */
    4596 static char querySingle__doc__[] =
     4611static char query_single__doc__[] =
    45974612"single() -- Get the result of a query as single row\n\n"
    45984613"The single row from the query result is returned as a tuple of fields.\n"
     
    46014616
    46024617static PyObject *
    4603 querySingle(queryObject *self, PyObject *noargs)
     4618query_single(queryObject *self, PyObject *noargs)
    46044619{
    46054620    PyObject *row_tuple;
     
    46124627
    46134628    self->current_row = 0;
    4614     row_tuple = queryGetRowAsTuple(self);
     4629    row_tuple = _query_row_as_tuple(self);
    46154630    if (row_tuple) ++self->current_row;
    46164631    return row_tuple;
     
    46184633
    46194634/* Retrieves the last query result as a list of tuples. */
    4620 static char queryGetresult__doc__[] =
     4635static char query_getresult__doc__[] =
    46214636"getresult() -- Get the result of a query\n\n"
    46224637"The result is returned as a list of rows, each one a tuple of fields\n"
     
    46244639
    46254640static PyObject *
    4626 queryGetresult(queryObject *self, PyObject *noargs)
     4641query_getresult(queryObject *self, PyObject *noargs)
    46274642{
    46284643    PyObject *result_list;
     
    46344649
    46354650    for (i = self->current_row = 0; i < self->max_row; ++i) {
    4636         PyObject *row_tuple = queryNext(self, noargs);
     4651        PyObject *row_tuple = query_next(self, noargs);
    46374652
    46384653        if (!row_tuple) {
     
    46474662/* Return the current row as a dict. */
    46484663static PyObject *
    4649 queryGetRowAsDict(queryObject *self)
     4664_query_row_as_dict(queryObject *self)
    46504665{
    46514666    PyObject *row_dict = NULL;
     
    46574672
    46584673    for (j = 0; j < self->num_fields; ++j) {
    4659         PyObject *val = getValueInColumn(self, j);
     4674        PyObject *val = _query_value_in_column(self, j);
    46604675
    46614676        if (!val) {
     
    46714686/* Return the current current row as a dict and move to the next one. */
    46724687static PyObject *
    4673 queryNextDict(queryObject *self, PyObject *noargs)
     4688query_next_dict(queryObject *self, PyObject *noargs)
    46744689{
    46754690    PyObject *row_dict = NULL;
     
    46804695    }
    46814696
    4682     row_dict = queryGetRowAsDict(self);
     4697    row_dict = _query_row_as_dict(self);
    46834698    if (row_dict) ++self->current_row;
    46844699    return row_dict;
     
    46864701
    46874702/* Retrieve one row from the result as a dictionary. */
    4688 static char queryOnedict__doc__[] =
     4703static char query_onedict__doc__[] =
    46894704"onedict() -- Get one row from the result of a query\n\n"
    46904705"Only one row from the result is returned as a dictionary with\n"
     
    46944709
    46954710static PyObject *
    4696 queryOnedict(queryObject *self, PyObject *noargs)
     4711query_onedict(queryObject *self, PyObject *noargs)
    46974712{
    46984713    PyObject *row_dict;
     
    47024717    }
    47034718
    4704     row_dict = queryGetRowAsDict(self);
     4719    row_dict = _query_row_as_dict(self);
    47054720    if (row_dict) ++self->current_row;
    47064721    return row_dict;
     
    47084723
    47094724/* Retrieve the single row from the result as a dictionary. */
    4710 static char querySingledict__doc__[] =
     4725static char query_singledict__doc__[] =
    47114726"singledict() -- Get the result of a query as single row\n\n"
    47124727"The single row from the query result is returned as a dictionary with\n"
     
    47164731
    47174732static PyObject *
    4718 querySingledict(queryObject *self, PyObject *noargs)
     4733query_singledict(queryObject *self, PyObject *noargs)
    47194734{
    47204735    PyObject *row_dict;
     
    47274742
    47284743    self->current_row = 0;
    4729     row_dict = queryGetRowAsDict(self);
     4744    row_dict = _query_row_as_dict(self);
    47304745    if (row_dict) ++self->current_row;
    47314746    return row_dict;
     
    47334748
    47344749/* Retrieve the last query result as a list of dictionaries. */
    4735 static char queryDictresult__doc__[] =
     4750static char query_dictresult__doc__[] =
    47364751"dictresult() -- Get the result of a query\n\n"
    47374752"The result is returned as a list of rows, each one a dictionary with\n"
     
    47394754
    47404755static PyObject *
    4741 queryDictresult(queryObject *self, PyObject *noargs)
     4756query_dictresult(queryObject *self, PyObject *noargs)
    47424757{
    47434758    PyObject *result_list;
     
    47494764
    47504765    for (i = self->current_row = 0; i < self->max_row; ++i) {
    4751         PyObject *row_dict = queryNextDict(self, noargs);
     4766        PyObject *row_dict = query_next_dict(self, noargs);
    47524767
    47534768        if (!row_dict) {
     
    47614776
    47624777/* Retrieve last result as iterator of dictionaries. */
    4763 static char queryDictiter__doc__[] =
     4778static char query_dictiter__doc__[] =
    47644779"dictiter() -- Get the result of a query\n\n"
    47654780"The result is returned as an iterator of rows, each one a a dictionary\n"
     
    47674782
    47684783static PyObject *
    4769 queryDictiter(queryObject *self, PyObject *noargs)
     4784query_dictiter(queryObject *self, PyObject *noargs)
    47704785{
    47714786    if (!dictiter) {
    4772         return queryDictresult(self, noargs);
     4787        return query_dictresult(self, noargs);
    47734788    }
    47744789
     
    47774792
    47784793/* Retrieve one row from the result as a named tuple. */
    4779 static char queryOnenamed__doc__[] =
     4794static char query_onenamed__doc__[] =
    47804795"onenamed() -- Get one row from the result of a query\n\n"
    47814796"Only one row from the result is returned as a named tuple of fields.\n"
     
    47844799
    47854800static PyObject *
    4786 queryOnenamed(queryObject *self, PyObject *noargs)
     4801query_onenamed(queryObject *self, PyObject *noargs)
    47874802{
    47884803    if (!namednext) {
    4789         return queryOne(self, noargs);
     4804        return query_one(self, noargs);
    47904805    }
    47914806
     
    47984813
    47994814/* Retrieve the single row from the result as a tuple. */
    4800 static char querySinglenamed__doc__[] =
     4815static char query_singlenamed__doc__[] =
    48014816"singlenamed() -- Get the result of a query as single row\n\n"
    4802 "The single row from the query result is returned as a named tuple of fields.\n"
     4817"The single row from the query result is returned as named tuple of fields.\n"
    48034818"This method returns the same single row when called multiple times.\n"
    48044819"It raises a ProgrammingError if the result does not have exactly one row.\n";
    48054820
    48064821static PyObject *
    4807 querySinglenamed(queryObject *self, PyObject *noargs)
     4822query_singlenamed(queryObject *self, PyObject *noargs)
    48084823{
    48094824    if (!namednext) {
    4810         return querySingle(self, noargs);
     4825        return query_single(self, noargs);
    48114826    }
    48124827
     
    48224837
    48234838/* Retrieve last result as list of named tuples. */
    4824 static char queryNamedresult__doc__[] =
     4839static char query_namedresult__doc__[] =
    48254840"namedresult() -- Get the result of a query\n\n"
    48264841"The result is returned as a list of rows, each one a named tuple of fields\n"
     
    48284843
    48294844static PyObject *
    4830 queryNamedresult(queryObject *self, PyObject *noargs)
     4845query_namedresult(queryObject *self, PyObject *noargs)
    48314846{
    48324847    PyObject *res, *res_list;
    48334848
    48344849    if (!namediter) {
    4835         return queryGetresult(self, noargs);
     4850        return query_getresult(self, noargs);
    48364851    }
    48374852
     
    48454860
    48464861/* Retrieve last result as iterator of named tuples. */
    4847 static char queryNamediter__doc__[] =
     4862static char query_namediter__doc__[] =
    48484863"namediter() -- Get the result of a query\n\n"
    48494864"The result is returned as an iterator of rows, each one a named tuple\n"
     
    48514866
    48524867static PyObject *
    4853 queryNamediter(queryObject *self, PyObject *noargs)
     4868query_namediter(queryObject *self, PyObject *noargs)
    48544869{
    48554870    PyObject *res, *res_iter;
    48564871
    48574872    if (!namediter) {
    4858         return queryGetIter(self);
     4873        return query_iter(self);
    48594874    }
    48604875
     
    48684883
    48694884/* Retrieve the last query result as a list of scalar values. */
    4870 static char queryScalarresult__doc__[] =
     4885static char query_scalarresult__doc__[] =
    48714886"scalarresult() -- Get query result as scalars\n\n"
    48724887"The result is returned as a list of scalar values where the values\n"
     
    48744889
    48754890static PyObject *
    4876 queryScalarresult(queryObject *self, PyObject *noargs)
     4891query_scalarresult(queryObject *self, PyObject *noargs)
    48774892{
    48784893    PyObject *result_list;
     
    48914906         ++self->current_row)
    48924907    {
    4893         PyObject *value = getValueInColumn(self, 0);
     4908        PyObject *value = _query_value_in_column(self, 0);
    48944909
    48954910        if (!value) {
     
    49034918
    49044919/* Retrieve the last query result as iterator of scalar values. */
    4905 static char queryScalariter__doc__[] =
     4920static char query_scalariter__doc__[] =
    49064921"scalariter() -- Get query result as scalars\n\n"
    49074922"The result is returned as an iterator of scalar values where the values\n"
     
    49094924
    49104925static PyObject *
    4911 queryScalariter(queryObject *self, PyObject *noargs)
     4926query_scalariter(queryObject *self, PyObject *noargs)
    49124927{
    49134928    if (!scalariter) {
    4914         return queryScalarresult(self, noargs);
     4929        return query_scalarresult(self, noargs);
    49154930    }
    49164931
     
    49244939
    49254940/* Retrieve one result as scalar value. */
    4926 static char queryOnescalar__doc__[] =
     4941static char query_onescalar__doc__[] =
    49274942"onescalar() -- Get one scalar value from the result of a query\n\n"
    49284943"Returns the first field of the next row from the result as a scalar value.\n"
     
    49314946
    49324947static PyObject *
    4933 queryOnescalar(queryObject *self, PyObject *noargs)
     4948query_onescalar(queryObject *self, PyObject *noargs)
    49344949{
    49354950    PyObject *value;
     
    49444959    }
    49454960
    4946     value = getValueInColumn(self, 0);
     4961    value = _query_value_in_column(self, 0);
    49474962    if (value) ++self->current_row;
    49484963    return value;
     
    49504965
    49514966/* Retrieves the single row from the result as a tuple. */
    4952 static char querySinglescalar__doc__[] =
     4967static char query_singlescalar__doc__[] =
    49534968"singlescalar() -- Get scalar value from single result of a query\n\n"
    49544969"Returns the first field of the next row from the result as a scalar value.\n"
     
    49574972
    49584973static PyObject *
    4959 querySinglescalar(queryObject *self, PyObject *noargs)
     4974query_singlescalar(queryObject *self, PyObject *noargs)
    49604975{
    49614976    PyObject *value;
     
    49734988
    49744989    self->current_row = 0;
    4975     value = getValueInColumn(self, 0);
     4990    value = _query_value_in_column(self, 0);
    49764991    if (value) ++self->current_row;
    49774992    return value;
     
    49804995/* Return length of a query object. */
    49814996static Py_ssize_t
    4982 queryLen(PyObject *self)
     4997query_len(PyObject *self)
    49834998{
    49844999    PyObject *tmp;
     
    49935008/* Return given item from a query object. */
    49945009static PyObject *
    4995 queryGetItem(PyObject *self, Py_ssize_t i)
     5010query_getitem(PyObject *self, Py_ssize_t i)
    49965011{
    49975012    queryObject *q = (queryObject *) self;
     
    50095024
    50105025    q->current_row = row;
    5011     return queryGetRowAsTuple(q);
     5026    return _query_row_as_tuple(q);
    50125027}
    50135028
    50145029/* gets notice object attributes */
    50155030static PyObject *
    5016 noticeGetAttr(noticeObject *self, PyObject *nameobj)
     5031notice_getattr(noticeObject *self, PyObject *nameobj)
    50175032{
    50185033    PGresult const *res = self->res;
     
    50675082/* return notice as string in human readable form */
    50685083static PyObject *
    5069 noticeStr(noticeObject *self)
    5070 {
    5071     return noticeGetAttr(self, PyBytes_FromString("message"));
     5084notice_str(noticeObject *self)
     5085{
     5086    return notice_getattr(self, PyBytes_FromString("message"));
    50725087}
    50735088
    50745089/* get the list of notice attributes */
    50755090static PyObject *
    5076 noticeDir(noticeObject *self, PyObject *noargs)
     5091notice_dir(noticeObject *self, PyObject *noargs)
    50775092{
    50785093    PyObject *attrs;
     
    50875102
    50885103/* notice object methods */
    5089 static struct PyMethodDef noticeMethods[] = {
    5090     {"__dir__", (PyCFunction) noticeDir,  METH_NOARGS, NULL},
     5104static struct PyMethodDef notice_methods[] = {
     5105    {"__dir__", (PyCFunction) notice_dir,  METH_NOARGS, NULL},
    50915106    {NULL, NULL}
    50925107};
     
    51105125    0,                              /* tp_hash */
    51115126    0,                              /* tp_call */
    5112     (reprfunc) noticeStr,           /* tp_str */
    5113     (getattrofunc) noticeGetAttr,   /* tp_getattro */
     5127    (reprfunc) notice_str,          /* tp_str */
     5128    (getattrofunc) notice_getattr,  /* tp_getattro */
    51145129    PyObject_GenericSetAttr,        /* tp_setattro */
    51155130    0,                              /* tp_as_buffer */
     
    51225137    0,                              /* tp_iter */
    51235138    0,                              /* tp_iternext */
    5124     noticeMethods,                  /* tp_methods */
     5139    notice_methods,                 /* tp_methods */
    51255140};
    51265141
    51275142/* query object methods */
    51285143static struct PyMethodDef queryMethods[] = {
    5129     {"getresult", (PyCFunction) queryGetresult, METH_NOARGS,
    5130             queryGetresult__doc__},
    5131     {"dictresult", (PyCFunction) queryDictresult, METH_NOARGS,
    5132             queryDictresult__doc__},
    5133     {"dictiter", (PyCFunction) queryDictiter, METH_NOARGS,
    5134             queryDictiter__doc__},
    5135     {"namedresult", (PyCFunction) queryNamedresult, METH_NOARGS,
    5136             queryNamedresult__doc__},
    5137     {"namediter", (PyCFunction) queryNamediter, METH_NOARGS,
    5138             queryNamediter__doc__},
    5139     {"one", (PyCFunction) queryOne, METH_NOARGS, queryOne__doc__},
    5140     {"single", (PyCFunction) querySingle, METH_NOARGS, querySingle__doc__},
    5141     {"onedict", (PyCFunction) queryOnedict, METH_NOARGS,
    5142         queryOnedict__doc__},
    5143     {"singledict", (PyCFunction) querySingledict, METH_NOARGS,
    5144         querySingledict__doc__},
    5145     {"onenamed", (PyCFunction) queryOnenamed, METH_NOARGS,
    5146         queryOnenamed__doc__},
    5147     {"singlenamed", (PyCFunction) querySinglenamed, METH_NOARGS,
    5148         querySinglenamed__doc__},
    5149     {"scalarresult", (PyCFunction) queryScalarresult, METH_NOARGS,
    5150             queryScalarresult__doc__},
    5151     {"scalariter", (PyCFunction) queryScalariter, METH_NOARGS,
    5152             queryScalariter__doc__},
    5153     {"onescalar", (PyCFunction) queryOnescalar, METH_NOARGS,
    5154             queryOnescalar__doc__},
    5155     {"singlescalar", (PyCFunction) querySinglescalar, METH_NOARGS,
    5156             querySinglescalar__doc__},
    5157     {"fieldname", (PyCFunction) queryFieldname, METH_VARARGS,
    5158              queryFieldname__doc__},
    5159     {"fieldnum", (PyCFunction) queryFieldnum, METH_VARARGS,
    5160             queryFieldnum__doc__},
    5161     {"listfields", (PyCFunction) queryListfields, METH_NOARGS,
    5162             queryListfields__doc__},
    5163     {"ntuples", (PyCFunction) queryNtuples, METH_NOARGS,
    5164             queryNtuples__doc__},
     5144    {"getresult", (PyCFunction) query_getresult,
     5145        METH_NOARGS, query_getresult__doc__},
     5146    {"dictresult", (PyCFunction) query_dictresult,
     5147        METH_NOARGS, query_dictresult__doc__},
     5148    {"dictiter", (PyCFunction) query_dictiter,
     5149        METH_NOARGS, query_dictiter__doc__},
     5150    {"namedresult", (PyCFunction) query_namedresult,
     5151        METH_NOARGS, query_namedresult__doc__},
     5152    {"namediter", (PyCFunction) query_namediter,
     5153        METH_NOARGS, query_namediter__doc__},
     5154    {"one", (PyCFunction) query_one,
     5155        METH_NOARGS, query_one__doc__},
     5156    {"single", (PyCFunction) query_single,
     5157        METH_NOARGS, query_single__doc__},
     5158    {"onedict", (PyCFunction) query_onedict,
     5159        METH_NOARGS, query_onedict__doc__},
     5160    {"singledict", (PyCFunction) query_singledict,
     5161        METH_NOARGS, query_singledict__doc__},
     5162    {"onenamed", (PyCFunction) query_onenamed,
     5163        METH_NOARGS, query_onenamed__doc__},
     5164    {"singlenamed", (PyCFunction) query_singlenamed,
     5165        METH_NOARGS, query_singlenamed__doc__},
     5166    {"scalarresult", (PyCFunction) query_scalarresult,
     5167        METH_NOARGS, query_scalarresult__doc__},
     5168    {"scalariter", (PyCFunction) query_scalariter,
     5169        METH_NOARGS, query_scalariter__doc__},
     5170    {"onescalar", (PyCFunction) query_onescalar,
     5171        METH_NOARGS, query_onescalar__doc__},
     5172    {"singlescalar", (PyCFunction) query_singlescalar,
     5173        METH_NOARGS, query_singlescalar__doc__},
     5174    {"fieldname", (PyCFunction) query_fieldname,
     5175        METH_VARARGS, query_fieldname__doc__},
     5176    {"fieldnum", (PyCFunction) query_fieldnum,
     5177        METH_VARARGS, query_fieldnum__doc__},
     5178    {"listfields", (PyCFunction) query_listfields,
     5179        METH_NOARGS, query_listfields__doc__},
     5180    {"ntuples", (PyCFunction) query_ntuples,
     5181        METH_NOARGS, query_ntuples__doc__},
    51655182    {NULL, NULL}
    51665183};
    51675184
    51685185/* query sequence protocol methods */
    5169 static PySequenceMethods querySequenceMethods = {
    5170     (lenfunc) queryLen,             /* sq_length */
    5171     0,                              /* sq_concat */
    5172     0,                              /* sq_repeat */
    5173     (ssizeargfunc) queryGetItem,    /* sq_item */
    5174     0,                              /* sq_ass_item */
    5175     0,                              /* sq_contains */
    5176     0,                              /* sq_inplace_concat */
    5177     0,                              /* sq_inplace_repeat */
     5186static PySequenceMethods query_sequence_methods = {
     5187    (lenfunc) query_len,           /* sq_length */
     5188    0,                             /* sq_concat */
     5189    0,                             /* sq_repeat */
     5190    (ssizeargfunc) query_getitem,  /* sq_item */
     5191    0,                             /* sq_ass_item */
     5192    0,                             /* sq_contains */
     5193    0,                             /* sq_inplace_concat */
     5194    0,                             /* sq_inplace_repeat */
    51785195};
    5179 
    51805196
    51815197/* query type definition */
    51825198static PyTypeObject queryType = {
    51835199    PyVarObject_HEAD_INIT(NULL, 0)
    5184     "pg.Query",                 /* tp_name */
    5185     sizeof(queryObject),        /* tp_basicsize */
    5186     0,                          /* tp_itemsize */
     5200    "pg.Query",                  /* tp_name */
     5201    sizeof(queryObject),         /* tp_basicsize */
     5202    0,                           /* tp_itemsize */
    51875203    /* methods */
    5188     (destructor) queryDealloc,  /* tp_dealloc */
    5189     0,                          /* tp_print */
    5190     0,                          /* tp_getattr */
    5191     0,                          /* tp_setattr */
    5192     0,                          /* tp_compare */
    5193     0,                          /* tp_repr */
    5194     0,                          /* tp_as_number */
    5195     &querySequenceMethods,      /* tp_as_sequence */
    5196     0,                          /* tp_as_mapping */
    5197     0,                          /* tp_hash */
    5198     0,                          /* tp_call */
    5199     (reprfunc) queryStr,        /* tp_str */
    5200     PyObject_GenericGetAttr,    /* tp_getattro */
    5201     0,                          /* tp_setattro */
    5202     0,                          /* tp_as_buffer */
     5204    (destructor) query_dealloc,  /* tp_dealloc */
     5205    0,                           /* tp_print */
     5206    0,                           /* tp_getattr */
     5207    0,                           /* tp_setattr */
     5208    0,                           /* tp_compare */
     5209    0,                           /* tp_repr */
     5210    0,                           /* tp_as_number */
     5211    &query_sequence_methods,     /* tp_as_sequence */
     5212    0,                           /* tp_as_mapping */
     5213    0,                           /* tp_hash */
     5214    0,                           /* tp_call */
     5215    (reprfunc) query_str,        /* tp_str */
     5216    PyObject_GenericGetAttr,     /* tp_getattro */
     5217    0,                           /* tp_setattro */
     5218    0,                           /* tp_as_buffer */
    52035219    Py_TPFLAGS_DEFAULT
    5204         |Py_TPFLAGS_HAVE_ITER,  /* tp_flags */
    5205     0,                          /* tp_doc */
    5206     0,                          /* tp_traverse */
    5207     0,                          /* tp_clear */
    5208     0,                          /* tp_richcompare */
    5209     0,                          /* tp_weaklistoffset */
    5210     (getiterfunc) queryGetIter, /* tp_iter */
    5211     (iternextfunc) queryNext,   /* tp_iternext */
    5212     queryMethods,               /* tp_methods */
     5220        |Py_TPFLAGS_HAVE_ITER,   /* tp_flags */
     5221    0,                           /* tp_doc */
     5222    0,                           /* tp_traverse */
     5223    0,                           /* tp_clear */
     5224    0,                           /* tp_richcompare */
     5225    0,                           /* tp_weaklistoffset */
     5226    (getiterfunc) query_iter,    /* tp_iter */
     5227    (iternextfunc) query_next,   /* tp_iternext */
     5228    queryMethods,                /* tp_methods */
    52135229};
    52145230
     
    52185234
    52195235/* escape string */
    5220 static char pgEscapeString__doc__[] =
     5236static char pg_escape_string__doc__[] =
    52215237"escape_string(string) -- escape a string for use within SQL";
    52225238
    52235239static PyObject *
    5224 pgEscapeString(PyObject *self, PyObject *string)
     5240pg_escape_string(PyObject *self, PyObject *string)
    52255241{
    52265242    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    52665282
    52675283/* escape bytea */
    5268 static char pgEscapeBytea__doc__[] =
     5284static char pg_escape_bytea__doc__[] =
    52695285"escape_bytea(data) -- escape binary data for use within SQL as type bytea";
    52705286
    52715287static PyObject *
    5272 pgEscapeBytea(PyObject *self, PyObject *data)
     5288pg_escape_bytea(PyObject *self, PyObject *data)
    52735289{
    52745290    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    53105326
    53115327/* unescape bytea */
    5312 static char pgUnescapeBytea__doc__[] =
     5328static char pg_unescape_bytea__doc__[] =
    53135329"unescape_bytea(string) -- unescape bytea data retrieved as text";
    53145330
    53155331static PyObject *
    5316 pgUnescapeBytea(PyObject *self, PyObject *data)
     5332pg_unescape_bytea(PyObject *self, PyObject *data)
    53175333{
    53185334    PyObject *tmp_obj = NULL,  /* auxiliary string object */
     
    53515367
    53525368/* set fixed datestyle */
    5353 static char pgSetDatestyle__doc__[] =
     5369static char pg_set_datestyle__doc__[] =
    53545370"set_datestyle(style) -- set which style is assumed";
    53555371
    53565372static PyObject *
    5357 pgSetDatestyle(PyObject *self, PyObject *args)
     5373pg_set_datestyle(PyObject *self, PyObject *args)
    53585374{
    53595375    const char *datestyle = NULL;
     
    53735389
    53745390/* get fixed datestyle */
    5375 static char pgGetDatestyle__doc__[] =
     5391static char pg_get_datestyle__doc__[] =
    53765392"get_datestyle() -- get which date style is assumed";
    53775393
    53785394static PyObject *
    5379 pgGetDatestyle(PyObject *self, PyObject *noargs)
     5395pg_get_datestyle(PyObject *self, PyObject *noargs)
    53805396{
    53815397    if (date_format) {
     
    53885404
    53895405/* get decimal point */
    5390 static char pgGetDecimalPoint__doc__[] =
     5406static char pg_get_decimal_point__doc__[] =
    53915407"get_decimal_point() -- get decimal point to be used for money values";
    53925408
    53935409static PyObject *
    5394 pgGetDecimalPoint(PyObject *self, PyObject *noargs)
     5410pg_get_decimal_point(PyObject *self, PyObject *noargs)
    53955411{
    53965412    PyObject *ret;
     
    54095425
    54105426/* set decimal point */
    5411 static char pgSetDecimalPoint__doc__[] =
     5427static char pg_set_decimal_point__doc__[] =
    54125428"set_decimal_point(char) -- set decimal point to be used for money values";
    54135429
    54145430static PyObject *
    5415 pgSetDecimalPoint(PyObject *self, PyObject *args)
     5431pg_set_decimal_point(PyObject *self, PyObject *args)
    54165432{
    54175433    PyObject *ret = NULL;
     
    54395455
    54405456/* get decimal type */
    5441 static char pgGetDecimal__doc__[] =
     5457static char pg_get_decimal__doc__[] =
    54425458"get_decimal() -- get the decimal type to be used for numeric values";
    54435459
    54445460static PyObject *
    5445 pgGetDecimal(PyObject *self, PyObject *noargs)
     5461pg_get_decimal(PyObject *self, PyObject *noargs)
    54465462{
    54475463    PyObject *ret;
     
    54545470
    54555471/* set decimal type */
    5456 static char pgSetDecimal__doc__[] =
     5472static char pg_set_decimal__doc__[] =
    54575473"set_decimal(cls) -- set a decimal type to be used for numeric values";
    54585474
    54595475static PyObject *
    5460 pgSetDecimal(PyObject *self, PyObject *cls)
     5476pg_set_decimal(PyObject *self, PyObject *cls)
    54615477{
    54625478    PyObject *ret = NULL;
     
    54805496
    54815497/* get usage of bool values */
    5482 static char pgGetBool__doc__[] =
     5498static char pg_get_bool__doc__[] =
    54835499"get_bool() -- check whether boolean values are converted to bool";
    54845500
    54855501static PyObject *
    5486 pgGetBool(PyObject *self, PyObject *noargs)
     5502pg_get_bool(PyObject *self, PyObject *noargs)
    54875503{
    54885504    PyObject *ret;
     
    54955511
    54965512/* set usage of bool values */
    5497 static char pgSetBool__doc__[] =
     5513static char pg_set_bool__doc__[] =
    54985514"set_bool(on) -- set whether boolean values should be converted to bool";
    54995515
    55005516static PyObject *
    5501 pgSetBool(PyObject *self, PyObject *args)
     5517pg_set_bool(PyObject *self, PyObject *args)
    55025518{
    55035519    PyObject *ret = NULL;
     
    55195535
    55205536/* get conversion of arrays to lists */
    5521 static char pgGetArray__doc__[] =
     5537static char pg_get_array__doc__[] =
    55225538"get_array() -- check whether arrays are converted as lists";
    55235539
    55245540static PyObject *
    5525 pgGetArray(PyObject *self, PyObject *noargs)
     5541pg_get_array(PyObject *self, PyObject *noargs)
    55265542{
    55275543    PyObject *ret;
     
    55345550
    55355551/* set conversion of arrays to lists */
    5536 static char pgSetArray__doc__[] =
     5552static char pg_set_array__doc__[] =
    55375553"set_array(on) -- set whether arrays should be converted to lists";
    55385554
    55395555static PyObject *
    5540 pgSetArray(PyObject* self, PyObject* args)
     5556pg_set_array(PyObject* self, PyObject* args)
    55415557{
    55425558    PyObject* ret = NULL;
     
    55585574
    55595575/* check whether bytea values are unescaped */
    5560 static char pgGetByteaEscaped__doc__[] =
     5576static char pg_get_bytea_escaped__doc__[] =
    55615577"get_bytea_escaped() -- check whether bytea will be returned escaped";
    55625578
    55635579static PyObject *
    5564 pgGetByteaEscaped(PyObject *self, PyObject *noargs)
     5580pg_get_bytea_escaped(PyObject *self, PyObject *noargs)
    55655581{
    55665582    PyObject *ret;
     
    55735589
    55745590/* set usage of bool values */
    5575 static char pgSetByteaEscaped__doc__[] =
     5591static char pg_set_bytea_escaped__doc__[] =
    55765592"set_bytea_escaped(on) -- set whether bytea will be returned escaped";
    55775593
    55785594static PyObject *
    5579 pgSetByteaEscaped(PyObject *self, PyObject *args)
     5595pg_set_bytea_escaped(PyObject *self, PyObject *args)
    55805596{
    55815597    PyObject *ret = NULL;
     
    55885604    }
    55895605    else {
    5590         PyErr_SetString(
    5591             PyExc_TypeError,
    5592             "Function set_bytea_escaped() expects a boolean value as argument");
     5606        PyErr_SetString(PyExc_TypeError,
     5607                        "Function set_bytea_escaped() expects"
     5608                        " a boolean value as argument");
    55935609    }
    55945610
     
    55965612}
    55975613
    5598 /* set query helper functions */
    5599 
    5600 static char pgSetQueryHelpers__doc__[] =
     5614/* set query helper functions (not part of public API) */
     5615
     5616static char pg_set_query_helpers__doc__[] =
    56015617"set_query_helpers(*helpers) -- set internal query helper functions";
    56025618
    56035619static PyObject *
    5604 pgSetQueryHelpers(PyObject *self, PyObject *args)
     5620pg_set_query_helpers(PyObject *self, PyObject *args)
    56055621{
    56065622    /* gets arguments */
     
    56195635
    56205636/* get json decode function */
    5621 static char pgGetJsondecode__doc__[] =
     5637static char pg_get_jsondecode__doc__[] =
    56225638"get_jsondecode() -- get the function used for decoding json results";
    56235639
    56245640static PyObject *
    5625 pgGetJsondecode(PyObject *self, PyObject *noargs)
     5641pg_get_jsondecode(PyObject *self, PyObject *noargs)
    56265642{
    56275643    PyObject *ret;
     
    56365652
    56375653/* set json decode function */
    5638 static char pgSetJsondecode__doc__[] =
     5654static char pg_set_jsondecode__doc__[] =
    56395655"set_jsondecode(func) -- set a function to be used for decoding json results";
    56405656
    56415657static PyObject *
    5642 pgSetJsondecode(PyObject *self, PyObject *func)
     5658pg_set_jsondecode(PyObject *self, PyObject *func)
    56435659{
    56445660    PyObject *ret = NULL;
     
    56645680
    56655681/* gets default host */
    5666 static char pgGetDefHost__doc__[] =
     5682static char pg_get_defhost__doc__[] =
    56675683"get_defhost() -- return default database host";
    56685684
    56695685static PyObject *
    5670 pgGetDefHost(PyObject *self, PyObject *noargs)
     5686pg_get_defhost(PyObject *self, PyObject *noargs)
    56715687{
    56725688    Py_XINCREF(pg_default_host);
     
    56755691
    56765692/* sets default host */
    5677 static char pgSetDefHost__doc__[] =
     5693static char pg_set_defhost__doc__[] =
    56785694"set_defhost(string) -- set default database host and return previous value";
    56795695
    56805696static PyObject *
    5681 pgSetDefHost(PyObject *self, PyObject *args)
     5697pg_set_defhost(PyObject *self, PyObject *args)
    56825698{
    56835699    char *tmp = NULL;
     
    57075723
    57085724/* gets default base */
    5709 static char pgGetDefBase__doc__[] =
     5725static char pg_get_defbase__doc__[] =
    57105726"get_defbase() -- return default database name";
    57115727
    57125728static PyObject *
    5713 pgGetDefBase(PyObject *self, PyObject *noargs)
     5729pg_get_defbase(PyObject *self, PyObject *noargs)
    57145730{
    57155731    Py_XINCREF(pg_default_base);
     
    57185734
    57195735/* sets default base */
    5720 static char pgSetDefBase__doc__[] =
     5736static char pg_set_defbase__doc__[] =
    57215737"set_defbase(string) -- set default database name and return previous value";
    57225738
    57235739static PyObject *
    5724 pgSetDefBase(PyObject *self, PyObject *args)
     5740pg_set_defbase(PyObject *self, PyObject *args)
    57255741{
    57265742    char *tmp = NULL;
     
    57505766
    57515767/* gets default options */
    5752 static char pgGetDefOpt__doc__[] =
     5768static char pg_get_defopt__doc__[] =
    57535769"get_defopt() -- return default database options";
    57545770
    57555771static PyObject *
    5756 pgGetDefOpt(PyObject *self, PyObject *noargs)
     5772pg_get_defopt(PyObject *self, PyObject *noargs)
    57575773{
    57585774    Py_XINCREF(pg_default_opt);
     
    57615777
    57625778/* sets default opt */
    5763 static char pgSetDefOpt__doc__[] =
     5779static char pg_set_defopt__doc__[] =
    57645780"set_defopt(string) -- set default options and return previous value";
    57655781
    57665782static PyObject *
    5767 pgSetDefOpt(PyObject *self, PyObject *args)
     5783pg_setdefopt(PyObject *self, PyObject *args)
    57685784{
    57695785    char *tmp = NULL;
     
    57935809
    57945810/* gets default username */
    5795 static char pgGetDefUser__doc__[] =
     5811static char pg_get_defuser__doc__[] =
    57965812"get_defuser() -- return default database username";
    57975813
    57985814static PyObject *
    5799 pgGetDefUser(PyObject *self, PyObject *noargs)
     5815pg_get_defuser(PyObject *self, PyObject *noargs)
    58005816{
    58015817    Py_XINCREF(pg_default_user);
     
    58055821/* sets default username */
    58065822
    5807 static char pgSetDefUser__doc__[] =
     5823static char pg_set_defuser__doc__[] =
    58085824"set_defuser(name) -- set default username and return previous value";
    58095825
    58105826static PyObject *
    5811 pgSetDefUser(PyObject *self, PyObject *args)
     5827pg_set_defuser(PyObject *self, PyObject *args)
    58125828{
    58135829    char *tmp = NULL;
     
    58375853
    58385854/* sets default password */
    5839 static char pgSetDefPassword__doc__[] =
     5855static char pg_set_defpasswd__doc__[] =
    58405856"set_defpasswd(password) -- set default database password";
    58415857
    58425858static PyObject *
    5843 pgSetDefPassword(PyObject *self, PyObject *args)
     5859pg_set_defpasswd(PyObject *self, PyObject *args)
    58445860{
    58455861    char *tmp = NULL;
     
    58665882
    58675883/* gets default port */
    5868 static char pgGetDefPort__doc__[] =
     5884static char pg_get_defport__doc__[] =
    58695885"get_defport() -- return default database port";
    58705886
    58715887static PyObject *
    5872 pgGetDefPort(PyObject *self, PyObject *noargs)
     5888pg_get_defport(PyObject *self, PyObject *noargs)
    58735889{
    58745890    Py_XINCREF(pg_default_port);
     
    58775893
    58785894/* sets default port */
    5879 static char pgSetDefPort__doc__[] =
     5895static char pg_set_defport__doc__[] =
    58805896"set_defport(port) -- set default port and return previous value";
    58815897
    58825898static PyObject *
    5883 pgSetDefPort(PyObject *self, PyObject *args)
     5899pg_set_defport(PyObject *self, PyObject *args)
    58845900{
    58855901    long int port = -2;
     
    59105926
    59115927/* cast a string with a text representation of an array to a list */
    5912 static char pgCastArray__doc__[] =
     5928static char pg_cast_array__doc__[] =
    59135929"cast_array(string, cast=None, delim=',') -- cast a string as an array";
    59145930
    59155931PyObject *
    5916 pgCastArray(PyObject *self, PyObject *args, PyObject *dict)
     5932pg_cast_array(PyObject *self, PyObject *args, PyObject *dict)
    59175933{
    59185934    static const char *kwlist[] = {"string", "cast", "delim", NULL};
     
    59675983
    59685984/* cast a string with a text representation of a record to a tuple */
    5969 static char pgCastRecord__doc__[] =
     5985static char pg_cast_record__doc__[] =
    59705986"cast_record(string, cast=None, delim=',') -- cast a string as a record";
    59715987
    59725988PyObject *
    5973 pgCastRecord(PyObject *self, PyObject *args, PyObject *dict)
     5989pg_cast_record(PyObject *self, PyObject *args, PyObject *dict)
    59745990{
    59755991    static const char *kwlist[] = {"string", "cast", "delim", NULL};
     
    60316047
    60326048/* cast a string with a text representation of an hstore to a dict */
    6033 static char pgCastHStore__doc__[] =
     6049static char pg_cast_hstore__doc__[] =
    60346050"cast_hstore(string) -- cast a string as an hstore";
    60356051
    60366052PyObject *
    6037 pgCastHStore(PyObject *self, PyObject *string)
     6053pg_cast_hstore(PyObject *self, PyObject *string)
    60386054{
    60396055    PyObject *tmp_obj = NULL, *ret;
     
    60686084/* List of functions defined in the module */
    60696085
    6070 static struct PyMethodDef pgMethods[] = {
    6071     {"connect", (PyCFunction) pgConnect, METH_VARARGS|METH_KEYWORDS,
    6072             pgConnect__doc__},
    6073     {"escape_string", (PyCFunction) pgEscapeString, METH_O,
    6074             pgEscapeString__doc__},
    6075     {"escape_bytea", (PyCFunction) pgEscapeBytea, METH_O,
    6076             pgEscapeBytea__doc__},
    6077     {"unescape_bytea", (PyCFunction) pgUnescapeBytea, METH_O,
    6078             pgUnescapeBytea__doc__},
    6079     {"get_datestyle", (PyCFunction) pgGetDatestyle, METH_NOARGS,
    6080             pgGetDatestyle__doc__},
    6081     {"set_datestyle", (PyCFunction) pgSetDatestyle, METH_VARARGS,
    6082             pgSetDatestyle__doc__},
    6083     {"get_decimal_point", (PyCFunction) pgGetDecimalPoint, METH_NOARGS,
    6084             pgGetDecimalPoint__doc__},
    6085     {"set_decimal_point", (PyCFunction) pgSetDecimalPoint, METH_VARARGS,
    6086             pgSetDecimalPoint__doc__},
    6087     {"get_decimal", (PyCFunction) pgGetDecimal, METH_NOARGS,
    6088             pgGetDecimal__doc__},
    6089     {"set_decimal", (PyCFunction) pgSetDecimal, METH_O,
    6090             pgSetDecimal__doc__},
    6091     {"get_bool", (PyCFunction) pgGetBool, METH_NOARGS, pgGetBool__doc__},
    6092     {"set_bool", (PyCFunction) pgSetBool, METH_VARARGS, pgSetBool__doc__},
    6093     {"get_array", (PyCFunction) pgGetArray, METH_NOARGS, pgGetArray__doc__},
    6094     {"set_array", (PyCFunction) pgSetArray, METH_VARARGS, pgSetArray__doc__},
    6095     {"set_query_helpers", (PyCFunction) pgSetQueryHelpers, METH_VARARGS,
    6096             pgSetQueryHelpers__doc__},
    6097     {"get_bytea_escaped", (PyCFunction) pgGetByteaEscaped, METH_NOARGS,
    6098         pgGetByteaEscaped__doc__},
    6099     {"set_bytea_escaped", (PyCFunction) pgSetByteaEscaped, METH_VARARGS,
    6100         pgSetByteaEscaped__doc__},
    6101     {"get_jsondecode", (PyCFunction) pgGetJsondecode, METH_NOARGS,
    6102             pgGetJsondecode__doc__},
    6103     {"set_jsondecode", (PyCFunction) pgSetJsondecode, METH_O,
    6104             pgSetJsondecode__doc__},
    6105     {"cast_array", (PyCFunction) pgCastArray, METH_VARARGS|METH_KEYWORDS,
    6106             pgCastArray__doc__},
    6107     {"cast_record", (PyCFunction) pgCastRecord, METH_VARARGS|METH_KEYWORDS,
    6108             pgCastRecord__doc__},
    6109     {"cast_hstore", (PyCFunction) pgCastHStore, METH_O, pgCastHStore__doc__},
     6086static struct PyMethodDef pg_methods[] = {
     6087    {"connect", (PyCFunction) pg_connect,
     6088        METH_VARARGS|METH_KEYWORDS, pg_connect__doc__},
     6089    {"escape_string", (PyCFunction) pg_escape_string,
     6090        METH_O, pg_escape_string__doc__},
     6091    {"escape_bytea", (PyCFunction) pg_escape_bytea,
     6092        METH_O, pg_escape_bytea__doc__},
     6093    {"unescape_bytea", (PyCFunction) pg_unescape_bytea,
     6094        METH_O, pg_unescape_bytea__doc__},
     6095    {"get_datestyle", (PyCFunction) pg_get_datestyle,
     6096        METH_NOARGS, pg_get_datestyle__doc__},
     6097    {"set_datestyle", (PyCFunction) pg_set_datestyle,
     6098        METH_VARARGS, pg_set_datestyle__doc__},
     6099    {"get_decimal_point", (PyCFunction) pg_get_decimal_point,
     6100        METH_NOARGS, pg_get_decimal_point__doc__},
     6101    {"set_decimal_point", (PyCFunction) pg_set_decimal_point,
     6102        METH_VARARGS, pg_set_decimal_point__doc__},
     6103    {"get_decimal", (PyCFunction) pg_get_decimal,
     6104        METH_NOARGS, pg_get_decimal__doc__},
     6105    {"set_decimal", (PyCFunction) pg_set_decimal,
     6106        METH_O, pg_set_decimal__doc__},
     6107    {"get_bool", (PyCFunction) pg_get_bool,
     6108        METH_NOARGS, pg_get_bool__doc__},
     6109    {"set_bool", (PyCFunction) pg_set_bool,
     6110        METH_VARARGS, pg_set_bool__doc__},
     6111    {"get_array", (PyCFunction) pg_get_array,
     6112        METH_NOARGS, pg_get_array__doc__},
     6113    {"set_array", (PyCFunction) pg_set_array,
     6114        METH_VARARGS, pg_set_array__doc__},
     6115    {"set_query_helpers", (PyCFunction) pg_set_query_helpers,
     6116        METH_VARARGS, pg_set_query_helpers__doc__},
     6117    {"get_bytea_escaped", (PyCFunction) pg_get_bytea_escaped,
     6118        METH_NOARGS, pg_get_bytea_escaped__doc__},
     6119    {"set_bytea_escaped", (PyCFunction) pg_set_bytea_escaped,
     6120        METH_VARARGS, pg_set_bytea_escaped__doc__},
     6121    {"get_jsondecode", (PyCFunction) pg_get_jsondecode,
     6122        METH_NOARGS, pg_get_jsondecode__doc__},
     6123    {"set_jsondecode", (PyCFunction) pg_set_jsondecode,
     6124        METH_O, pg_set_jsondecode__doc__},
     6125    {"cast_array", (PyCFunction) pg_cast_array,
     6126        METH_VARARGS|METH_KEYWORDS, pg_cast_array__doc__},
     6127    {"cast_record", (PyCFunction) pg_cast_record,
     6128        METH_VARARGS|METH_KEYWORDS, pg_cast_record__doc__},
     6129    {"cast_hstore", (PyCFunction) pg_cast_hstore,
     6130        METH_O, pg_cast_hstore__doc__},
    61106131
    61116132#ifdef DEFAULT_VARS
    6112     {"get_defhost", pgGetDefHost, METH_NOARGS, pgGetDefHost__doc__},
    6113     {"set_defhost", pgSetDefHost, METH_VARARGS, pgSetDefHost__doc__},
    6114     {"get_defbase", pgGetDefBase, METH_NOARGS, pgGetDefBase__doc__},
    6115     {"set_defbase", pgSetDefBase, METH_VARARGS, pgSetDefBase__doc__},
    6116     {"get_defopt", pgGetDefOpt, METH_NOARGS, pgGetDefOpt__doc__},
    6117     {"set_defopt", pgSetDefOpt, METH_VARARGS, pgSetDefOpt__doc__},
    6118     {"get_defport", pgGetDefPort, METH_NOARGS, pgGetDefPort__doc__},
    6119     {"set_defport", pgSetDefPort, METH_VARARGS, pgSetDefPort__doc__},
    6120     {"get_defuser", pgGetDefUser, METH_NOARGS, pgGetDefUser__doc__},
    6121     {"set_defuser", pgSetDefUser, METH_VARARGS, pgSetDefUser__doc__},
    6122     {"set_defpasswd", pgSetDefPassword, METH_VARARGS, pgSetDefPassword__doc__},
     6133    {"get_defhost", pg_get_defhost, METH_NOARGS, pg_get_defhost__doc__},
     6134    {"set_defhost", pg_set_defhost, METH_VARARGS, pg_set_defhost__doc__},
     6135    {"get_defbase", pg_get_defbase, METH_NOARGS, pg_get_defbase__doc__},
     6136    {"set_defbase", pg_set_defbase, METH_VARARGS, pg_set_defbase__doc__},
     6137    {"get_defopt", pg_get_defopt, METH_NOARGS, pg_get_defopt__doc__},
     6138    {"set_defopt", pg_setdefopt, METH_VARARGS, pg_set_defopt__doc__},
     6139    {"get_defport", pg_get_defport, METH_NOARGS, pg_get_defport__doc__},
     6140    {"set_defport", pg_set_defport, METH_VARARGS, pg_set_defport__doc__},
     6141    {"get_defuser", pg_get_defuser, METH_NOARGS, pg_get_defuser__doc__},
     6142    {"set_defuser", pg_set_defuser, METH_VARARGS, pg_set_defuser__doc__},
     6143    {"set_defpasswd", pg_set_defpasswd, METH_VARARGS, pg_set_defpasswd__doc__},
    61236144#endif /* DEFAULT_VARS */
    61246145    {NULL, NULL} /* sentinel */
     
    61296150static struct PyModuleDef moduleDef = {
    61306151    PyModuleDef_HEAD_INIT,
    6131     "_pg",      /* m_name */
    6132     pg__doc__,  /* m_doc */
    6133     -1,         /* m_size */
    6134     pgMethods  /* m_methods */
     6152    "_pg",     /* m_name */
     6153    pg__doc__, /* m_doc */
     6154    -1,        /* m_size */
     6155    pg_methods /* m_methods */
    61356156};
    61366157
Note: See TracChangeset for help on using the changeset viewer.