/// <summary> /// Executes a query on the database without returning a result. /// </summary> /// <param name="sql">The SQL string to execute.</param> /// <param name="data">Data associated with this query.</param> /// <returns>A <see cref="ThreadedQuery"/> object representing the query running in the background.</returns> public ThreadedQuery TFastQuery(string sql, object data = null) { var query = ThreadedQuery.FastQuery(sql, this, data); queries.Add(query); return(query); }
/// <summary> /// Initializes a new instance of the <see cref="ThreadedQuery"/> class. /// </summary> /// <param name="sql">The SQL string to execute.</param> /// <param name="database">The <see cref="Database"/> object creating this query.</param> /// <param name="data">The data associated with this query.</param> /// <returns>A new instance of the <see cref="ThreadedQuery"/> class.</returns> internal static ThreadedQuery Query(string sql, Database database, object data) { var query = new ThreadedQuery(database, data); new Thread(() => { lock (database) { query.status = Status.Running; try { query.results = database.RunQuery(sql); } catch (Exception e) { query.exception = e; } query.status = Status.Completed; } }).Start(); return(query); }