Conversation
- in order to keep record of which query generated each result
474ea15 to
6da726b
Compare
63b2ca9 to
57ea872
Compare
internal/db/db.go
Outdated
| for _, query := range queries { | ||
| if shouldContinue := readQueryResultSet(queryRows, statementResultCh, query); !shouldContinue { | ||
| return false | ||
| } | ||
|
|
||
| hasResultSetToRead = queryRows.NextResultSet() | ||
| hasResultSetToRead = queryRows.NextResultSet() | ||
| } |
There was a problem hiding this comment.
You don't wanna to iterate twice here
internal/db/utils.go
Outdated
| var explainQueryPlanColumnNames = []string{"id", "parent", "notused", "detail"} | ||
|
|
||
| func queryContainsExplainQueryPlanStatement(query string) bool { | ||
| return strings.Contains( |
There was a problem hiding this comment.
Maybe a StartsWith is safer now, what do you think?
There was a problem hiding this comment.
According to the docs: https://www.sqlite.org/lang_explain.html
EXPLAIN QUERY PLAN always appears in the beggining of statements, bug I agree that having some extra safety woud be nice.
internal/db/utils.go
Outdated
| return false | ||
| } | ||
| for _, colName := range explainQueryPlanColumnNames { | ||
| if !slices.Contains(colNames, colName) { |
There was a problem hiding this comment.
I think these ones we can match exactly, not with contains
57ea872 to
853980b
Compare
853980b to
3eff2e6
Compare
3eff2e6 to
8b0663d
Compare
| _, _, err := s.tc.Execute("CREATE TABLE fake_explain (ID INTEGER PRIMARY KEY, PARENT INTEGER, NOTUSED INTEGER, DETAIL TEXT);") | ||
| s.tc.Assert(err, qt.IsNil) | ||
|
|
||
| outS, errS, err := s.tc.ExecuteShell([]string{"SELECT * FROM fake_explain;"}) |
There was a problem hiding this comment.
shouldn't you be testing the EXPLAI QUERY PLAN command?
There was a problem hiding this comment.
Actually this is testing that a table with the same column names as the EQP table will still be treated as a normal table (which it should).
Description
Adds an ASCII tree representation to the output of
EXPLAIN QUERY PLAN ...Related Issues
Visual reference
Here's an example