Changeset 956 for trunk/pg.py


Ignore:
Timestamp:
Jan 4, 2019, 6:29:11 AM (9 months ago)
Author:
cito
Message:

Make name in query_prepared a keyword-only parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pg.py

    r955 r956  
    18701870            command, parameters, types, inline))
    18711871
    1872     def query_prepared(self, name=None, *args):
     1872    def query_prepared(self, *args, **kwargs):
    18731873        """Execute a prepared SQL statement.
    18741874
    1875         This works like the query() method, but you need to pass the name of
    1876         a prepared statement that you have already created with prepare().
    1877         If you pass no parameters or pass an empty name, then the unnamed
    1878         statement will be executed if you created one before.
     1875        This works like the query() method, except that instead of passing
     1876        the SQL command, you pass the name of a prepared statement via
     1877        the keyword-only argument `name`.  If you don't pass a name, the
     1878        unnamed statement will be executed, if you created one before.
    18791879        """
    18801880        if not self.db:
    18811881            raise _int_error('Connection is not valid')
     1882        # use kwargs because Python 2 does not support keyword-only arguments
     1883        name = kwargs.get('name')
    18821884        if name is None:
    18831885            name = ''
     
    19121914
    19131915        This method returns a Query object describing the result columns of
    1914         the prepared statement with the given name. If you do not specify a
    1915         name, then the unnamed statement will be described if you created one.
     1916        the prepared statement with the given name. If you omit the name,
     1917        the unnamed statement will be described if you created one before.
    19161918        """
    19171919        if name is None:
Note: See TracChangeset for help on using the changeset viewer.