MyOddWeb.com SQLiteServer
![Build Status](https://camo.githubusercontent.com/e3140a58e128c0b825682f61dbfeb534b8b6de8a066148704f85f386a93f9e9c/68747470733a2f2f7472617669732d63692e6f72672f46464d472f53514c6974655365727665722e7376673f6272616e63683d6d6173746572)
A library to allow multiple applications/processes to share a single SQLite database
Nuget
Package manager
Install-Package MyOddWeb.Data.SQLiteServer -Version 0.1.2.1
CLI
.NET
dotnet add package MyOddWeb.Data.SQLiteServer --version 0.1.2.1
Packet
paket add MyOddWeb.Data.SQLiteServer --version 0.1.2.1
Why?
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.)
Sample
Sample application
In the folder \console\
there is a sample application, start one or more instance of this app and you can run queries.
Application #1
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();
Application #2
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();
Performance
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
.
Past results
Todo
Performance
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.
A couple of common SQLite commands are missing.
0.1.2.1BackupDatabase
0.1.1.0IsDBNull( idx )
0.1.1.0HasRows
0.1.1.0FieldCount
0.1.1.0GetName( idx )
0.1.1.0GetTableName( idx )
A little less important, (but still need to be added)
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()
Other
- Namepipe might be faster, need to investigate more.
- Create Nuget package
- Some code cleanup
0.1.1.0Performance testing/report.
0.1.1.1SQLiteServerConnection
should implementDbConnection
SQLiteServerCommand
should implementDbCommand
- Need to implement
DbCommand CreateDbCommand(){}
when this is done
- Need to implement
SqliteServerDataReader
should implementDbDataReader
0.1.1.1SQLiteServerTransaction
should implementDbTransaction
Acknowledgement
- sqlite.org (duh!)
- System.Data.SQLite
If I forgot someone, please let me know and I will gladly add them here :)