-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLite scratchpad.ps1
More file actions
55 lines (49 loc) · 2.28 KB
/
SQLite scratchpad.ps1
File metadata and controls
55 lines (49 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 1) Path to generated DB
$db = 'C:\Users\MPhil\source\repos\VoiceLauncherBlazor\voicelauncher-azure.db'
# 2) Check existence
if (-not (Test-Path $db)) {
Write-Host "Error: DB not found at $db"
exit 1
}
Write-Host "DB found at $db"
# 3) List tables (using sqlite3 if installed)
if (Get-Command sqlite3 -ErrorAction SilentlyContinue) {
sqlite3 $db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
} else {
Write-Host "sqlite3 not installed in path, skipping table list."
}
# 4) Show first 10 rows from key sample tables
if (Get-Command sqlite3 -ErrorAction SilentlyContinue) {
Write-Host "`n== Sample: Transactions (10 rows) =="
sqlite3 $db "SELECT Id, Date, Description, MoneyIn, MoneyOut, Balance FROM Transaction LIMIT 10;"
Write-Host "`n== Sample: Categories (10 rows) =="
sqlite3 $db "SELECT Id, CategoryName, CategoryType, Sensitive FROM Categories LIMIT 10;"
Write-Host "`n== Sample: Logins (10 rows) =="
sqlite3 $db "SELECT Id, Name, Username, Description FROM Logins LIMIT 10;"
} else {
Write-Host "Install sqlite3 CLI to run these selects, or use a VS Code extension (instructions below)."
}# 1) Path to generated DB
$db = 'C:\Users\MPhil\source\repos\VoiceLauncherBlazor\voicelauncher-azure.db'
# 2) Check existence
if (-not (Test-Path $db)) {
Write-Host "Error: DB not found at $db"
exit 1
}
Write-Host "DB found at $db"
# 3) List tables (using sqlite3 if installed)
if (Get-Command sqlite3 -ErrorAction SilentlyContinue) {
sqlite3 $db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
} else {
Write-Host "sqlite3 not installed in path, skipping table list."
}
# 4) Show first 10 rows from key sample tables
if (Get-Command sqlite3 -ErrorAction SilentlyContinue) {
Write-Host "`n== Sample: Transactions (10 rows) =="
sqlite3 $db "SELECT Id, Date, Description, MoneyIn, MoneyOut, Balance FROM Transaction LIMIT 10;"
Write-Host "`n== Sample: Categories (10 rows) =="
sqlite3 $db "SELECT Id, CategoryName, CategoryType, Sensitive FROM Categories LIMIT 10;"
Write-Host "`n== Sample: Logins (10 rows) =="
sqlite3 $db "SELECT Id, Name, Username, Description FROM Logins LIMIT 10;"
} else {
Write-Host "Install sqlite3 CLI to run these selects, or use a VS Code extension (instructions below)."
}