A library to allow multiple applications/processes to share a single SQLite database
Install-Package MyOddWeb.Data.SQLiteServer -Version 0.1.2.1
dotnet add package MyOddWeb.Data.SQLiteServer --version 0.1.2.1
paket add MyOddWeb.Data.SQLiteServer --version 0.1.2.1
A common issue with SQLite is that, by design, only one process can connect to the database, while this is a perfectly normal use case, (and by design), there are some cases where more than one applications might want to share some data, (one does all the insert while another does the queries.)
In the folder \console\ there is a sample application, start one or more instance of this app and you can run queries.
var connection = new SQLiteServerConnection($"Data Source={source};Version=3;", Address, Port, Backlog, HeartBeatTimeOut);
connection.Open();
try
{
using (var command = new SQLiteServerCommand(s, connection))
{
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine($"\t{reader[0]}");
}
}
}
}
catch (SQLiteServerException e)
{
Console.WriteLine( e.Message );
}
connection.Close();Basically do the same thing...
var connection = new SQLiteServerConnection($"Data Source={source};Version=3;", Address, Port, Backlog, HeartBeatTimeOut);
connection.Open();
try
{
using (var command = new SQLiteServerCommand(s, connection))
{
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine($"\t{reader[0]}");
}
}
}
}
catch (SQLiteServerException e)
{
Console.WriteLine( e.Message );
}
connection.Close();The initial tests showed that server was as fast as the default libraries, (but of course slower than the C++ library itself)
Data files are either similar speed or a tiny bit slower, (see the results below)
:memory: datasource, is, of course, a lot slower.
Please see the performance app to run your own tests, \performance\SQLiteServerPerformance.sln.
While 'similar' performance will never be achieved, I am aiming for a degradation of no more than 5%.
I am using the \performance\SQLiteServerPerformance.sln application to run comparaison tests.
0.1.2.1BackupDatabase0.1.1.0IsDBNull( idx )0.1.1.0HasRows0.1.1.0FieldCount0.1.1.0GetName( idx )0.1.1.0GetTableName( idx )
0.1.1.2GetBoolean( idx )0.1.2.1GetGuid( idx )0.1.2.1GetByte( idx )0.1.2.1GetChar( idx )GetDateTime( idx )0.1.1.3GetDataTypeName( idx )0.1.1.2GetDecimal( idx )0.1.1.0GetDouble( idx )0.1.1.2GetFloat( idx )0.1.1.3NextResult()
- Namepipe might be faster, need to investigate more.
- Create Nuget package
- Some code cleanup
0.1.1.0Performance testing/report.0.1.1.1SQLiteServerConnectionshould implementDbConnectionSQLiteServerCommandshould implementDbCommand- Need to implement
DbCommand CreateDbCommand(){}when this is done
- Need to implement
SqliteServerDataReadershould implementDbDataReader0.1.1.1SQLiteServerTransactionshould implementDbTransaction
- sqlite.org (duh!)
- System.Data.SQLite
If I forgot someone, please let me know and I will gladly add them here :)

