class_sqlThread flake8 fixes
This commit is contained in:
parent
4a54c200d4
commit
dbbf454c15
|
@ -38,30 +38,38 @@ class sqlThread(threading.Thread):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE inbox (msgid blob, toaddress text, fromaddress text, subject text, received text, message text, folder text, encodingtype int, read bool, sighash blob, UNIQUE(msgid) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE inbox (msgid blob, toaddress text, fromaddress text, subject text,'''
|
||||||
|
''' received text, message text, folder text, encodingtype int, read bool, sighash blob,'''
|
||||||
|
''' UNIQUE(msgid) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text, ackdata blob, senttime integer, lastactiontime integer, sleeptill integer, status text, retrynumber integer, folder text, encodingtype int, ttl int)''' )
|
'''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text,'''
|
||||||
|
''' message text, ackdata blob, senttime integer, lastactiontime integer,'''
|
||||||
|
''' sleeptill integer, status text, retrynumber integer, folder text, encodingtype int, ttl int)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE subscriptions (label text, address text, enabled bool)''' )
|
'''CREATE TABLE subscriptions (label text, address text, enabled bool)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE addressbook (label text, address text)''' )
|
'''CREATE TABLE addressbook (label text, address text)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE blacklist (label text, address text, enabled bool)''' )
|
'''CREATE TABLE blacklist (label text, address text, enabled bool)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE whitelist (label text, address text, enabled bool)''' )
|
'''CREATE TABLE whitelist (label text, address text, enabled bool)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE pubkeys (address text, addressversion int, transmitdata blob, time int, usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE pubkeys (address text, addressversion int, transmitdata blob, time int,'''
|
||||||
|
''' usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE inventory (hash blob, objecttype int, streamnumber int, payload blob, expirestime integer, tag blob, UNIQUE(hash) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE inventory (hash blob, objecttype int, streamnumber int, payload blob,'''
|
||||||
|
''' expirestime integer, tag blob, UNIQUE(hash) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO subscriptions VALUES('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''')
|
'''INSERT INTO subscriptions VALUES'''
|
||||||
|
'''('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE settings (key blob, value blob, UNIQUE(key) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE settings (key blob, value blob, UNIQUE(key) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute( '''INSERT INTO settings VALUES('version','10')''')
|
self.cur.execute('''INSERT INTO settings VALUES('version','10')''')
|
||||||
self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
|
self.cur.execute('''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
|
||||||
int(time.time()),))
|
int(time.time()),))
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE objectprocessorqueue (objecttype int, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE objectprocessorqueue'''
|
||||||
|
''' (objecttype int, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
logger.info('Created messages database file')
|
logger.info('Created messages database file')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
@ -126,33 +134,38 @@ class sqlThread(threading.Thread):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"In messages.dat database, creating new 'settings' table.")
|
"In messages.dat database, creating new 'settings' table.")
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE settings (key text, value blob, UNIQUE(key) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE settings (key text, value blob, UNIQUE(key) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute( '''INSERT INTO settings VALUES('version','1')''')
|
self.cur.execute('''INSERT INTO settings VALUES('version','1')''')
|
||||||
self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
|
self.cur.execute('''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
|
||||||
int(time.time()),))
|
int(time.time()),))
|
||||||
logger.debug('In messages.dat database, removing an obsolete field from the pubkeys table.')
|
logger.debug('In messages.dat database, removing an obsolete field from the pubkeys table.')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TEMPORARY TABLE pubkeys_backup(hash blob, transmitdata blob, time int, usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE);''')
|
'''CREATE TEMPORARY TABLE pubkeys_backup(hash blob, transmitdata blob, time int,'''
|
||||||
|
''' usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE);''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO pubkeys_backup SELECT hash, transmitdata, time, usedpersonally FROM pubkeys;''')
|
'''INSERT INTO pubkeys_backup SELECT hash, transmitdata, time, usedpersonally FROM pubkeys;''')
|
||||||
self.cur.execute( '''DROP TABLE pubkeys''')
|
self.cur.execute('''DROP TABLE pubkeys''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE pubkeys (hash blob, transmitdata blob, time int, usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE pubkeys'''
|
||||||
|
''' (hash blob, transmitdata blob, time int, usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO pubkeys SELECT hash, transmitdata, time, usedpersonally FROM pubkeys_backup;''')
|
'''INSERT INTO pubkeys SELECT hash, transmitdata, time, usedpersonally FROM pubkeys_backup;''')
|
||||||
self.cur.execute( '''DROP TABLE pubkeys_backup;''')
|
self.cur.execute('''DROP TABLE pubkeys_backup;''')
|
||||||
logger.debug('Deleting all pubkeys from inventory. They will be redownloaded and then saved with the correct times.')
|
logger.debug(
|
||||||
|
'Deleting all pubkeys from inventory.'
|
||||||
|
' They will be redownloaded and then saved with the correct times.')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''delete from inventory where objecttype = 'pubkey';''')
|
'''delete from inventory where objecttype = 'pubkey';''')
|
||||||
logger.debug('replacing Bitmessage announcements mailing list with a new one.')
|
logger.debug('replacing Bitmessage announcements mailing list with a new one.')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''delete from subscriptions where address='BM-BbkPSZbzPwpVcYZpU4yHwf9ZPEapN5Zx' ''')
|
'''delete from subscriptions where address='BM-BbkPSZbzPwpVcYZpU4yHwf9ZPEapN5Zx' ''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO subscriptions VALUES('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''')
|
'''INSERT INTO subscriptions VALUES'''
|
||||||
|
'''('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''')
|
||||||
logger.debug('Commiting.')
|
logger.debug('Commiting.')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
logger.debug('Vacuuming message.dat. You might notice that the file size gets much smaller.')
|
logger.debug('Vacuuming message.dat. You might notice that the file size gets much smaller.')
|
||||||
self.cur.execute( ''' VACUUM ''')
|
self.cur.execute(''' VACUUM ''')
|
||||||
|
|
||||||
# After code refactoring, the possible status values for sent messages
|
# After code refactoring, the possible status values for sent messages
|
||||||
# have changed.
|
# have changed.
|
||||||
|
@ -176,15 +189,21 @@ class sqlThread(threading.Thread):
|
||||||
'In messages.dat database, removing an obsolete field from'
|
'In messages.dat database, removing an obsolete field from'
|
||||||
' the inventory table.')
|
' the inventory table.')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TEMPORARY TABLE inventory_backup(hash blob, objecttype text, streamnumber int, payload blob, receivedtime integer, UNIQUE(hash) ON CONFLICT REPLACE);''')
|
'''CREATE TEMPORARY TABLE inventory_backup'''
|
||||||
|
'''(hash blob, objecttype text, streamnumber int, payload blob,'''
|
||||||
|
''' receivedtime integer, UNIQUE(hash) ON CONFLICT REPLACE);''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO inventory_backup SELECT hash, objecttype, streamnumber, payload, receivedtime FROM inventory;''')
|
'''INSERT INTO inventory_backup SELECT hash, objecttype, streamnumber, payload, receivedtime'''
|
||||||
self.cur.execute( '''DROP TABLE inventory''')
|
''' FROM inventory;''')
|
||||||
|
self.cur.execute('''DROP TABLE inventory''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE inventory (hash blob, objecttype text, streamnumber int, payload blob, receivedtime integer, UNIQUE(hash) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE inventory'''
|
||||||
|
''' (hash blob, objecttype text, streamnumber int, payload blob, receivedtime integer,'''
|
||||||
|
''' UNIQUE(hash) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO inventory SELECT hash, objecttype, streamnumber, payload, receivedtime FROM inventory_backup;''')
|
'''INSERT INTO inventory SELECT hash, objecttype, streamnumber, payload, receivedtime'''
|
||||||
self.cur.execute( '''DROP TABLE inventory_backup;''')
|
''' FROM inventory_backup;''')
|
||||||
|
self.cur.execute('''DROP TABLE inventory_backup;''')
|
||||||
item = '''update settings set value=? WHERE key='version';'''
|
item = '''update settings set value=? WHERE key='version';'''
|
||||||
parameters = (3,)
|
parameters = (3,)
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
|
@ -214,7 +233,8 @@ class sqlThread(threading.Thread):
|
||||||
if currentVersion == 4:
|
if currentVersion == 4:
|
||||||
self.cur.execute('''DROP TABLE pubkeys''')
|
self.cur.execute('''DROP TABLE pubkeys''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE pubkeys (hash blob, addressversion int, transmitdata blob, time int, usedpersonally text, UNIQUE(hash, addressversion) ON CONFLICT REPLACE)''')
|
'''CREATE TABLE pubkeys (hash blob, addressversion int, transmitdata blob, time int,'''
|
||||||
|
'''usedpersonally text, UNIQUE(hash, addressversion) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''delete from inventory where objecttype = 'pubkey';''')
|
'''delete from inventory where objecttype = 'pubkey';''')
|
||||||
item = '''update settings set value=? WHERE key='version';'''
|
item = '''update settings set value=? WHERE key='version';'''
|
||||||
|
@ -230,7 +250,8 @@ class sqlThread(threading.Thread):
|
||||||
if currentVersion == 5:
|
if currentVersion == 5:
|
||||||
self.cur.execute('''DROP TABLE knownnodes''')
|
self.cur.execute('''DROP TABLE knownnodes''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE objectprocessorqueue (objecttype text, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''')
|
'''CREATE TABLE objectprocessorqueue'''
|
||||||
|
''' (objecttype text, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''')
|
||||||
item = '''update settings set value=? WHERE key='version';'''
|
item = '''update settings set value=? WHERE key='version';'''
|
||||||
parameters = (6,)
|
parameters = (6,)
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
|
@ -246,10 +267,15 @@ class sqlThread(threading.Thread):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'In messages.dat database, dropping and recreating'
|
'In messages.dat database, dropping and recreating'
|
||||||
' the inventory table.')
|
' the inventory table.')
|
||||||
self.cur.execute( '''DROP TABLE inventory''')
|
self.cur.execute('''DROP TABLE inventory''')
|
||||||
self.cur.execute( '''CREATE TABLE inventory (hash blob, objecttype int, streamnumber int, payload blob, expirestime integer, tag blob, UNIQUE(hash) ON CONFLICT REPLACE)''' )
|
self.cur.execute(
|
||||||
self.cur.execute( '''DROP TABLE objectprocessorqueue''')
|
'''CREATE TABLE inventory'''
|
||||||
self.cur.execute( '''CREATE TABLE objectprocessorqueue (objecttype int, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''' )
|
''' (hash blob, objecttype int, streamnumber int, payload blob, expirestime integer,'''
|
||||||
|
''' tag blob, UNIQUE(hash) ON CONFLICT REPLACE)''')
|
||||||
|
self.cur.execute('''DROP TABLE objectprocessorqueue''')
|
||||||
|
self.cur.execute(
|
||||||
|
'''CREATE TABLE objectprocessorqueue'''
|
||||||
|
''' (objecttype int, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''')
|
||||||
item = '''update settings set value=? WHERE key='version';'''
|
item = '''update settings set value=? WHERE key='version';'''
|
||||||
parameters = (7,)
|
parameters = (7,)
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
|
@ -311,15 +337,24 @@ class sqlThread(threading.Thread):
|
||||||
' fields into the retrynumber field and adding the'
|
' fields into the retrynumber field and adding the'
|
||||||
' sleeptill and ttl fields...')
|
' sleeptill and ttl fields...')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TEMPORARY TABLE sent_backup (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text, ackdata blob, lastactiontime integer, status text, retrynumber integer, folder text, encodingtype int)''' )
|
'''CREATE TEMPORARY TABLE sent_backup'''
|
||||||
|
''' (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text,'''
|
||||||
|
''' ackdata blob, lastactiontime integer, status text, retrynumber integer,'''
|
||||||
|
''' folder text, encodingtype int)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO sent_backup SELECT msgid, toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, 0, folder, encodingtype FROM sent;''')
|
'''INSERT INTO sent_backup SELECT msgid, toaddress, toripe, fromaddress,'''
|
||||||
self.cur.execute( '''DROP TABLE sent''')
|
''' subject, message, ackdata, lastactiontime,'''
|
||||||
|
''' status, 0, folder, encodingtype FROM sent;''')
|
||||||
|
self.cur.execute('''DROP TABLE sent''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text, ackdata blob, senttime integer, lastactiontime integer, sleeptill int, status text, retrynumber integer, folder text, encodingtype int, ttl int)''' )
|
'''CREATE TABLE sent'''
|
||||||
|
''' (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text,'''
|
||||||
|
''' ackdata blob, senttime integer, lastactiontime integer, sleeptill int, status text,'''
|
||||||
|
''' retrynumber integer, folder text, encodingtype int, ttl int)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO sent SELECT msgid, toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, lastactiontime, 0, status, 0, folder, encodingtype, 216000 FROM sent_backup;''')
|
'''INSERT INTO sent SELECT msgid, toaddress, toripe, fromaddress, subject, message, ackdata,'''
|
||||||
self.cur.execute( '''DROP TABLE sent_backup''')
|
''' lastactiontime, lastactiontime, 0, status, 0, folder, encodingtype, 216000 FROM sent_backup;''')
|
||||||
|
self.cur.execute('''DROP TABLE sent_backup''')
|
||||||
logger.info('In messages.dat database, finished making TTL-related changes.')
|
logger.info('In messages.dat database, finished making TTL-related changes.')
|
||||||
logger.debug('In messages.dat database, adding address field to the pubkeys table.')
|
logger.debug('In messages.dat database, adding address field to the pubkeys table.')
|
||||||
# We're going to have to calculate the address for each row in the pubkeys
|
# We're going to have to calculate the address for each row in the pubkeys
|
||||||
|
@ -336,16 +371,24 @@ class sqlThread(threading.Thread):
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
# Now we can remove the hash field from the pubkeys table.
|
# Now we can remove the hash field from the pubkeys table.
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TEMPORARY TABLE pubkeys_backup (address text, addressversion int, transmitdata blob, time int, usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''' )
|
'''CREATE TEMPORARY TABLE pubkeys_backup'''
|
||||||
|
''' (address text, addressversion int, transmitdata blob, time int,'''
|
||||||
|
''' usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO pubkeys_backup SELECT address, addressversion, transmitdata, time, usedpersonally FROM pubkeys;''')
|
'''INSERT INTO pubkeys_backup'''
|
||||||
self.cur.execute( '''DROP TABLE pubkeys''')
|
''' SELECT address, addressversion, transmitdata, time, usedpersonally FROM pubkeys;''')
|
||||||
|
self.cur.execute('''DROP TABLE pubkeys''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''CREATE TABLE pubkeys (address text, addressversion int, transmitdata blob, time int, usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''' )
|
'''CREATE TABLE pubkeys'''
|
||||||
|
''' (address text, addressversion int, transmitdata blob, time int, usedpersonally text,'''
|
||||||
|
''' UNIQUE(address) ON CONFLICT REPLACE)''')
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''INSERT INTO pubkeys SELECT address, addressversion, transmitdata, time, usedpersonally FROM pubkeys_backup;''')
|
'''INSERT INTO pubkeys SELECT'''
|
||||||
self.cur.execute( '''DROP TABLE pubkeys_backup''')
|
''' address, addressversion, transmitdata, time, usedpersonally FROM pubkeys_backup;''')
|
||||||
logger.debug('In messages.dat database, done adding address field to the pubkeys table and removing the hash field.')
|
self.cur.execute('''DROP TABLE pubkeys_backup''')
|
||||||
|
logger.debug(
|
||||||
|
'In messages.dat database, done adding address field to the pubkeys table'
|
||||||
|
' and removing the hash field.')
|
||||||
self.cur.execute('''update settings set value=10 WHERE key='version';''')
|
self.cur.execute('''update settings set value=10 WHERE key='version';''')
|
||||||
|
|
||||||
# Are you hoping to add a new option to the keys.dat file of existing
|
# Are you hoping to add a new option to the keys.dat file of existing
|
||||||
|
@ -355,7 +398,7 @@ class sqlThread(threading.Thread):
|
||||||
try:
|
try:
|
||||||
testpayload = '\x00\x00'
|
testpayload = '\x00\x00'
|
||||||
t = ('1234', 1, testpayload, '12345678', 'no')
|
t = ('1234', 1, testpayload, '12345678', 'no')
|
||||||
self.cur.execute( '''INSERT INTO pubkeys VALUES(?,?,?,?,?)''', t)
|
self.cur.execute('''INSERT INTO pubkeys VALUES(?,?,?,?,?)''', t)
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
'''SELECT transmitdata FROM pubkeys WHERE address='1234' ''')
|
'''SELECT transmitdata FROM pubkeys WHERE address='1234' ''')
|
||||||
|
@ -365,13 +408,29 @@ class sqlThread(threading.Thread):
|
||||||
self.cur.execute('''DELETE FROM pubkeys WHERE address='1234' ''')
|
self.cur.execute('''DELETE FROM pubkeys WHERE address='1234' ''')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
if transmitdata == '':
|
if transmitdata == '':
|
||||||
logger.fatal('Problem: The version of SQLite you have cannot store Null values. Please download and install the latest revision of your version of Python (for example, the latest Python 2.7 revision) and try again.\n')
|
logger.fatal(
|
||||||
logger.fatal('PyBitmessage will now exit very abruptly. You may now see threading errors related to this abrupt exit but the problem you need to solve is related to SQLite.\n\n')
|
'Problem: The version of SQLite you have cannot store Null values.'
|
||||||
|
' Please download and install the latest revision of your version of Python'
|
||||||
|
' (for example, the latest Python 2.7 revision) and try again.\n')
|
||||||
|
logger.fatal(
|
||||||
|
'PyBitmessage will now exit very abruptly.'
|
||||||
|
' You may now see threading errors related to this abrupt exit'
|
||||||
|
' but the problem you need to solve is related to SQLite.\n\n')
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While null value test) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(While null value test) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
|
@ -387,11 +446,21 @@ class sqlThread(threading.Thread):
|
||||||
if int(value) < int(time.time()) - 86400:
|
if int(value) < int(time.time()) - 86400:
|
||||||
logger.info('It has been a long time since the messages.dat file has been vacuumed. Vacuuming now...')
|
logger.info('It has been a long time since the messages.dat file has been vacuumed. Vacuuming now...')
|
||||||
try:
|
try:
|
||||||
self.cur.execute( ''' VACUUM ''')
|
self.cur.execute(''' VACUUM ''')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While VACUUM) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(While VACUUM) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
item = '''update settings set value=? WHERE key='lastvacuumtime';'''
|
item = '''update settings set value=? WHERE key='lastvacuumtime';'''
|
||||||
parameters = (int(time.time()),)
|
parameters = (int(time.time()),)
|
||||||
|
@ -406,8 +475,18 @@ class sqlThread(threading.Thread):
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(While committing) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(While committing) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
elif item == 'exit':
|
elif item == 'exit':
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
@ -421,8 +500,18 @@ class sqlThread(threading.Thread):
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while movemessagstoprog) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(while movemessagstoprog) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
shutil.move(
|
shutil.move(
|
||||||
|
@ -437,8 +526,18 @@ class sqlThread(threading.Thread):
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while movemessagstoappdata) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(while movemessagstoappdata) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
shutil.move(
|
shutil.move(
|
||||||
|
@ -451,11 +550,21 @@ class sqlThread(threading.Thread):
|
||||||
self.cur.execute('''delete from sent where folder='trash' ''')
|
self.cur.execute('''delete from sent where folder='trash' ''')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
try:
|
try:
|
||||||
self.cur.execute( ''' VACUUM ''')
|
self.cur.execute(''' VACUUM ''')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while deleteandvacuume) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(while deleteandvacuume) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
parameters = helper_sql.sqlSubmitQueue.get()
|
parameters = helper_sql.sqlSubmitQueue.get()
|
||||||
|
@ -467,11 +576,30 @@ class sqlThread(threading.Thread):
|
||||||
rowcount = self.cur.rowcount
|
rowcount = self.cur.rowcount
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
logger.fatal(
|
||||||
queues.UISignalQueue.put(('alert', (tr._translate("MainWindow", "Disk full"), tr._translate("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
'(while cur.execute) Alert: Your disk or data storage volume is full.'
|
||||||
|
' sqlThread will now exit.')
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'alert', (
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Disk full"),
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow",
|
||||||
|
'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'),
|
||||||
|
True)))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
logger.fatal('Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "%s" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: %s. Here is the actual error message thrown by the sqlThread: %s', str(item), str(repr(parameters)), str(err))
|
logger.fatal(
|
||||||
|
'Major error occurred when trying to execute a SQL statement within the sqlThread.'
|
||||||
|
' Please tell Atheros about this error message or post it in the forum!'
|
||||||
|
' Error occurred while trying to execute statement: "%s" Here are the parameters;'
|
||||||
|
' you might want to censor this data with asterisks (***)'
|
||||||
|
' as it can contain private information: %s.'
|
||||||
|
' Here is the actual error message thrown by the sqlThread: %s',
|
||||||
|
str(item),
|
||||||
|
str(repr(parameters)),
|
||||||
|
str(err))
|
||||||
logger.fatal('This program shall now abruptly exit!')
|
logger.fatal('This program shall now abruptly exit!')
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user