diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2024-01-04 19:12:29 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2024-01-04 19:12:29 +0530 |
commit | d5a496e1d90de48e563cd995165128be32f65f0a (patch) | |
tree | 1737a0c64198eea5d3c50b7f5066abfef7fda9e1 /index.html | |
parent | 289d5a1a6d6997722f35b7f7303c7b3ce9afffa4 (diff) |
show raw query
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -151,7 +151,7 @@ }, null, 2); } - function createTable(results, className) { + function createTable(results, className, rawQuery) { const result = results[0]; const columns = result.columns; const rows = result.values; @@ -190,6 +190,16 @@ table.appendChild(tbody); tableContainer.innerHTML = ""; tableContainer.appendChild(table); + + const pre = document.createElement("pre") + pre.innerHTML = rawQuery + + const details = document.createElement("details") + const summary = document.createElement("summary") + summary.innerText = "Raw SQL Query" + details.appendChild(summary) + details.appendChild(pre) + tableContainer.appendChild(details) } function getClassesByInstructor() { @@ -199,7 +209,7 @@ console.log(query); const results = db.exec(query); - createTable(results, "table-container") + createTable(results, "table-container", query) sorttable.makeSortable(document.getElementById("table-container").children[0]); } @@ -208,7 +218,7 @@ let query = `SELECT YearTerm as "YearTerms", insname1 as Instructor, AVG_GRD as "Average Grade", PCT_A as "% A", PCT_B as "% B", PCT_C_MINUS_OR_BELOW as "% C- and below", N_GRADE as "No. Graded" FROM raw_data WHERE Subject || ' ' || Course = '${classCode.toUpperCase()}';` const results = db.exec(query); - createTable(results, "table-container-class-codes") + createTable(results, "table-container-class-codes", query) sorttable.makeSortable(document.getElementById("table-container-class-codes").children[0]); } @@ -238,7 +248,7 @@ console.log(query); const results = db.exec(query); - createTable(results, "table-container-division") + createTable(results, "table-container-division", query) sorttable.makeSortable(document.getElementById("table-container-division").children[0]); } |