示例#1
0
        public static void ExecutaSql(SQLiteConnection conn, string sqlString, Func <IDictionary <string, object>, bool> action)
        {
            SQLitePCL.sqlite3_stmt stQuery = null;
            using (stQuery = SQLite3.Prepare2(conn.Handle, sqlString))
            {
                var colunas = stQuery.GetColunasSQLite();

                while (SQLite3.Step(stQuery) == SQLite3.Result.Row)
                {
                    var linha = ParseSQLiteLinha(stQuery, colunas);
                    if (!action(linha))
                    {
                        break;
                    }
                }
            }
        }
示例#2
0
        public static IList <IDictionary <string, object> > ExecutarSql(this SQLiteConnection connection, string sqlString)
        {
            var result = new List <IDictionary <string, object> >();

            SQLitePCL.sqlite3_stmt stQuery = null;

            using (connection)
            {
                using (stQuery = SQLite3.Prepare2(connection.Handle, sqlString))
                {
                    var colunas = stQuery.GetColunasSQLite();

                    while (SQLite3.Step(stQuery) == SQLite3.Result.Row)
                    {
                        var linha = stQuery.ParseSQLiteLinha(colunas);

                        result.Add(linha);
                    }
                }
            }

            return(result);
        }