finish env database query
This commit is contained in:
parent
bb775e4b20
commit
5a128f5e72
|
@ -1,7 +1,10 @@
|
|||
import locale
|
||||
|
||||
# encoding list
|
||||
# https://docs.python.org/3/library/codecs.html#standard-encodings
|
||||
database_encoding = locale.getpreferredencoding()
|
||||
export_db = "export.db"
|
||||
decorated_db = "decorate.db"
|
||||
env_db = "env.db"
|
||||
force_regenerate = False
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import Progressbar
|
|||
|
||||
def run():
|
||||
exportDb = sqlite3.connect(CustomConfig.export_db)
|
||||
exportDb.text_factory = lambda x: x.decode(CustomConfig.database_encoding)
|
||||
exportDb.text_factory = lambda x: x.decode(CustomConfig.database_encoding, errors="ignore")
|
||||
decorateDb = sqlite3.connect(CustomConfig.decorated_db)
|
||||
|
||||
# init table
|
||||
|
|
|
@ -26,7 +26,7 @@ def get_env():
|
|||
env = getattr(g, '_envDatabase', None)
|
||||
if env is None:
|
||||
env = g._envDatabase = sqlite3.connect(CustomConfig.env_db)
|
||||
env.text_factory = lambda x: x.decode(CustomConfig.database_encoding)
|
||||
env.text_factory = lambda x: x.decode(CustomConfig.database_encoding, errors="ignore")
|
||||
return env
|
||||
|
||||
@app.teardown_appcontext
|
||||
|
@ -102,7 +102,7 @@ def envQueryHandle():
|
|||
if fieldLength == 0:
|
||||
cur.execute("SELECT * FROM {}".format(queryTag))
|
||||
else:
|
||||
whereStatement = '&&'.join(map(lambda x: "([" + x + "] = ?)", readyData.keys()))
|
||||
whereStatement = 'AND'.join(map(lambda x: "([" + x + "] = ?)", readyData.keys()))
|
||||
cur.execute("SELECT * FROM {} WHERE ({})".format(queryTag, whereStatement), list(readyData.values()))
|
||||
|
||||
# iterate
|
||||
|
|
|
@ -3,7 +3,7 @@ table.envOutput {
|
|||
}
|
||||
|
||||
table.envOutput tr:nth-child(odd) {
|
||||
background:gray;
|
||||
background:#cfcfcf;
|
||||
}
|
||||
|
||||
table.envOutput tr:nth-child(2n) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user