public virtual Message Query(QueryXmlRequest query) { _log.DebugFormat("Query: {0}", query.query); if (_log.IsDebugEnabled && query.parameters.Count > 0) { _log.Debug("Parameters: "); foreach (var parameter in query.parameters) { _log.DebugFormat("\t{0}={1}", parameter.Key, parameter.Value); } } var stopwatch = new Stopwatch(); try { if (_infoService == null) { Open(); } stopwatch.Start(); return(_infoService.Query(query)); } catch (FaultException <InfoServiceFaultContract> ex) { _log.Error("Error executing query: " + ex.Detail.Message + Environment.NewLine + query.query); throw; } catch (Exception ex) { _log.ErrorFormat("Error executing query: {0} {1} {2}", ex, Environment.NewLine, query.query); foreach (var parameter in query.parameters) { _log.ErrorFormat("\t{0}={1}", parameter.Key, parameter.Value); } throw; } finally { stopwatch.Stop(); if (stopwatch.Elapsed > longRunningQueryTime) { _log.WarnFormat("Support! -- LONG RUNNING QUERY: {0} ms: {1}", stopwatch.Elapsed.TotalMilliseconds, query.query); } } }
public XmlReader Execute(bool hierarchical) { string returnClause = hierarchical ? " RETURN XML AUTO" : " RETURN XML RAW"; QueryXmlRequest request = new QueryXmlRequest(queryString + returnClause, parameters); Message response = context.Service.Query(request); log.Debug(response); if (response.IsFault) { CreateFaultException(response); } XmlDictionaryReader reader = response.GetReaderAtBodyContents(); return(reader); }
public XmlReader Execute(bool hierarchical) { string returnClause = hierarchical ? " RETURN XML AUTO" : " RETURN XML RAW"; QueryXmlRequest request = new QueryXmlRequest(this.queryString + returnClause, parameters); Message response = this.context.Service.Query(request); log.Debug(response); if (response.IsFault) { CreateFaultException(response); } XmlDictionaryReader reader = response.GetReaderAtBodyContents(); return reader; }
public XmlDictionaryReader GetXmlData(string statement, PropertyBag parameters) { QueryXmlRequest queryRequest = new QueryXmlRequest(statement, parameters); Message message = null; using (new SwisSettingsContext {DataProviderTimeout = TimeSpan.FromSeconds(commandTimeout), ApplicationTag = ApplicationTag}) { message = this.connection.Service.Query(queryRequest); } if (message != null) { if (message.IsFault) CreateFaultException(message); return message.GetReaderAtBodyContents(); } return null; }
public new InformationServiceDataReader ExecuteReader(CommandBehavior behavior) { //TODO: Check if the statement contains a RETURN clause string query = statement + " RETURN XML RAW"; var bag = new PropertyBag(); foreach (InformationServiceParameter parameter in parameters) bag.Add(parameter.ParameterName, parameter.Value); QueryXmlRequest queryRequest = new QueryXmlRequest(query, bag); Message message = null; using (new SwisSettingsContext { DataProviderTimeout = TimeSpan.FromSeconds(commandTimeout), ApplicationTag = ApplicationTag, AppendErrors = true}) { message = this.connection.Service.Query(queryRequest); } if (message != null) { if (message.IsFault) CreateFaultException(message); return new InformationServiceDataReader(this, message.GetReaderAtBodyContents()); } return null; }
public virtual Message Query(QueryXmlRequest query) { _log.DebugFormat("Query: {0}", query.query); if (_log.IsDebugEnabled && query.parameters.Count > 0) { _log.Debug("Parameters: "); foreach (var parameter in query.parameters) _log.DebugFormat("\t{0}={1}", parameter.Key, parameter.Value); } var stopwatch = new Stopwatch(); try { if (_infoService == null) { Open(); } stopwatch.Start(); return _infoService.Query(query); } catch (FaultException<InfoServiceFaultContract> ex) { _log.Error("Error executing query: " + ex.Detail.Message + Environment.NewLine + query.query); throw; } catch (Exception ex) { _log.ErrorFormat("Error executing query: {0} {1} {2}", ex, Environment.NewLine, query.query); foreach (var parameter in query.parameters) _log.ErrorFormat("\t{0}={1}", parameter.Key, parameter.Value); throw; } finally { stopwatch.Stop(); if (stopwatch.Elapsed > longRunningQueryTime) { _log.WarnFormat("Support! -- LONG RUNNING QUERY: {0} ms: {1}", stopwatch.Elapsed.TotalMilliseconds, query.query); } } }