Changeset 738 for branches/4.x


Ignore:
Timestamp:
Jan 13, 2016, 5:57:29 PM (4 years ago)
Author:
cito
Message:

Renamed some parameters to clarify their meaning

This is uncritical, because these are not keyword parameters. Also, we don't
change much in the 4.x branch in order to stay compatible.

Also, avoided the old terminology "class" for a table or table-like object in PostgreSQL,
because it may confuse people. The word "table" is so much clearer.

Location:
branches/4.x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/docs/contents/pg/db_wrapper.rst

    r736 r738  
    234234--------------------------------------------
    235235
    236 .. method:: DB.insert(table, [d], [col=val, ...])
     236.. method:: DB.insert(table, [d], [key=val, ...])
    237237
    238238    Insert a row into a database table
     
    258258------------------------------------------
    259259
    260 .. method:: DB.update(table, [d], [col=val, ...])
     260.. method:: DB.update(table, [d], [key=val, ...])
    261261
    262262    Update a row in a database table
     
    312312-----------------------------------
    313313
    314 .. method:: DB.clear(table, [a])
     314.. method:: DB.clear(table, [d])
    315315
    316316    Clear row values in memory
    317317
    318318    :param str table: name of table
    319     :param dict a: optional dictionary of values
     319    :param dict d: optional dictionary of values
    320320    :returns: an empty row
    321321    :rtype: dict
    322322
    323323This method clears all the attributes to values determined by the types.
    324 Numeric types are set to 0, Booleans are set to ``'f'``, dates are set
    325 to ``'now()'`` and everything else is set to the empty string.
    326 If the array argument is present, it is used as the array and any entries
    327 matching attribute names are cleared with everything else left unchanged.
     324Numeric types are set to 0, Booleans are set to ``'f'``, and everything
     325else is set to the empty string.  If the optional dictionary is present,
     326it is used as the row and any entries matching attribute names are cleared
     327with everything else left unchanged.
    328328
    329329If the dictionary is not supplied a new one is created.
     
    332332--------------------------------------------
    333333
    334 .. method:: DB.delete(table, [d,] [key = val, ...])
     334.. method:: DB.delete(table, [d], [key=val, ...])
    335335
    336336    Delete a row from a database table
  • branches/4.x/pg.py

    r737 r738  
    897897        return d
    898898
    899     def clear(self, cl, a=None):
     899    def clear(self, cl, d=None):
    900900        """Clear all the attributes to values determined by the types.
    901901
    902902        Numeric types are set to 0, Booleans are set to false, and everything
    903         else is set to the empty string.  If the array argument is present,
    904         it is used as the array and any entries matching attribute names are
    905         cleared with everything else left unchanged.
     903        else is set to the empty string.  If the second argument is present,
     904        it is used as the row dictionary and any entries matching attribute
     905        names are cleared with everything else left unchanged.
    906906
    907907        """
    908908        # At some point we will need a way to get defaults from a table.
    909909        qcl = self._add_schema(cl)
    910         if a is None:
    911             a = {}  # empty if argument is not present
     910        if d is None:
     911            d = {}  # empty if argument is not present
    912912        attnames = self.get_attnames(qcl)
    913913        for n, t in attnames.items():
     
    917917                    'float', 'real', 'double precision',
    918918                    'num', 'numeric', 'money'):
    919                 a[n] = 0
     919                d[n] = 0
    920920            elif t in ('bool', 'boolean'):
    921                 a[n] = self._make_bool(False)
     921                d[n] = self._make_bool(False)
    922922            else:
    923                 a[n] = ''
    924         return a
     923                d[n] = ''
     924        return d
    925925
    926926    def delete(self, cl, d=None, **kw):
Note: See TracChangeset for help on using the changeset viewer.