Skip to content

Commit

Permalink
🐛 (Database) limit info_search and update DDL
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Oct 11, 2018
1 parent ff1691c commit 21ba9eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
38 changes: 19 additions & 19 deletions table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ SET time_zone = "+00:00";
--

CREATE TABLE `info_list` (
`sort_id` int(11) NOT NULL,
`search_name` varchar(200) NOT NULL
`sort_id` int(11) NOT NULL,
`search_name` varchar(200) NOT NULL
COMMENT '搜索名称',
`tracker.byr.cn` int(11) NOT NULL DEFAULT '0',
`npupt.com` int(11) NOT NULL DEFAULT '0',
`pt.nwsuaf6.edu.cn` int(11) NOT NULL DEFAULT '0',
`pttracker6.tjupt.org` int(11) NOT NULL DEFAULT '0',
`hudbt.hust.edu.cn` int(11) NOT NULL DEFAULT '0',
`tracker.whupt.net` int(11) NOT NULL DEFAULT '0',
`ourbits.club` int(11) NOT NULL DEFAULT '0'
`tracker.byr.cn` int(11) NOT NULL DEFAULT '0',
`npupt.com` int(11) NOT NULL DEFAULT '0',
`pt.nwsuaf6.edu.cn` int(11) NOT NULL DEFAULT '0',
`pttrackertju.tjupt.org` int(11) NOT NULL DEFAULT '0',
`hudbt.hust.edu.cn` int(11) NOT NULL DEFAULT '0',
`tracker.whupt.net` int(11) NOT NULL DEFAULT '0',
`ourbits.club` int(11) NOT NULL DEFAULT '0'
)
ENGINE = MyISAM
DEFAULT CHARSET = utf8mb4;
Expand All @@ -44,16 +44,16 @@ CREATE TABLE `info_list` (
--

CREATE TABLE `seed_list` (
`id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`download_id` int(11) DEFAULT '0',
`tracker.byr.cn` int(11) NOT NULL DEFAULT '0',
`npupt.com` int(11) NOT NULL DEFAULT '0',
`pt.nwsuaf6.edu.cn` int(11) NOT NULL DEFAULT '0',
`pttracker6.tjupt.org` int(11) NOT NULL DEFAULT '0',
`hudbt.hust.edu.cn` int(11) NOT NULL DEFAULT '0',
`tracker.whupt.net` int(11) NOT NULL DEFAULT '0',
`ourbits.club` int(11) NOT NULL DEFAULT '0'
`id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`download_id` int(11) DEFAULT '0',
`tracker.byr.cn` int(11) NOT NULL DEFAULT '0',
`npupt.com` int(11) NOT NULL DEFAULT '0',
`pt.nwsuaf6.edu.cn` int(11) NOT NULL DEFAULT '0',
`pttrackertju.tjupt.org` int(11) NOT NULL DEFAULT '0',
`hudbt.hust.edu.cn` int(11) NOT NULL DEFAULT '0',
`tracker.whupt.net` int(11) NOT NULL DEFAULT '0',
`ourbits.club` int(11) NOT NULL DEFAULT '0'
)
ENGINE = MyISAM
DEFAULT CHARSET = utf8mb4;
Expand Down
2 changes: 1 addition & 1 deletion utils/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_data_clone_id(self, key, site) -> None or int:
clone_id = None

key = pymysql.escape_string(re.sub(r"[_\-. ]", "%", key))
sql = "SELECT `{site}` FROM `info_list` WHERE `search_name` LIKE '{key}%'".format(site=site, key=key)
sql = "SELECT `{site}` FROM `info_list` WHERE `search_name` LIKE '{key}'".format(site=site, key=key)
try: # Get clone id info from database
clone_id = int(self.exec(sql=sql)[0])
except TypeError: # The database doesn't have the search data, Return dict only with raw key.
Expand Down

0 comments on commit 21ba9eb

Please sign in to comment.