Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Fixes: 26c11206f433 ("perf scripts python: exported-sql-viewer.py: Use new 'has_calls' column")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org # v5.3+
Link: http://lore.kernel.org/lkml/20191113120206.26957-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
af833988 da3ef7f6

+9 -3
+9 -3
tools/perf/scripts/python/exported-sql-viewer.py
··· 637 637 self.query_done = True 638 638 if_has_calls = "" 639 639 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 641 641 query = QSqlQuery(glb.db) 642 642 QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls) 643 643 while query.next(): ··· 918 918 self.query_done = True 919 919 if_has_calls = "" 920 920 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 922 922 query = QSqlQuery(glb.db) 923 923 QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls) 924 924 while query.next(): ··· 1290 1290 QueryExec(query, "SELECT id, c_time" 1291 1291 " FROM comms" 1292 1292 " WHERE c_thread_id = " + str(thread_id) + 1293 - " AND exec_flag = TRUE" 1293 + " AND exec_flag = " + self.collection.glb.dbref.TRUE + 1294 1294 " AND c_time >= " + str(start_time) + 1295 1295 " AND c_time <= " + str(end_time) + 1296 1296 " ORDER BY c_time, id") ··· 5016 5016 def __init__(self, is_sqlite3, dbname): 5017 5017 self.is_sqlite3 = is_sqlite3 5018 5018 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" 5019 5025 5020 5026 def Open(self, connection_name): 5021 5027 dbname = self.dbname