Cannot figure out how to actually execute query

Jul 7, 2014 at 7:56 PM
You need documentation and/or comments in your code or developers will end up using other projects.

I've been digging through the code base and cannot find anything related to execute, run, or even query.

Here is where I've gotten.
SQLiteConnection connection = new SQLiteConnection ("errr.db");
SQLiteStatement statement = connection.Prepare ("Select * from ok");
It would be nice to execute that statement, even though I am expecting it to fail because the database doesn't exist and it is undocumented if opening a connection will create the database if it doesn't exist. If it does create a database, it should still fail because I am unable to figure out how to insert records, so that ok table doesn't exist anyways.
Developer
Jul 18, 2014 at 1:43 PM
Hi @gnomaditr0n,

The API provided with this package mimics the C/C++ interface from sqlite.org.

In order to execute a 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.

Regards
Marked as answer by leotilli on 9/5/2014 at 11:27 AM