Changeset 391 for trunk/docs


Ignore:
Timestamp:
Dec 5, 2008, 10:00:19 AM (11 years ago)
Author:
cito
Message:

The insert() and update() methods now check if the table is selectable and use the "returning" clause if possible. The delete() method now also works with primary keys and returns whether the row existed.

Location:
trunk/docs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/changelog.txt

    r389 r391  
    3434  submitting an empty command.
    3535- Removed compatibility code for old OID munging style.
    36 - Added "return_changes" flag to insert method.
     36- The insert() and update() methods now use the "returning" clause
     37  if possible to get all changed values, and they also check in advance
     38  whether a subsequent select is possible, so that ongoing transactions
     39  won't break if there is no select privilege.
    3740- Added "protocol_version" and "server_version" attributes.
    3841- Revived the "user" attribute.
     
    4346- get() raises a nicer ProgrammingError instead of a KeyError
    4447  if no primary key was found.
     48- delete() now also works based on the primary key if no oid available
     49  and returns whether the row existed or not.
     50
    4551
    4652Version 3.8.1 (2006-06-05)
  • trunk/docs/future.txt

    r389 r391  
    77-----
    88
    9 - Classic pg relies on OIDs, but these are not generated by default any more
    10   (at least docs should recommend setting default_with_oids=true).
    11 - The insert() method in pg should use a `returning *` clause instead of
    12   the subsequent get() when the PostgreSQL version is >= 8.2.
    13 - Before getting the values back after insert() and update(), check
    14   with has_table_privilege(table, 'select') whether this is possible.
    15   Otherwise we might break an ongoing transaction.
    169- Documentation for the pgdb module (everything specific to PyGreSQL).
    1710- The large object and direct access functions need much more attention.
  • trunk/docs/pg.txt

    r389 r391  
    845845  Given the name of a table, digs out the set of attribute names.
    846846
     847has_table_privilege - check whether current user has specified table privilege
     848------------------------------------------------------------------------------
     849Syntax::
     850
     851    has_table_privilege(table, privilege)
     852
     853Parameters:
     854  :table:     name of table
     855  :privilege: privilege to be checked - default is 'select'
     856
     857Description:
     858  Returns True if the current user has the specified privilege for the table.
     859
    847860get - get a row from a database table or view
    848861---------------------------------------------
     
    891904  added to or replace the entry in the dictionary.
    892905
    893   The dictionary is then reloaded with the values actually inserted
    894   in order to pick up values modified by rules, triggers, etc.  If
    895   the optional flag return_changes is set to False this reload will
    896   be skipped.
     906  The dictionary is then, if possible, reloaded with the values actually
     907  inserted in order to pick up values modified by rules, triggers, etc.
    897908
    898909  Due to the way that this function works you will find inserts taking
     
    919930
    920931Description:
    921   Similar to insert but updates an existing row. The update is based
    922   on the OID value as munged by get. The array returned is the
    923   one sent modified to reflect any changes caused by the update due
    924   to triggers, rules, defaults, etc.
     932  Similar to insert but updates an existing row.  The update is based on the
     933  OID value as munged by get or passed as keyword, or on the primary key of
     934  the table.  The dictionary is modified, if possible, to reflect any changes
     935  caused by the update due to triggers, rules, default values, etc.
    925936
    926937  Like insert, the dictionary is optional and updates will be performed
     
    965976
    966977Description:
    967   This method deletes the row from a table. It deletes based on the OID
    968   as munged as described above.  Alternatively, the keyword "oid" can
    969   be used to specify the OID.
     978  This method deletes the row from a table.  It deletes based on the OID value
     979  as munged by get or passed as keyword, or on the primary key of the table.
     980  The return value is the number of deleted rows (i.e. 0 if the row did not
     981  exist and 1 if the row was deleted).
    970982
    971983escape_string - escape a string for use within SQL
Note: See TracChangeset for help on using the changeset viewer.