|
15 | 15 | import paths
|
16 | 16 | import queues
|
17 | 17 | import state
|
18 |
| - import tr |
| 18 | + from tr import _translate |
19 | 19 | from addresses import encodeAddress
|
20 | 20 | from bmconfigparser import BMConfigParser
|
21 | 21 | from debug import logger
|
@@ -436,17 +436,6 @@ def earlier_setting_version(self, settingsversion):
|
436 | 436 | return 4
|
437 | 437 | return settingsversion
|
438 | 438 |
|
439 |
| - # def create_function(self): |
440 |
| - # """ |
441 |
| - # Apply create_function to DB |
442 |
| - # """ |
443 |
| - # try: |
444 |
| - # self.conn.create_function("enaddr", 3, func=encodeAddress, deterministic=True) |
445 |
| - # except (TypeError, sqlite3.NotSupportedError) as err: |
446 |
| - # logger.debug( |
447 |
| - # "Got error while pass deterministic in sqlite create function {}, Passing 3 params".format(err)) |
448 |
| - # self.conn.create_function("enaddr", 3, encodeAddress) |
449 |
| - |
450 | 439 |
|
451 | 440 | class sqlThread(threading.Thread, UpgradeDB):
|
452 | 441 | """A thread for all SQL operations"""
|
@@ -511,54 +500,6 @@ def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-s
|
511 | 500 |
|
512 | 501 | self.check_vaccumed()
|
513 | 502 |
|
514 |
| - # def initiate_database(self, cur=None, conn=None): |
515 |
| - # if not cur or not conn: |
516 |
| - # cur, conn = self.cur, self.conn |
517 |
| - # try: |
518 |
| - # cur.execute( |
519 |
| - # '''CREATE TABLE inbox (msgid blob, toaddress text, fromaddress text, subject text,''' |
520 |
| - # ''' received text, message text, folder text, encodingtype int, read bool, sighash blob,''' |
521 |
| - # ''' UNIQUE(msgid) ON CONFLICT REPLACE)''') |
522 |
| - # cur.execute( |
523 |
| - # '''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text,''' |
524 |
| - # ''' message text, ackdata blob, senttime integer, lastactiontime integer,''' |
525 |
| - # ''' sleeptill integer, status text, retrynumber integer, folder text, encodingtype int, ttl int)''') |
526 |
| - # cur.execute( |
527 |
| - # '''CREATE TABLE subscriptions (label text, address text, enabled bool)''') |
528 |
| - # cur.execute( |
529 |
| - # '''CREATE TABLE addressbook (label text, address text, UNIQUE(address) ON CONFLICT IGNORE)''') |
530 |
| - # cur.execute( |
531 |
| - # '''CREATE TABLE blacklist (label text, address text, enabled bool)''') |
532 |
| - # cur.execute( |
533 |
| - # '''CREATE TABLE whitelist (label text, address text, enabled bool)''') |
534 |
| - # cur.execute( |
535 |
| - # '''CREATE TABLE pubkeys (address text, addressversion int, transmitdata blob, time int,''' |
536 |
| - # ''' usedpersonally text, UNIQUE(address) ON CONFLICT REPLACE)''') |
537 |
| - # cur.execute( |
538 |
| - # '''CREATE TABLE inventory (hash blob, objecttype int, streamnumber int, payload blob,''' |
539 |
| - # ''' expirestime integer, tag blob, UNIQUE(hash) ON CONFLICT REPLACE)''') |
540 |
| - # cur.execute( |
541 |
| - # '''INSERT INTO subscriptions VALUES''' |
542 |
| - # '''('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''') |
543 |
| - # cur.execute( |
544 |
| - # '''CREATE TABLE settings (key blob, value blob, UNIQUE(key) ON CONFLICT REPLACE)''') |
545 |
| - # cur.execute('''INSERT INTO settings VALUES('version','11')''') |
546 |
| - # cur.execute('''INSERT INTO settings VALUES('lastvacuumtime',?)''', ( |
547 |
| - # int(time.time()),)) |
548 |
| - # cur.execute( |
549 |
| - # '''CREATE TABLE objectprocessorqueue''' |
550 |
| - # ''' (objecttype int, data blob, UNIQUE(objecttype, data) ON CONFLICT REPLACE)''') |
551 |
| - # self.conn.commit() |
552 |
| - # logger.info('Created messages database file') |
553 |
| - # except Exception as err: |
554 |
| - # if str(err) == 'table inbox already exists': |
555 |
| - # logger.debug('Database file already exists.') |
556 |
| - # |
557 |
| - # else: |
558 |
| - # sys.stderr.write( |
559 |
| - # 'ERROR trying to create database file (message.dat). in1111 Error message: %s\n' % str(err)) |
560 |
| - # os._exit(0) |
561 |
| - |
562 | 503 | def initiate_database(self, cur, conn):
|
563 | 504 | try:
|
564 | 505 | cur.execute(
|
@@ -605,7 +546,6 @@ def initiate_database(self, cur, conn):
|
605 | 546 | 'ERROR trying to create database file (message.dat). in1111 Error message: %s\n' % str(err))
|
606 | 547 | os._exit(0)
|
607 | 548 |
|
608 |
| - |
609 | 549 | def create_function(self, conn):
|
610 | 550 | """
|
611 | 551 | Apply create_function to DB
|
|
0 commit comments