Overview of SqlDatabase.Net

Following provides quick overview of library.

  • The library is an embedded database, based on a single .dll file, no installation or configuration is required. Unicode UTF-8 is used for storage making it compatible with most character sets, including languages which are written Right to Left and Left to right, built-in functions use same technique through .Net System.Globalization class.
  • It is written in Microsoft .Net with support for mono to run it on Linux, MAC and Xamarin as Portable Class Library. Designed with minimal code to keep small memory foot print. It runs on .Net 3.5 Client Profile to .Net 4.6. Starting with Library version 2.5.0.0 Library is .Net Standard 2.0 compliant and works with all .NetStandard2_0 frameworks.
  • The library 2.0.1.0 and above support multi threaded access against single connection, multi-threading should be used using SqlDatabaseCommand object while using single same connection.
  • Configuration Commands are called System Commands and starts with SYSCMD < command >=< optional value >
  • Database is created as single schema per file with maximum 1024 tables in each schema, you can use ATTACH Database command to add up to 50 more files.
  • Encryption is only AES 256, other encryption methods can be used by using MemoryStream object. Portable Class Library as of version 2.0.0.0 does not support encryption.
  • SQL parsing is performed using lemon parser, only ANSI SQL 89 standards are supported, in most cases SQLite 3 and PostgreSQL 8 syntax should work.
  • In-Memory database uses MemoryStream class from .Net and are discarded as soon as connection is closed or detach statement is issued. Storing them permanently is possible either by creating a variable in your program and providing that MemoryStream object variable as reference (see examples) or taking backup to disk before detaching the @memory database .
  • .Net namespace is SQLDatabase.Net.SQLDatabaseClient and for portable class library SQLDatabase.Net.PCL.SQLDatabaseClient. Database physical file is extension free, e.g. SaleDatabase.db actually does not require .db extension it can be SalesDatabase, HRDatabase, TestDatabase etc.
  • Data integrity is provided through Journal file which is created at the same path as database file with -journal in the end of file. The path of directory can be changed to another physical location such as another hard drive to provide better I/O or to memory to improve performance. In-memory database journals are created inside memory.

Import and Using

After adding reference in Visual Studio you may need to add using or imports statement of .net, the complete nested namespace syntax would be as following:

C# :
using SQLDatabase.Net.SQLDatabaseClient; 
                
VB.NET :
Imports SQLDatabase.Net.SQLDatabaseClient

A reference to System.Data is also required.