public Statement Execute() { resetIfExecuted(); bool hasRow = Sqlite3.Step(db, pStmt); Rows = (hasRow)? EnumerableRows(): EmptyRows; executed = true; return(this); }
public void CreateDb() { IntPtr stmt; IntPtr db = Sqlite3.Open(dbname); stmt = Sqlite3.Prepare(db, "create table test (id integer primary key, value string)"); Sqlite3.Step(db, stmt); stmt = Sqlite3.Prepare(db, "insert into test values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f')"); Sqlite3.Step(db, stmt); Sqlite3.Close(db); }
private IEnumerable <DataRow> EnumerableRows() { var cnames = Sqlite3.ColumnNames(pStmt); int cc = cnames.Count; do { var row = new DataRow(); for (var i = 0; i < cc; ++i) { row[cnames[i]] = Sqlite3.Column(pStmt, i); } yield return(row); }while(Sqlite3.Step(db, pStmt)); }