Documentation and examples

Sep 5, 2014 at 3:35 PM
I'm really keen on using this tool, however I did not found any kind of documentation or examples on how to use the tool.
Is there any type of info on this matter? Can anyone highlight the most common usages?

Thank you.
Sep 5, 2014 at 6:17 PM
Hi @ricochete,

The API provided with this package mimics the C/C++ interface from , you can always check the mentioned website for reference. Our documentation section is currently focused on installation, but I believe we could add some usage reference and examples.

In the meantime, in order to execute a statement, you first create a new SQLiteConnection instance, passing the db file path. Then, you can prepare an ISQLiteStatement by calling Prepare on the ISQLiteConnection instance, passing a string containing the SQL statement. Once prepared, you would call Step() on it. If its a non-query statement, and everything is fine, it should return SQLiteResult.DONE status; if it's a query statement, you should get a SQLiteResult.ROW status, and be able to read the results from the statement ([] operator), then you can keep calling step to read the following rows, until you no longer get SQLiteResult.ROW status.

When you create a new SQLiteConnection, if the db file doesn't exist, it creates it. If it's a relative path (just the filename), it picks an appropriate directory depending on the platform (CurrentDirectory in Net45, ApplicationData.Current.LocalFolder.Path in Universal apps).

If you download the source code for this package, you'll find plenty examples of use in the test projects.
using (var connection = new SQLiteConnection("sample.db"))
    using (var statement = connection.Prepare("SELECT id, description FROM table;"))
        while (statement.Step() == SQLiteResult.ROW)
            var id = (long)statement["id"];
            var description = (string)statement["description"];

            // DO SOME STUFF
You can reuse the same connection instance for subsequent statements.

Marked as answer by ricochete on 9/5/2014 at 10:26 AM
Sep 5, 2014 at 6:26 PM
Thank you for your answer leotilli! :)