Update of /usr/cvs/Public/pygresql/docs
In directory druid.net:/tmp/cvs-serv11982/docs
Modified Files:
changelog.txt future.txt pg.txt
Log 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.
To see the diffs for this commit:
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/docs/changelog.txt.diff?r1=1.38&r2=1.39
Index: changelog.txt
===================================================================
RCS file: /usr/cvs/Public/pygresql/docs/changelog.txt,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- changelog.txt 5 Dec 2008 02:05:28 -0000 1.38
+++ changelog.txt 5 Dec 2008 15:00:18 -0000 1.39
@@ -33,7 +33,10 @@
- Improved getnotify() by calling PQconsumeInput() instead of
submitting an empty command.
- Removed compatibility code for old OID munging style.
-- Added "return_changes" flag to insert method.
+- The insert() and update() methods now use the "returning" clause
+ if possible to get all changed values, and they also check in advance
+ whether a subsequent select is possible, so that ongoing transactions
+ won't break if there is no select privilege.
- Added "protocol_version" and "server_version" attributes.
- Revived the "user" attribute.
- The pg module now works correctly with composite primary keys;
@@ -42,6 +45,9 @@
from the get() method.
- get() raises a nicer ProgrammingError instead of a KeyError
if no primary key was found.
+- delete() now also works based on the primary key if no oid available
+ and returns whether the row existed or not.
+
Version 3.8.1 (2006-06-05)
--------------------------
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/docs/future.txt.diff?r1=1.26&r2=1.27
Index: future.txt
===================================================================
RCS file: /usr/cvs/Public/pygresql/docs/future.txt,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- future.txt 5 Dec 2008 02:05:28 -0000 1.26
+++ future.txt 5 Dec 2008 15:00:18 -0000 1.27
@@ -6,13 +6,6 @@
To Do
-----
-- Classic pg relies on OIDs, but these are not generated by default any more
- (at least docs should recommend setting default_with_oids=true).
-- The insert() method in pg should use a `returning *` clause instead of
- the subsequent get() when the PostgreSQL version is >= 8.2.
-- Before getting the values back after insert() and update(), check
- with has_table_privilege(table, 'select') whether this is possible.
- Otherwise we might break an ongoing transaction.
- Documentation for the pgdb module (everything specific to PyGreSQL).
- The large object and direct access functions need much more attention.
- The C module needs to be cleaned up and redundant code merged,
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/docs/pg.txt.diff?r1=1.22&r2=1.23
Index: pg.txt
===================================================================
RCS file: /usr/cvs/Public/pygresql/docs/pg.txt,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- pg.txt 5 Dec 2008 02:05:28 -0000 1.22
+++ pg.txt 5 Dec 2008 15:00:18 -0000 1.23
@@ -844,6 +844,19 @@
Description:
Given the name of a table, digs out the set of attribute names.
+has_table_privilege - check whether current user has specified table privilege
+------------------------------------------------------------------------------
+Syntax::
+
+ has_table_privilege(table, privilege)
+
+Parameters:
+ :table: name of table
+ :privilege: privilege to be checked - default is 'select'
+
+Description:
+ Returns True if the current user has the specified privilege for the table.
+
get - get a row from a database table or view
---------------------------------------------
Syntax::
@@ -890,10 +903,8 @@
pairs. If a dictionary is supplied then any keywords provided will be
added to or replace the entry in the dictionary.
- The dictionary is then reloaded with the values actually inserted
- in order to pick up values modified by rules, triggers, etc. If
- the optional flag return_changes is set to False this reload will
- be skipped.
+ The dictionary is then, if possible, reloaded with the values actually
+ inserted in order to pick up values modified by rules, triggers, etc.
Due to the way that this function works you will find inserts taking
longer and longer as your table gets bigger. To overcome this problem
@@ -918,10 +929,10 @@
:dictionary: the new row
Description:
- Similar to insert but updates an existing row. The update is based
- on the OID value as munged by get. The array returned is the
- one sent modified to reflect any changes caused by the update due
- to triggers, rules, defaults, etc.
+ Similar to insert but updates an existing row. The update is based on the
+ OID value as munged by get or passed as keyword, or on the primary key of
+ the table. The dictionary is modified, if possible, to reflect any changes
+ caused by the update due to triggers, rules, default values, etc.
Like insert, the dictionary is optional and updates will be performed
on the fields in the keywords. There must be an OID or primary key
@@ -964,9 +975,10 @@
None
Description:
- This method deletes the row from a table. It deletes based on the OID
- as munged as described above. Alternatively, the keyword "oid" can
- be used to specify the OID.
+ This method deletes the row from a table. It deletes based on the OID value
+ as munged by get or passed as keyword, or on the primary key of the table.
+ The return value is the number of deleted rows (i.e. 0 if the row did not
+ exist and 1 if the row was deleted).
escape_string - escape a string for use within SQL
--------------------------------------------------
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql