History

perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite

Prior to version 3.23 SQLite does not support TRUE or FALSE, so always use 1 and 0 for SQLite.

Adrian Hunter committed 7 years ago

Commit af833981 parent da3ef7f1 file · +9 −3Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/exported-sql-viewer.py+9−3
@@ -637,7 +637,7 @@ class CallGraphRootItem(CallGraphLevelItemBase): · 636 unmodified lines
637637 self.query_done = True
638638 if_has_calls = ""
639639 if IsSelectable(glb.db, "comms", columns = "has_calls"):
640− if_has_calls = " WHERE has_calls = TRUE"
640+ if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE
641641 query = QSqlQuery(glb.db)
642642 QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls)
643643 while query.next():
@@ -918,7 +918,7 @@ class CallTreeRootItem(CallGraphLevelItemBase): · 274 unmodified lines
918918 self.query_done = True
919919 if_has_calls = ""
920920 if IsSelectable(glb.db, "comms", columns = "has_calls"):
921− if_has_calls = " WHERE has_calls = TRUE"
921+ if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE
922922 query = QSqlQuery(glb.db)
923923 QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls)
924924 while query.next():
@@ -1290,7 +1290,7 @@ class SwitchGraphData(GraphData): · 365 unmodified lines
12901290 QueryExec(query, "SELECT id, c_time"
12911291 " FROM comms"
12921292 " WHERE c_thread_id = " + str(thread_id) +
1293− " AND exec_flag = TRUE"
1293+ " AND exec_flag = " + self.collection.glb.dbref.TRUE +
12941294 " AND c_time >= " + str(start_time) +
12951295 " AND c_time <= " + str(end_time) +
12961296 " ORDER BY c_time, id")
@@ -5016,6 +5016,12 @@ class DBRef(): · 3719 unmodified lines
50165016 def __init__(self, is_sqlite3, dbname):
50175017 self.is_sqlite3 = is_sqlite3
50185018 self.dbname = dbname
5019+ self.TRUE = "TRUE"
5020+ self.FALSE = "FALSE"
5021+ # SQLite prior to version 3.23 does not support TRUE and FALSE
5022+ if self.is_sqlite3:
5023+ self.TRUE = "1"
5024+ self.FALSE = "0"
50195025
50205026 def Open(self, connection_name):
50215027 dbname = self.dbname