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
ref='#n147'>147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180