Skip to content

Instantly share code, notes, and snippets.

@apage43
Created February 12, 2014 00:02
Show Gist options
  • Save apage43/8947106 to your computer and use it in GitHub Desktop.
Save apage43/8947106 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sqlite3
import struct
import sys
def main():
conn = sqlite3.connect(sys.argv[1])
conn.row_factory = sqlite3.Row
c = conn.cursor()
for row in c.execute('SELECT * FROM cbb_msg'):
(rev,) = struct.unpack_from('>Q', row['meta'])
if row['cmd'] == 65:
print 'Key: %s, Rev: %d' % (row['key'], rev)
else:
print '(Deleted) Key: %s, Rev: %d' % (row['key'], rev)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment