Skip to content

Commit d6acbc3

Browse files
committed
refactor sqlthread and add create test cases
1 parent 3b5c239 commit d6acbc3

28 files changed

+913
-548
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def run(self):
5151
if __name__ == "__main__":
5252
here = os.path.abspath(os.path.dirname(__file__))
5353
with open(os.path.join(here, 'README.md')) as f:
54-
README = f.read()
54+
README. = f.read()
5555

5656
with open(os.path.join(here, 'requirements.txt'), 'r') as f:
5757
requirements = list(f.readlines())

src/class_sqlThread.py

Lines changed: 341 additions & 519 deletions
Large diffs are not rendered by default.

src/sql/config_setting_ver_2.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE pubkeys ADD usedpersonally text DEFAULT 'no';

src/sql/config_setting_ver_3.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE inbox ADD encodingtype int DEFAULT '2';
2+
3+
ALTER TABLE inbox ADD read bool DEFAULT '1';
4+
5+
ALTER TABLE sent ADD encodingtype int DEFAULT '2';

src/sql/init_version_10.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- --
2+
-- -- Update the address colunm to unique in addressbook table
3+
-- --
4+
5+
ALTER TABLE addressbook RENAME TO old_addressbook;
6+
7+
CREATE TABLE `addressbook` (
8+
`label` text ,
9+
`address` text ,
10+
UNIQUE(address) ON CONFLICT IGNORE
11+
) ;
12+
13+
INSERT INTO addressbook SELECT label, address FROM old_addressbook;
14+
15+
DROP TABLE old_addressbook;

src/sql/init_version_2.sql

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--
2+
-- Let's get rid of the first20bytesofencryptedmessage field in the inventory table.
3+
--
4+
5+
CREATE TEMP TABLE `inventory_backup` (
6+
`hash` blob ,
7+
`objecttype` text ,
8+
`streamnumber` int ,
9+
`payload` blob ,
10+
`receivedtime` int ,
11+
UNIQUE(hash) ON CONFLICT REPLACE
12+
) ;
13+
14+
INSERT INTO `inventory_backup` SELECT hash, objecttype, streamnumber, payload, receivedtime FROM inventory;
15+
16+
DROP TABLE inventory;
17+
18+
CREATE TABLE `inventory` (
19+
`hash` blob ,
20+
`objecttype` text ,
21+
`streamnumber` int ,
22+
`payload` blob ,
23+
`receivedtime` int ,
24+
UNIQUE(hash) ON CONFLICT REPLACE
25+
) ;
26+
27+
INSERT INTO inventory SELECT hash, objecttype, streamnumber, payload, receivedtime FROM inventory_backup;
28+
29+
DROP TABLE inventory_backup;

src/sql/init_version_3.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--
2+
-- Add a new column to the inventory table to store tags.
3+
--
4+
5+
ALTER TABLE inventory ADD tag blob DEFAULT '';

src/sql/init_version_4.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--
2+
-- Add a new column to the pubkeys table to store the address version.
3+
-- We're going to trash all of our pubkeys and let them be redownloaded.
4+
--
5+
6+
DROP TABLE pubkeys;
7+
8+
CREATE TABLE `pubkeys` (
9+
`hash` blob ,
10+
`addressversion` int ,
11+
`transmitdata` blob ,
12+
`time` int ,
13+
`usedpersonally` text ,
14+
UNIQUE(hash, addressversion) ON CONFLICT REPLACE
15+
) ;
16+
17+
DELETE FROM inventory WHERE objecttype = 'pubkey';

src/sql/init_version_5.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--
2+
-- Add a new table: objectprocessorqueue with which to hold objects
3+
-- that have yet to be processed if the user shuts down Bitmessage.
4+
--
5+
6+
DROP TABLE knownnodes;
7+
8+
CREATE TABLE `objectprocessorqueue` (
9+
`objecttype` text,
10+
`data` blob,
11+
UNIQUE(objecttype, data) ON CONFLICT REPLACE
12+
) ;

src/sql/init_version_6.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--
2+
-- changes related to protocol v3
3+
-- In table inventory and objectprocessorqueue, objecttype is now
4+
-- an integer (it was a human-friendly string previously)
5+
--
6+
7+
DROP TABLE inventory;
8+
9+
CREATE TABLE `inventory` (
10+
`hash` blob,
11+
`objecttype` int,
12+
`streamnumber` int,
13+
`payload` blob,
14+
`expirestime` integer,
15+
`tag` blob,
16+
UNIQUE(hash) ON CONFLICT REPLACE
17+
) ;
18+
19+
DROP TABLE objectprocessorqueue;
20+
21+
CREATE TABLE `objectprocessorqueue` (
22+
`objecttype` int,
23+
`data` blob,
24+
UNIQUE(objecttype, data) ON CONFLICT REPLACE
25+
) ;

0 commit comments

Comments
 (0)