protected ExecuteQuery ( IQuery context, Deveel.Data.Sql.SqlQuery query ) : IQueryResponse[] | ||
context | IQuery | |
query | Deveel.Data.Sql.SqlQuery | |
return | IQueryResponse[] |
protected virtual IQueryResponse[] ExecuteQuery(IQuery context, SqlQuery query)
{
// TODO: Log a debug message..
IQueryResponse[] response = null;
try {
// Execute the Query (behaviour for this comes from super).
response = CoreExecuteQuery(context, query.Text, query.Parameters, query.ParameterStyle);
// Return the result.
return response;
} finally {
// This always happens after tables are unlocked.
// Also guarenteed to happen even if something fails.
// If we are in auto-commit mode then commit the Query here.
// Do we auto-commit?
if (context.AutoCommit()) {
// If an error occured then roll-back
if (response == null) {
// Rollback.
context.Session.Rollback();
} else {
try {
// Otherwise commit.
context.Session.Commit();
} catch (Exception) {
foreach (IQueryResponse queryResponse in response) {
// Dispose this response if the commit failed.
DisposeResult(queryResponse.ResultId);
}
// And throw the SQL Exception
throw;
}
}
}
}
}
ServerConnector::ExecuteQuery ( long commitId, Deveel.Data.Sql.SqlQuery query ) : IQueryResponse[] |
private IMessageEnvelope ProcessQuery(IDictionary <string, object> metadata, QueryExecuteRequest request) { try { connector.AssertNotDisposed(); connector.AssertAuthenticated(); // TODO: use the timeout ... var queryResonse = connector.ExecuteQuery(request.CommitId, request.Query); return(connector.CreateEnvelope(metadata, new QueryExecuteResponse(queryResonse))); } catch (Exception ex) { // TODO: Log the error ... return(CreateErrorResponse(metadata, ex)); } }