MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / getTableVersion

Method getTableVersion

src/Db/Db.py:197–208  ·  view source on GitHub ↗
(self, table_name)

Source from the content-addressed store, hash-verified

195 # Get the table version
196 # Return: Table version or None if not exist
197 def getTableVersion(self, table_name):
198 if not self.db_keyvalues: # Get db keyvalues
199 try:
200 res = self.execute("SELECT * FROM keyvalue WHERE json_id=0") # json_id = 0 is internal keyvalues
201 except sqlite3.OperationalError as err: # Table not exist
202 self.log.debug("Query table version error: %s" % err)
203 return False
204
205 for row in res:
206 self.db_keyvalues[row["key"]] = row["value"]
207
208 return self.db_keyvalues.get("table.%s.version" % table_name, 0)
209
210 # Check Db tables
211 # Return: <list> Changed table names

Callers 2

needTableMethod · 0.80
getSchemaMethod · 0.80

Calls 2

executeMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected