Skip to content

Commit

Permalink
Additional debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Sep 1, 2014
1 parent 6a2f0e2 commit 1251d01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ def main():
print("For help on a specific command, type: %s {command} -h" % (parser.prog))
sys.exit(1)

# load the database
tdb = TradeDB(debug=args.debug, dbFilename=args.db)

# run the commands
return args.proc(args)


Expand Down
6 changes: 5 additions & 1 deletion tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ def _connectToDB(self):

# Make sure we don't hold on to an existing connection.
if self.conn:
if self.debug > 2: print("x Disconnect DB")
self.conn.close()
self.conn = None

try:
if self.debug > 1: print("* Connecting to DB")
import sqlite3
self.dbModule = sqlite3
self.conn = self.dbModule.connect(self.dbURI)
Expand Down Expand Up @@ -323,7 +325,7 @@ def reloadCache(self):
if dbFileCreatedTimestamp > max(sqlFileTimestamp, pricesFileTimestamp):
# db is newer.
if self.debug > 1:
print("reloadCache: db file is newer. db:{} > max(sql:{}, prices:{}".format(dbFileCreatedTimestamp, sqlFileTimestamp, pricesFileTimestamp))
print("- SQLite is up to date")
return

if self.debug:
Expand Down Expand Up @@ -585,6 +587,8 @@ def load(self, dbFilename=None):
tdb.load() # x now points to an orphan Aulin
"""

if self.debug > 1: print("* Loading data")

self.cur = self.conn.cursor()

# Load raw tables. Stations will be linked to systems, but nothing else.
Expand Down

0 comments on commit 1251d01

Please sign in to comment.