GithubHelp home page GithubHelp logo

faithlife / system.data.sqlite Goto Github PK

View Code? Open in Web Editor NEW
45.0 37.0 18.0 6.34 MB

A lightweight ADO.NET wrapper around SQLite

License: MIT License

C# 99.86% Batchfile 0.05% Shell 0.09%
hacktoberfest ado-net sqlite

system.data.sqlite's Introduction

Inactive Project

Project Status: Inactive โ€“ The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

This project is inactive. We recommend using one of the following supported alternatives:

(Note to Faithlife developers: This package should continue to be used in Faithlife applications; the above notice is for external developers who find this project.)

A lightweight cross-platform replacement for System.Data.SQLite

This is an independent implementation of the core of ADO.NET: IDbConnection, IDbCommand, IDbDataReader, IDbTransaction (plus a few helpers) โ€” enough types to let you create and query SQLite databases from managed code, including support for libraries such as Dapper.

It supports the following platforms: .NET Framework 4.7.2., .NET Standard 2.0, Xamarin.iOS, MonoAndroid.

Build Status

Build status NuGet

Why?

  1. Lightweight
  • Only the core of ADO.NET is implemented, not EF or Designer types.
  • The official System.Data.SQLite is over 300KB; this library is under 50KB.
  1. High performance
  • This library assumes that the caller will use IDisposable properly, so it avoids adding finalizers to clean up incorrect usage.
  • No static constructors (e.g., SQLiteFunction) that reflect over all loaded assemblies.
  1. Cross-platform support
  • Works on desktop and mobile devices
  1. Tested
  • This implementation has been shipping in Logos 6 and installed on tens of thousands of client machines. The developers track and fix crashes reported via Raygun.

Enhancements

Compatibility

This library is generally compatible with the official System.Data.SQLite API, but a few changes were made where necessary:

This wrapper is managed-only; you still need a copy of the native SQLite library. A recent copy is provided in the lib folder (for the unit tests).

Async

This library implements all the *Async methods of DbCommand, etc. However, because SQLite itself performs synchronous I/O (and it would be extremely difficult to make it truly async), they don't actually have an async implementation, but will run synchronously. (Using Task.Run in the implementation is a bad idea; see also here and here.) If you need to perform database work off the UI thread, use Task.Run in the UI code to execute a series of SQLite calls on a background thread.

The *Async methods do support cancellation, though. If you pass in a CancellationToken, the methods will still run synchronously, but you can interrupt them (even if they're in a long-running loop in SQLite's native code) by cancelling the cancellation token from another thread. (For example, you can cancel DB work that's happening on a threadpool thread when a user clicks a "Cancel" button in the UI.)

system.data.sqlite's People

Contributors

bgrainger avatar davidschwegler avatar ddunkin avatar ejball avatar logosnickericson avatar martinpotter avatar stephencleary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

system.data.sqlite's Issues

datareader not parsing results correctly

Data reader does not parse it's results correctly. I can't imagein when I look in the DB I see an INTEGER value of 44083 that suddenly becomes 1331057912 in .NET when read using Getvalue or GetInt32.

The same goes for float and all other numeric data types. If you can't get your shit straight, get the hell out of IT. I can't imagine I'm the only one on the planet that has seen this error.

Update sqlite3.dll

Currently, the version 3.25.3 is used here.
The current version of SQLite is at this time 3.33.0 (source).
The underlying library should be updated (download page).

.HasRows has to be called after .Read()

In other libraries you can call SQLiteDataReader.HasRows before calling SQLiteDataReader.Read()

It does not have many sense for .HasRows requiring .Read() to be called first, because Read() returns true if there are rows in the query result, therefore you don't need to call .HasRows at all.

Fix Android tests

Apparently Android apps can't access the system-installed sqlite, so the Android tests currently fail.

Test Dapper

The DAPPER preprocessor directive guards some code that tested Dapper, but we aren't currently running those tests.

Fix build script

We could not get the psake build script to work on the machine that had Xamarin installed. For expediency, I deployed directly from the Visual Studio build.

We should switch to Cake and make it possible to deploy from the automated build.

Xamarin.Forms sample

Could you please provide a sample with password feature and detailed document on how to integrate this library with Xamarin.Forms app ? We'd like to integrate this in our Xamarin app.

Fix documentation

Some of the documentation has become inaccurate, e.g. supported platforms.

Support URI filenames

Near as I can tell, we don't currently support URI filenames. I think it would be as simple as setting an openFlags bit (SQLITE_OPEN_URI 0x00000040).

I was hoping to leverage "shared cache" in-memory databases so we could open multiple connections to the same in-memory database. (I'm not sure yet if that would require another change to this library.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.