Ejemplo n.º 1
0
        public static int Set(this IDBIO dbio, IEnumerable <string> queries, bool throwOnException = true)
        {
            return(dbio.Set(cmd =>
            {
                Result <int> queryExecutionResult;
                int affectedRows;

                affectedRows = 0;

                foreach (string query in queries.notEmpty())
                {
                    cmd.CommandText = query;
                    queryExecutionResult = new Result <int>(cmd.ExecuteNonQuery);

                    if (queryExecutionResult.Ok)
                    {
                        affectedRows += queryExecutionResult.Value;
                    }
                    else if (throwOnException)
                    {
                        throw queryExecutionResult.Exception;
                    }
                }

                return affectedRows;
            }));
        }
Ejemplo n.º 2
0
 public static void Set(this IDBIO dbio, Action <IDbCommand> instructions)
 {
     dbio.Set(cmd =>
     {
         instructions(cmd);
         return(0);
     });
 }
Ejemplo n.º 3
0
        private static int prv_set(IDBIO dbio, string query, IEnumerable <KeyValuePair <string, object> > parameters)
        {
            return(dbio.Set(cmd =>
            {
                cmd.CommandText = query;
                cmd.addParameters(parameters);

                return cmd.ExecuteNonQuery();
            }));
        }
Ejemplo n.º 4
0
 public static int execute(this IDBQuery query, IDBIO db)
 {
     return(db.Set(query));
 }
Ejemplo n.º 5
0
 private void DropTableCliente(IDBIO db)
 {
     db.Set($@"DROP TABLE cliente");
 }