Skip to content

Simple C# wrapper for SQLite 3. Only supports the essential API functions.

License

Notifications You must be signed in to change notification settings

UnexomWid/sqlite-sharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About .Net Framework 4.5

This is a very simple C# wrapper for SQLite 3. Only the essential API functions are supported (i.e. creating statements, binding parameters, executing statements).

Usage

Here's an example:

// Open the database
SQLite.DB db = new SQLite.DB("database.sqlite");

// Create the statement
SQLite.DB.Statement stmt = db.CreateStatement("SELECT * FROM dummy_table WHERE id = ?");

// Bind the value 4 to the first parameter
stmt.BindInt(1, 4);

// Execute the statement and receive an array of columns.
// You can execute a statement multiple times, and bind
// different values on the same parameter
SQLite.Column[] result = stmt.Exec();

if(result != null) {
    // If it's null, the query didn't return anything
    // Otherwise, there is at least one row
    
    for (int i = 0; i < result.Length; ++i)
    {
        // Column name
        string name = result[i].name;
        
        // Column type
        SQLite.Column.Type type = result[i].type;
        
        // Column values. Make sure to cast those to the correct type based on the column type:
        // INTEGER -> long
        // FLOAT   -> double
        // TEXT    -> string
        // BLOB    -> byte[]
        // NULL    -> 'values' is empty in this case, so no cast needed here
        List<object> values = result[i].values;
        
        // Every column will have the same number of values,
        // which is also the number of rows.
    }
}

License License: MIT

This wrapper was created by UnexomWid. It is licensed under the MIT license.

About

Simple C# wrapper for SQLite 3. Only supports the essential API functions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages