Open
Description
Onur Gumus created an issue — 25th January 2012, 10:43:52:
Currently there is no way to cancel such a query like :
session.CreateSQLQuery("delete from sometable").ExecuteUpdate();
Calling CancelQuery from another thread will do nothing due to : ExecuteUpdate will eventually call :
public IDbCommand PrepareCommand(CommandType type, SqlString sql, SqlType[] parameterTypes) { this.OnPreparedCommand(); return this.Generate(type, sql, parameterTypes); }
method of the AbstractBatcher.
However a normal query will run through :
public IDbCommand PrepareQueryCommand(CommandType type, SqlString sql, SqlType[] parameterTypes) { IDbCommand result = this.Generate(type, sql, parameterTypes); this.lastQuery = result; return result; }
As you see this.lastQuery has been set. Thus it makes it cancellable via :
public void CancelLastQuery() { try { if (this.lastQuery != null) { this.lastQuery.Cancel(); } .... }