aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/sql.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2008-07-08 06:07:47 +0000
committerRob Austein <sra@hactrn.net>2008-07-08 06:07:47 +0000
commit6b8ec3e9d28aef5024b6d9b3d066048044016aae (patch)
treeda5d81f48238939ba0ec92be19cd346f84d1bc89 /rpkid/rpki/sql.py
parent7c3da949caa379049fde7e66388a1240a2ba5e64 (diff)
Add debugging for sql_store() operations
svn path=/rpkid/rpki/sql.py; revision=1979
Diffstat (limited to 'rpkid/rpki/sql.py')
-rw-r--r--rpkid/rpki/sql.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py
index d93f55e3..e9284539 100644
--- a/rpkid/rpki/sql.py
+++ b/rpkid/rpki/sql.py
@@ -222,13 +222,18 @@ class sql_persistant(object):
def sql_store(self):
"""Store this object to SQL."""
+ args = self.sql_encode()
if not self.sql_in_db:
- self.gctx.sql.execute(self.sql_template.insert, self.sql_encode())
+ if self.sql_debug:
+ rpki.log.debug("sql_fetch_store(%s, %s)" % (repr(self.sql_template.insert), repr(args)))
+ self.gctx.sql.execute(self.sql_template.insert, args)
setattr(self, self.sql_template.index, self.gctx.sql.lastrowid())
self.gctx.sql.cache[(self.__class__, self.gctx.sql.lastrowid())] = self
self.sql_insert_hook()
else:
- self.gctx.sql.execute(self.sql_template.update, self.sql_encode())
+ if self.sql_debug:
+ rpki.log.debug("sql_fetch_store(%s, %s)" % (repr(self.sql_template.update), repr(args)))
+ self.gctx.sql.execute(self.sql_template.update, args)
self.sql_update_hook()
key = (self.__class__, getattr(self, self.sql_template.index))
assert key in self.gctx.sql.cache and self.gctx.sql.cache[key] == self