Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is SqliteDataReader in sqlite-net?

I'm trying to port an iOS application that uses native Sqlite3 and makes heavy use of SqliteDataReader. On the target platform I use SQLIte-Net (https://github.com/praeclarum/sqlite-net) and there the SqliteDataReader class does not exist. What are my best options to convert this? The usage of the reader is always code like this:

SqliteConnection oConn = AppDelegateBase.MasterDatabase.CreateDBMSConnection();
using ( SqliteCommand oCmd = new SqliteCommand ( "SELECT * FROM ATable"), oConn ) )
using ( var oReader = oCmd.ExecuteReader (  ) )
{
  while ( oReader.Read (  ) )
  {
    int val = Convert.ToInt32(oReader["someColumn"]);
  }
  oReader.Close ();
}
like image 489
Krumelur Avatar asked Aug 24 '12 15:08

Krumelur


2 Answers

There is no IDataReader/IDataRecord implementation in sqlite-net, because sqlite-net is not ADO adapter .net implementation.

You should check examples on GitHub page first. You should not use SQL language, like described here. If you need ADO imlementation, there are other SQLite libraries for C#, like System.Data.SQLite (official), sqlite-csharp and Mono.Data.Sqlite.

like image 155
Croll Avatar answered Sep 17 '22 15:09

Croll


Ive used the System.Data.SQLite ADO adapter successfully in a few projects. I believe it has an a SQLDataReader class. Im not sure if its that same implementation you are after however.

like image 20
tHand Avatar answered Sep 19 '22 15:09

tHand