Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/Microsoft.Data.Sqlite.Core/SqliteConnectionInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,26 @@ public void Dispose()
_pool = null;
}

private string QuotePassword(string pswd)
private string QuotePassword(string password)
{
sqlite3 dbMem;
int rc = sqlite3_open(":memory:", out dbMem);
SqliteException.ThrowExceptionForRC(rc, dbMem);
sqlite3_stmt stmt = null!;
SqliteException.ThrowExceptionForRC(sqlite3_open(":memory:", out var db), db);
try
{
rc = sqlite3_prepare_v2(dbMem, "SELECT quote($password);", out stmt);
SqliteException.ThrowExceptionForRC(rc, dbMem);
sqlite3_bind_text(stmt, 1, pswd);
rc = sqlite3_step(stmt);
SqliteException.ThrowExceptionForRC(rc, dbMem);
return sqlite3_column_text(stmt, 0).utf8_to_string();
SqliteException.ThrowExceptionForRC(sqlite3_prepare_v2(db, "SELECT quote($password);", out var stmt), db);
try
{
sqlite3_bind_text(stmt, 1, password);
SqliteException.ThrowExceptionForRC(sqlite3_step(stmt), db);
return sqlite3_column_text(stmt, 0).utf8_to_string();
}
finally
{
stmt.Dispose();
}
}
finally
{
stmt.Dispose();
dbMem.Dispose();
db.Dispose();
}
}

Expand Down