Deveel.Data.Protocol.ServerConnector.ExecuteQuery C# (CSharp) Method

ExecuteQuery() protected method

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;
                        }
                    }
                }
            }
        }

Same methods

ServerConnector::ExecuteQuery ( long commitId, Deveel.Data.Sql.SqlQuery query ) : IQueryResponse[]

Usage Example

Beispiel #1
0
            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));
                }
            }
All Usage Examples Of Deveel.Data.Protocol.ServerConnector::ExecuteQuery