dabo Commit
Revision 4826
Date: 2008-12-11 18:01:06 -0800 (Thu, 11 Dec 2008)
Author: Johnf
Trac: http://trac.dabodev.com/dabo/changeset/4826

Changed:
U   trunk/dabo/db/dbPostgreSQL.py

Log:
I was unable to save children due to an error.  I believe this was what 
Christoph Zwerschke was trying to do.  I have not tested this where there is 
not a schema supplied.  I changed the SQL statement - so please check your 
forms.

Diff:
Modified: trunk/dabo/db/dbPostgreSQL.py
===================================================================
--- trunk/dabo/db/dbPostgreSQL.py       2008-12-12 00:03:56 UTC (rev 4825)
+++ trunk/dabo/db/dbPostgreSQL.py       2008-12-12 02:01:06 UTC (rev 4826)
@@ -197,7 +197,7 @@
                """
 
                try:
-                       schemaName, tableName = tableName.split(".", 1)
+                       schemaName, tableName = cursor.Table.split(".", 1)
                except ValueError:
                        schemaName = None
 
@@ -205,8 +205,8 @@
                #on a serial data type to work.
                # special thanks to Lorenzo Alberton for his help with parsing 
of the fields.
                # It has been confirmed that the statement works with 7.4 
through 8.3.x
-               sql = ["SELECT curval(substring((SELECT substring("
-                               "pg_get_expr(d.adbin, d.adrelid) for 128)) as 
curval"
+               sql = ["SELECT substring((SELECT substring("
+                               "pg_get_expr(d.adbin, d.adrelid) for 128) as 
curval"
                                " FROM pg_attrdef d WHERE d.adrelid = 
a.attrelid"
                                " AND d.adnum = a.attnum AND a.atthasdef)"
                                " FROM 'nextval[^'']*''([^'']*)')"
@@ -215,13 +215,13 @@
                                " LEFT JOIN pg_attrdef d ON d.adrelid = 
a.attrelid"
                                " AND d.adnum = a.attnum AND a.atthasdef"
                                " LEFT JOIN pg_namespace n ON c.relnamespace = 
n.oid",
-                               "WHERE a.attname = '%s'" % cursor.KeyField,
-                               "AND (c.relname = '%s')" % tableName]
+                               " WHERE a.attname = '%s'" % cursor.KeyField,
+                               " AND (c.relname = '%s')" % tableName]
                if schemaName:
                        sql.append(" AND n.nspname = '%s'" % schemaName)
                else:
                        sql.append(" AND pg_table_is_visible(c.oid)")
-               sql.append("NOT a.attisdropped AND a.attnum > 0"
+               sql.append(" AND NOT a.attisdropped AND a.attnum > 0"
                                " AND pg_get_expr(d.adbin, d.adrelid) LIKE 
'nextval%'")
 
                tempCursor = self._connection.cursor()




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to