[SQLObject] request for elaboration on code
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <jws...@ra...> - 2004-02-16 06:53:58
|
I am trying to use a postgres connection and am having an issue with the
following code from DBconnection.py
def _queryInsertID(self, conn, table, idName, id, names, values):
c = conn.cursor()
if id is not None:
names = [idName] + names
values = [id] + values
q = self._insertSQL(table, names, values)
if self.debug:
self.printDebug(conn, q, 'QueryIns')
c.execute(q)
if id is None:
^^^^^^^^^^^^^^^
c.execute('SELECT %s FROM %s WHERE oid = %s'
% (idName, table, c.lastoid()))
id = c.fetchone()[0]
if self.debugOutput:
self.printDebug(conn, id, 'QueryIns', 'result')
return id
Firstly what is 'id' representing?
Secondly, the SQL in the latter case is NOT going to work if the tables have
been created without oid's.
|