Ejemplo n.º 1
0
        static void DoDatabaseCall(ParameterisedQuery query, string sql, bool createDB,
                                   DataTable results, ReaderCallback callback, params object[] args)
        {
            BindParams(query, args);
            string    connString = Backend.ConnectionString;
            Exception e          = null;

            for (int i = 0; i < 10; i++)
            {
                try {
                    if (callback != null)
                    {
                        query.ExecuteReader(sql, connString, callback);
                    }
                    else if (results == null)
                    {
                        query.Execute(sql, connString, createDB);
                    }
                    else
                    {
                        query.Fill(sql, connString, results);
                    }

                    query.ClearParams();
                    return;
                } catch (Exception ex) {
                    e = ex; // try yet again
                }
            }

            File.AppendAllText("MySQL_error.log", DateTime.Now + " " + sql + "\r\n");
            Server.ErrorLog(e);
        }
Ejemplo n.º 2
0
            public static void executeQuery(ParameterisedQuery query, string queryString, bool createDB = false)
            {
                Exception e = null;

                for (int i = 0; i < 10; i++)
                {
                    try {
                        query.Execute(queryString, createDB);
                        query.ClearParams();
                        return;
                    } catch (Exception ex) {
                        e = ex; // try yet again
                    }
                }

                File.AppendAllText("MySQL_error.log", DateTime.Now + " " + queryString + "\r\n");
                Server.ErrorLog(e);
                query.ClearParams();
            }