public static void ExecuteNonQuery(string dbName, string sql) { sqlite3 connection = SQLitePCLRawHelpers.GetSqliteConnection(dbName); sqlite3_stmt statement = SQLitePCLRawHelpers.GetSqliteStatement(sql, connection); using (connection) { using (statement) { int rc = raw.sqlite3_step(statement); SQLitePCLRawHelpers.VerifySQLiteResponse(rc, raw.SQLITE_DONE, connection); } } }
public static long CountRows(string dbName, string tableName) { long count = 0; string sql = "SELECT COUNT(1) from " + tableName; sqlite3 connection = SQLitePCLRawHelpers.GetSqliteConnection(dbName); sqlite3_stmt statement = SQLitePCLRawHelpers.GetSqliteStatement(sql, connection); using (connection) { using (statement) { int rc = raw.sqlite3_step(statement); SQLitePCLRawHelpers.VerifySQLiteResponse(rc, raw.SQLITE_ROW, connection); count = (long)raw.sqlite3_column_int64(statement, 0); } } return(count); }