Skip to content

Commit 8630e71

Browse files
fix: sqlite benchmark schema setup
1 parent a17d1ca commit 8630e71

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ dist
137137
output/*
138138
docker-upload/*
139139

140-
plugin.wasm
140+
plugin.wasm
141+
sales.db

benchmark/BenchmarkRunner/Utils/SqliteDatabaseHelper.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,8 @@ private static async Task CreateSchemaAsync(string connectionString, string sche
2727
var schemaSql = await File.ReadAllTextAsync(schemaPath);
2828
using var connection = new SqliteConnection(connectionString);
2929
await connection.OpenAsync();
30-
31-
// Split the SQL by semicolons and execute each statement separately
32-
// SQLite doesn't handle multiple statements in a single ExecuteNonQueryAsync call
33-
var statements = schemaSql
34-
.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
35-
.Where(s => !string.IsNullOrWhiteSpace(s))
36-
.ToArray();
37-
38-
foreach (var statement in statements)
39-
{
40-
using var command = new SqliteCommand(statement, connection);
41-
await command.ExecuteNonQueryAsync();
42-
}
30+
using var command = new SqliteCommand(schemaSql, connection);
31+
await command.ExecuteNonQueryAsync();
4332
}
4433

4534
public static void CleanupDatabase(string connectionString)

benchmark/scripts/run_single_benchmark.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ else
1919
trap destroy EXIT
2020

2121
echo "Running in local"
22-
docker-compose up --build --detach --force-recreate --remove-orphans --wait
22+
if [ "$database_to_benchmark" = "mysql" ]; then
23+
docker-compose up --build --detach --force-recreate --remove-orphans --wait mysqldb
24+
elif [ "$database_to_benchmark" = "postgresql" ]; then
25+
docker-compose up --build --detach --force-recreate --remove-orphans --wait postgresdb
26+
fi
2327
dotnet_run
2428
fi

0 commit comments

Comments
 (0)