for f in self.keys)
return ' and '.join(stmt)
- def _set(self):
- tmpl = "%(col)s = t.%(col)s"
- stmt = (tmpl % {'col': quote_ident(f)}
- for f in self.nonkeys())
- return ", ".join(stmt)
-
def _cols(self):
return ','.join(quote_ident(f) for f in self.fields)
return self.logexec(curs, sql)
def update(self, curs):
+ qcols = [quote_ident(c) for c in self.nonkeys()]
+
+ # no point to update pk-only table
+ if not qcols:
+ return
+
+ tmpl = "%s = t.%s"
+ eqlist = [tmpl % (c,c) for c in qcols]
+ _set = ", ".join(eqlist)
+
sql = "update only %s set %s from %s as t where %s" % (
- self.qtable, self._set(), self.qtemp, self._where())
+ self.qtable, _set, self.qtemp, self._where())
return self.logexec(curs, sql)
def delete(self, curs):