Skip to content

Commit 464cf45

Browse files
authored
Merge pull request #260 from diffix/piotr/explicit_fail_empty_columnIndices
Support vanilla SQL in the CLI, when no columns are selected
2 parents 4e0d3db + 2911b9f commit 464cf45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/OpenDiffix.CLI/SQLiteDataProvider.fs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ type DataProvider(dbPath: string) =
8484
)
8585

8686
member this.OpenTable(table, columnIndices) =
87+
8788
let columns =
88-
columnIndices
89-
|> List.map (fun index -> $"\"%s{table.Columns.[index].Name}\"")
90-
|> String.join ", "
89+
if columnIndices.IsEmpty then
90+
"1"
91+
else
92+
columnIndices
93+
|> List.map (fun index -> $"\"%s{table.Columns.[index].Name}\"")
94+
|> String.join ", "
9195

9296
let loadQuery = $"SELECT {columns} FROM {table.Name}"
9397

0 commit comments

Comments
 (0)