public override string GetLoginUrl(string returnUrl) { var oauthParameters = new QueryParameters(); string processedUrl = ""; if(string.IsNullOrEmpty(provider.UserLoginEndpoint)) PerformDiscovery(); oauthParameters.Add("openid.ns", "http://specs.openid.net/auth/2.0"); oauthParameters.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select"); oauthParameters.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select"); oauthParameters.Add("openid.return_to", returnUrl); oauthParameters.Add("openid.realm", ConnectionToken.Domain); oauthParameters.Add("openid.mode", "checkid_setup"); oauthParameters.Add("openid.ns.pape", "http://specs.openid.net/extensions/pape/1.0"); oauthParameters.Add("openid.ns.max_auth_age", "0"); oauthParameters.Add("openid.ns.ax", "http://openid.net/srv/ax/1.0"); oauthParameters.Add("openid.ax.mode", "fetch_request"); oauthParameters.Add("openid.ax.type.country", "http://axschema.org/contact/country/home"); oauthParameters.Add("openid.ax.type.email", "http://axschema.org/contact/email"); oauthParameters.Add("openid.ax.type.firstname", "http://axschema.org/namePerson/first"); oauthParameters.Add("openid.ax.type.language", "http://axschema.org/pref/language"); oauthParameters.Add("openid.ax.type.lastname", "http://axschema.org/namePerson/last"); oauthParameters.Add("openid.ax.required", "country,email,firstname,language,lastname"); //ADDING OAUTH PROTOCOLS oauthParameters.Add("openid.ns.oauth", "http://specs.openid.net/extensions/oauth/1.0"); oauthParameters.Add("openid.oauth.consumer", provider.Consumerkey); BeforeDirectingUserToServiceProvider(oauthParameters); processedUrl = oauthParameters.ToEncodedString(); return provider.UserLoginEndpoint + "?" + processedUrl; }
public void DirectUserToServiceProvider() { UriBuilder ub = new UriBuilder(provider.UserLoginEndpoint); try { QueryParameters oauthParams = new QueryParameters(); oauthParams.Add("client_id", provider.Consumerkey); oauthParams.Add("redirect_uri", connectionToken.ProviderCallbackUrl); oauthParams.Add("response_type", "code"); oauthParams.Add("scope", provider.GetScope()); //ub.SetQueryparameter("client_id", provider.Consumerkey); //ub.SetQueryparameter("redirect_uri", connectionToken.ProviderCallbackUrl); //ub.SetQueryparameter("response_type", "code"); //ub.SetQueryparameter("scope", provider.GetScope()); BeforeDirectingUserToServiceProvider(oauthParams); logger.Debug("Redirecting user for login to " + ub.ToString() + "?" + oauthParams.ToEncodedString()); SocialAuthUser.Redirect(ub.ToString() + "?" + oauthParams.ToEncodedString()); } catch (Exception ex) { logger.Error(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex); throw new OAuthException(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex); } }
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure) public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session) { CoordinateSharedCacheCleanup(session); if (queryParameters.Callable) { throw new ArgumentException("callable not yet supported for native queries"); } RowSelection selection = queryParameters.RowSelection; int result; try { var parametersSpecifications = customQuery.CollectedParametersSpecifications.ToList(); SqlString sql = ExpandDynamicFilterParameters(customQuery.SQL, parametersSpecifications, session); // After the last modification to the SqlString we can collect all parameters types. parametersSpecifications.ResetEffectiveExpectedType(queryParameters); var sqlParametersList = sql.GetParameters().ToList(); SqlType[] sqlTypes = parametersSpecifications.GetQueryParameterTypes(sqlParametersList, session.Factory); IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes); try { if (selection != null && selection.Timeout != RowSelection.NoValue) { // NH Difference : set Timeout for native query ps.CommandTimeout = selection.Timeout; } foreach (IParameterSpecification parameterSpecification in parametersSpecifications) { parameterSpecification.Bind(ps, sqlParametersList, queryParameters, session); } result = session.Batcher.ExecuteNonQuery(ps); } finally { if (ps != null) { session.Batcher.CloseCommand(ps, null); } } } catch (HibernateException) { throw; } catch (Exception sqle) { throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle, "could not execute native bulk manipulation query:" + sourceQuery); } return result; }
public void AddQueryNameAlreadyExistsTest() { var parameters = new QueryParameters { Name = "Test" }; parameters.Fields.Add(new QueryField { Value = 6606 }); _model.AddQuery(parameters); _model.AddQuery(parameters); }
public QueryDialog() { InitializeComponent(); SetupDataGridViewColumns(); dataGridView1.CellValueChanged += dataGridView1_CellValueChanged; Query = new QueryParameters(); }
public void TestAlreadyQuotedSimpleQuery() { var query = new QueryParameters<Artist>(); query.Add("artist", "\"rolling stones\""); Assert.AreEqual("artist:\"rolling stones\"", query.ToString()); }
public void TestInlineSimpleQuery() { var query = new QueryParameters<Artist>(); query.Add("artist", "\"rolling stones\" OR jagger"); Assert.AreEqual("artist:(\"rolling stones\" OR jagger)", query.ToString()); }
public static string AccessTokenRequestError(string url, QueryParameters collection) { string message = "An error occurred while requesting Access Token at " + url; if (collection != null) if (collection.Count > 0) message += Environment.NewLine + "with parameters " + collection.ToString(); return message; }
public void TestNegateSimpleQuery() { var query = new QueryParameters<Artist>(); query.Add("arid", "1", true); Assert.AreEqual("NOT arid:1", query.ToString()); }
public void HistoryPresenterModel_AddQuery_NameAlreadyExists_Test() { var parameters = new QueryParameters { Name = "Test" }; parameters.Fields.Add(new QueryField { Value = 6606 }); _model.AddQuery(parameters); Assert.Throws<ArgumentException>(() => _model.AddQuery(parameters)); }
//Called After Directing User public override void LoginCallback(QueryParameters responseCollection, Action<bool, Token> AuthenticationCompletionHandler) { HandleAuthorizationCode(responseCollection); //(C) RequestForAccessToken(AccessTokenRequestType); // (D) //HandleAccessTokenResponse(response); //(E) Handled from above logger.Info("OAuth2.0 server side Authorization flow ends .."); //Authentication Process is through. Inform Consumer. AuthenticationCompletionHandler(isSuccess, ConnectionToken); // Authentication process complete. Call final method }
public void TestNegateMultiQuery() { var query = new QueryParameters<Artist>(); query.Add("artist", "stones"); query.Add("tag", "rock", true); Assert.AreEqual("artist:stones AND NOT tag:rock", query.ToString()); }
public void TestInlineMultiQuery() { var query = new QueryParameters<Artist>(); query.Add("artist", "\"rolling stones\" OR jagger"); query.Add("tag", "rock", true); Assert.AreEqual("artist:(\"rolling stones\" OR jagger) AND NOT tag:rock", query.ToString()); }
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure) public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session) { CoordinateSharedCacheCleanup(session); if (queryParameters.Callable) { throw new ArgumentException("callable not yet supported for native queries"); } RowSelection selection = queryParameters.RowSelection; int result; try { queryParameters.ProcessFilters(customQuery.SQL, session); SqlString sql = queryParameters.FilteredSQL; SqlType[] sqlTypes = queryParameters.PrepareParameterTypes(sql, session.Factory, GetNamedParameterLocs, 0, false, false); IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes); try { if (selection != null && selection.Timeout != RowSelection.NoValue) { // NH Difference : set Timeout for native query ps.CommandTimeout = selection.Timeout; } // NH Different behavior: // The inital value is 0 (initialized to 1 in JAVA) // The responsibility of parameter binding was entirely moved to QueryParameters // to deal with positionslParameter+NamedParameter+ParameterOfFilters queryParameters.BindParameters(ps, 0, session); result = session.Batcher.ExecuteNonQuery(ps); } finally { if (ps != null) { session.Batcher.CloseCommand(ps, null); } } } catch (HibernateException) { throw; } catch (Exception sqle) { throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle, "could not execute native bulk manipulation query:" + sourceQuery); } return result; }
public void HistoryPresenterModel_AddQuery_Test() { // Arrange var parameters = new QueryParameters { Name = "Test" }; parameters.Fields.Add(new QueryField { Value = 6606 }); // Act Assert.AreEqual(1, _model.QueryBindingSource.Count); _model.AddQuery(parameters); // Assert Assert.AreEqual(2, _model.QueryBindingSource.Count); }
public override string GetLoginUrl(string returnUrl) { if(string.IsNullOrEmpty(ConnectionToken.RequestToken)) RequestForRequestToken(); var oauthParameters = new QueryParameters { new QueryParameter("oauth_token", ConnectionToken.RequestToken) }; BeforeDirectingUserToServiceProvider(oauthParameters); return provider.UserLoginEndpoint + "?" + oauthParameters.ToString(); }
public object GetData(ControllerContext context, QueryParameters parameters) { var repositoryName = context.GetControllerName() + "repository"; var repository = Locator.GetAllInstances(typeof(IDynamicRepository)).FirstOrDefault( o => o.GetType().Name.ToLowerInvariant() == repositoryName); if (repository == null) { throw new Exception(string.Format("Could not locate a repository named '{0}'", repositoryName)); } return repository.GetType().GetMethod("All").Invoke(repository, null); }
/// <summary> /// Bind positional parameter values to the <tt>PreparedStatement</tt> /// (these are parameters specified by a JDBC-style ?). /// </summary> private int BindPositionalParameters(IDbCommand st, QueryParameters queryParameters, int start, ISessionImplementor session) { object[] values = queryParameters.FilteredPositionalParameterValues; IType[] types = queryParameters.FilteredPositionalParameterTypes; int span = 0; for (int i = 0; i < values.Length; i++) { types[i].NullSafeSet(st, values[i], start + span, session); span += types[i].GetColumnSpan(session.Factory); } return span; }
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure) public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session) { CoordinateSharedCacheCleanup(session); if (queryParameters.Callable) { throw new ArgumentException("callable not yet supported for native queries"); } RowSelection selection = queryParameters.RowSelection; int result; try { queryParameters.ProcessFilters(customQuery.SQL, session); SqlString sql = queryParameters.FilteredSQL; SqlType[] sqlTypes = GetParameterTypes(queryParameters, session); IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes); try { if (selection != null && selection.Timeout != RowSelection.NoValue) { // NH Difference : set Timeout for native query ps.CommandTimeout = selection.Timeout; } int col = 0; // NH Different (initialized to 1 in JAVA) col += BindPositionalParameters(ps, queryParameters, col, session); BindNamedParameters(ps, queryParameters.NamedParameters, col, session); result = session.Batcher.ExecuteNonQuery(ps); } finally { if (ps != null) { session.Batcher.CloseCommand(ps, null); } } } catch (HibernateException) { throw; } catch (Exception sqle) { throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle, "could not execute native bulk manipulation query:" + sourceQuery); } return result; }
public override string GetLoginUrl(string returnUrl) { var ub = new UriBuilder(provider.UserLoginEndpoint); var oauthParams = new QueryParameters(); oauthParams.Add("client_id", provider.Consumerkey); oauthParams.Add("redirect_uri", returnUrl); oauthParams.Add("response_type", "code"); oauthParams.Add("scope", provider.GetScope()); BeforeDirectingUserToServiceProvider(oauthParams); return ub.ToString() + "?" + oauthParams.ToEncodedString(); }
public override void LoginCallback(QueryParameters responseCollection, Action<bool> AuthenticationCompletionHandler) { logger.Info("User returns from provider"); HandleUserReturnCallback(responseCollection); //(D) RequestForAccessToken(); //(E) //HandleAccessTokenResponse(); //(F) Called from within above logger.Info("OAuth1.0a Authorization Flow ends..."); //Authentication Process is through. Inform Consumer. [Set isSuccess on successful authentication] AuthenticationCompletionHandler(isSuccess); // Authentication process complete. Call final method }
private static List<QueryParameters> CreateTestList() { var list = new List<QueryParameters>(); for (int i = 0; i < 5; i++) { var queryParameters = new QueryParameters(); queryParameters.Name = "Test" + i; queryParameters.Fields.Add(new QueryField { Name = QueryFieldName.Name, Type = QueryFieldType.Equal, Value = "Test" + i }); list.Add(queryParameters); } return list; }
public override void LoginCallback(QueryParameters responseCollection, Action<bool> AuthenticationCompletionHandler) { HandleRequestToken(responseCollection); // (D) if (!string.IsNullOrEmpty(provider.GetScope()) || provider.IsScopeDefinedAtProvider) { RequestForAccessToken(); // (E) //HandleAccessTokenResponse(response)// (F) Handled from within above } else isSuccess = true; logger.Info("OAuth1_0Hybrid Authorization ends.."); //Authentication Process is through. Inform Consumer. AuthenticationCompletionHandler(isSuccess); // Authentication process complete. Call final method }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { ParameterSet = new QueryParameters(ViewState); } else if (PreviousPage == null) { ParameterSet = new QueryParameters(); } else { ParameterSet = (PreviousPage as IQueryParameters).ParameterSet; } }
public void DeepCopyTest() { var param = new QueryParameters(); param.Name = "Test"; param.Fields.Add(new QueryField { Name = QueryFieldName.Name, Type = QueryFieldType.Equal, Value = "Test Instance" }); param.Fields.Add(new QueryField { Name = QueryFieldName.DownloadDateTime, Type = QueryFieldType.GreaterThan, Value = new DateTime(2000, 1, 1) }); var copy = param.DeepClone(); Assert.AreNotSame(param, copy); Assert.AreEqual(param.Name, copy.Name); for (int i = 0; i < param.Fields.Count; i++) { Assert.AreEqual(param.Fields[i].Name, copy.Fields[i].Name); Assert.AreEqual(param.Fields[i].Type, copy.Fields[i].Type); Assert.AreEqual(param.Fields[i].Value, copy.Fields[i].Value); } }
private async void OnLoadedPopulateData(object sender, Esri.ArcGISRuntime.LoadStatusEventArgs e) { // If layer isn't loaded, do nothing if (e.Status != Esri.ArcGISRuntime.LoadStatus.Loaded) return; // Create new query object that contains parameters to query specific request types QueryParameters queryParameters = new QueryParameters() { WhereClause = "req_Type = 'Tree Maintenance or Damage'" }; // Create list of the fields that are returned from the service var outputFields = new string[] { "*" }; // Populate feature table with the data based on query await _incidentsFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); }
/// <summary> /// Get Banner /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="email">Email</param> /// <param name="merchantUuid">merchantUuid</param> /// <returns>Banner Object</returns> public Banner GetBanner(APIContext apiContext, string email, string merchantUuid = "") { // Set Up default value merchantUuid = merchantUuid.Length == 0 ? apiContext.GetMerchantUuid() : merchantUuid; // Validate ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(email, "email"); ArgumentValidator.Validate(merchantUuid, "merchantUuid"); var queryParameters = new QueryParameters(); queryParameters["email"] = email; // Configure and send the request var pattern = "v2/banner/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { merchantUuid }) + queryParameters.ToUrlFormattedString(); return ExpresslyClient.ConfigureAndExecute<Banner>(apiContext, ExpresslyClient.HttpMethod.GET, resourcePath); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { ParameterSet = new QueryParameters(ViewState); } else if (PreviousPage == null) { ParameterSet = new QueryParameters(); } else { ParameterSet = (PreviousPage as IQueryParameters).ParameterSet; } SetDefaultParameters(); //Label1.Text += ParameterSet.ToString(); ConstructSelectStatement(); }
private async void GetFeaturesFromQuery() { // Create a service feature table to get features from ServiceFeatureTable featTable = new ServiceFeatureTable(new Uri(FeatureLayerUrl)); // Create a query to get all features in the table QueryParameters queryParams = new QueryParameters(); queryParams.WhereClause = "1=1"; // Query the table to get all features FeatureQueryResult featureResult = await featTable.QueryFeaturesAsync(queryParams); // Create a new feature collection table from the result features FeatureCollectionTable collectTable = new FeatureCollectionTable(featureResult); // Create a feature collection and add the table FeatureCollection featCollection = new FeatureCollection(); featCollection.Tables.Add(collectTable); // Create a layer to display the feature collection, add it to the map's operational layers FeatureCollectionLayer featCollectionTable = new FeatureCollectionLayer(featCollection); MyMapView.Map.OperationalLayers.Add(featCollectionTable); }
public PagedList <Post> GetPosts(QueryParameters parameters) { return(PagedList <Post> .ToPagedList(_context.Posts.OrderByDescending(p => p.Date), parameters.PageNumber, parameters.PageSize)); }
public override async Task BindAsync(DbCommand command, IList <Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList <Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); IType type = ExpectedType; object value = queryParameters.PositionalParameterValues[hqlPosition]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence // an HQL positional parameter can appear more than once because a custom HQL-Function can duplicate it foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { await(type.NullSafeSetAsync(command, GetPagingValue(value, session.Factory.Dialect, queryParameters), position + singleSqlParametersOffset, session, cancellationToken)).ConfigureAwait(false); } }
public async Task <IList> ListAsync(ISessionImplementor session, QueryParameters queryParameters, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); // Delegate to the QueryLoader... ErrorIfDML(); var query = ( QueryNode )_sqlAst; bool hasLimit = queryParameters.RowSelection != null && queryParameters.RowSelection.DefinesLimits; bool needsDistincting = (query.GetSelectClause().IsDistinct || hasLimit) && ContainsCollectionFetches; QueryParameters queryParametersToUse; if (hasLimit && ContainsCollectionFetches) { log.Warn("firstResult/maxResults specified with collection fetch; applying in memory!"); var selection = new RowSelection { FetchSize = queryParameters.RowSelection.FetchSize, Timeout = queryParameters.RowSelection.Timeout }; queryParametersToUse = queryParameters.CreateCopyUsing(selection); } else { queryParametersToUse = queryParameters; } IList results = await(_queryLoader.ListAsync(session, queryParametersToUse, cancellationToken)).ConfigureAwait(false); if (needsDistincting) { int includedCount = -1; // NOTE : firstRow is zero-based int first = !hasLimit || queryParameters.RowSelection.FirstRow == RowSelection.NoValue ? 0 : queryParameters.RowSelection.FirstRow; int max = !hasLimit || queryParameters.RowSelection.MaxRows == RowSelection.NoValue ? -1 : queryParameters.RowSelection.MaxRows; int size = results.Count; var tmp = new List <object>(); var distinction = new IdentitySet(); for (int i = 0; i < size; i++) { object result = results[i]; if (!distinction.Add(result)) { continue; } includedCount++; if (includedCount < first) { continue; } tmp.Add(result); // NOTE : ( max - 1 ) because first is zero-based while max is not... if (max >= 0 && (includedCount - first) >= (max - 1)) { break; } } results = tmp; } return(results); }
/// <summary> /// List all groups. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.ApiManagement.IGroupsOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group. /// </param> /// <param name='serviceName'> /// Required. The name of the Api Management service. /// </param> /// <param name='query'> /// Optional. /// </param> /// <returns> /// List Groups operation response details. /// </returns> public static Task <GroupListResponse> ListAsync(this IGroupsOperations operations, string resourceGroupName, string serviceName, QueryParameters query) { return(operations.ListAsync(resourceGroupName, serviceName, query, CancellationToken.None)); }
public override Task <IEnumerable <T> > EnumerableFilterAsync <T>(object collection, string filter, QueryParameters parameters, CancellationToken cancellationToken) { throw new NotSupportedException(); }
public abstract void List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results);
public override IEnumerable <T> Enumerable <T>(string query, QueryParameters queryParameters) { throw new NotSupportedException(); }
/// <summary> /// Runs the report. /// </summary> /// <param name="reportId">The report identifier.</param> /// <param name="dateFrom">The date from.</param> /// <param name="dateTo">The date to.</param> /// <returns></returns> /// <exception cref="System.NotImplementedException"></exception> public void RunReport(int reportId, DateTime dateFrom, DateTime dateTo, int cd4CutOff = 350) { //throw new NotImplementedException(); this.queryParameters = new QueryParameters() { DateFrom = dateFrom, DateTo = dateTo, CD4Cutoff = cd4CutOff }; this.GetReportbyID(reportId); report.PeriodFrom = dateFrom; report.PeriodTo = dateTo; SetReportParameters(dateFrom, dateTo); QueryCollection qCollection = this.reportIQTools.GetReportQueries(reportId); this.InitialiseReportDocument(); XmlElement rootElement = this.reportXML.DocumentElement; XmlNode reportNode = this.reportXML.CreateNode(XmlNodeType.Element, "Report", string.Empty); reportNode.InnerXml = new XElement("reportid", report.ReportID).ToString() + new XElement("reportname", report.ReportName).ToString() + new XElement("reportfrom", report.PeriodFrom.Value.ToString("o")).ToString() + new XElement("reportto", report.PeriodTo.Value.ToString("o")).ToString(); rootElement.AppendChild(reportNode); //report.PeriodTo = dateTo }; XmlNode mainNode = reportXML.CreateNode(XmlNodeType.Element, "Data", string.Empty); foreach (string key in qCollection) { XmlNode resultNode = reportXML.CreateNode(XmlNodeType.Element, "Results", string.Empty); Query query = qCollection[key]; XmlAttribute att1 = reportXML.CreateAttribute("QUERY_NAME"); XmlAttribute att2 = reportXML.CreateAttribute("QUERY_ID"); att1.InnerText = query.Name; att2.InnerText = query.QueryID.ToString(); resultNode.Attributes.Append(att1); resultNode.Attributes.Append(att2); XElement c = new XElement("Query", // new XAttribute("ID", query.QueryID), // new XAttribute("subcategoryid", query.SubCategoryID), // new XElement("QueryID", query.QueryID), // new XElement("QueryName", query.Name), new XElement("QueryDescription", query.Description), new XElement("QueryCategory", query.SubCategory), new XElement("QueryCategoryID", query.SubCategoryID)); XmlDocumentFragment queryNode = reportXML.CreateDocumentFragment(); queryNode.InnerXml = c.ToString(); resultNode.AppendChild(queryNode); List <QueryMapping> queryMaps = reportIQTools.GetQueryMaps(query.QueryID); XElement map = new XElement("Mapping", from qMap in queryMaps select new XElement("Map", new XElement("Title", qMap.Title), new XElement("Cell", qMap.Cell) ) ); XmlDocumentFragment mapNode = reportXML.CreateDocumentFragment(); mapNode.InnerXml = map.ToString(); resultNode.AppendChild(mapNode); string queryResult = reportIQTools.ExecQuery(query); // XmlNode queryNode = reportXML.CreateNode(XmlNodeType.Element, "Query", string.Empty); XmlDocumentFragment fragment = reportXML.CreateDocumentFragment(); fragment.InnerXml = queryResult; resultNode.AppendChild(fragment); mainNode.AppendChild(resultNode); //queryNode.InnerXml = queryResult; // resultNode.InnerXml += queryResult; ; } rootElement.AppendChild(mainNode); // return reportXML; }
public override IEnumerable <T> EnumerableFilter <T>(object collection, string filter, QueryParameters parameters) { throw new NotSupportedException(); }
public override IList <T> ListFilter <T>(object collection, string filter, QueryParameters parameters) { throw new NotSupportedException(); }
public override int ExecuteNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification, QueryParameters queryParameters) { using (new SessionIdLoggingContext(SessionId)) { CheckAndUpdateSessionStatus(); queryParameters.ValidateParameters(); NativeSQLQueryPlan plan = GetNativeSQLQueryPlan(nativeSQLQuerySpecification); bool success = false; int result; try { result = plan.PerformExecuteUpdate(queryParameters, this); success = true; } finally { AfterOperation(success); } temporaryPersistenceContext.Clear(); return(result); } }
public override Task BindAsync(DbCommand command, IList <Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return(Task.FromCanceled <object>(cancellationToken)); } return(BindAsync(command, sqlQueryParametersList, 0, sqlQueryParametersList, queryParameters, session, cancellationToken)); }
/// <summary> /// 无收费站信息列表 /// </summary> /// <param name="para"></param> /// <returns></returns> public List <ReportRelatedViewModels> NoDataList(QueryParameters para) { switch (para.ReportType) { case 1: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 2: { para.StationType = 3; return(reportRelatedManage.GetNoDataList(para)); } case 3: { para.StationType = 15; return(reportRelatedManage.GetNoDataList(para)); } case 4: { para.StationType = 33; return(reportRelatedManage.GetNoDataList(para)); } case 5: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 6: { para.StationType = 33; return(reportRelatedManage.GetNoDataList(para)); } case 7: { return(reportRelatedManage.GetNoDataList(para)); } case 8: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 11: { return(reportRelatedManage.GetNoDataList(para)); } case 12: { para.StationType = 3; return(reportRelatedManage.GetNoDataList(para)); } case 13: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 14: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 15: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } case 16: { para.StationType = 15; return(reportRelatedManage.GetNoDataList(para)); } case 18: { para.StationType = 1; return(reportRelatedManage.GetNoDataList(para)); } } SystemLog.GetInstance().Info("缺少参数:报表类型!"); return(null); }
public override async Task <int> ExecuteAsync(QueryParameters parameters, ISessionImplementor session, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); CoordinateSharedCacheCleanup(session); await(CreateTemporaryTableIfNecessaryAsync(persister, session, cancellationToken)).ConfigureAwait(false); try { // First, save off the pertinent ids, saving the number of pertinent ids for return DbCommand ps = null; int resultCount; try { try { var paramsSpec = Walker.Parameters; var sqlString = FilterHelper.ExpandDynamicFilterParameters(idInsertSelect, paramsSpec, session); var sqlQueryParametersList = sqlString.GetParameters().ToList(); SqlType[] parameterTypes = paramsSpec.GetQueryParameterTypes(sqlQueryParametersList, session.Factory); ps = await(session.Batcher.PrepareCommandAsync(CommandType.Text, sqlString, parameterTypes, cancellationToken)).ConfigureAwait(false); foreach (var parameterSpecification in paramsSpec) { await(parameterSpecification.BindAsync(ps, sqlQueryParametersList, parameters, session, cancellationToken)).ConfigureAwait(false); } resultCount = await(session.Batcher.ExecuteNonQueryAsync(ps, cancellationToken)).ConfigureAwait(false); } finally { if (ps != null) { session.Batcher.CloseCommand(ps, null); } } } catch (DbException e) { throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "could not insert/select ids for bulk delete", idInsertSelect); } // Start performing the deletes for (int i = 0; i < deletes.Length; i++) { try { try { ps = await(session.Batcher.PrepareCommandAsync(CommandType.Text, deletes[i], Array.Empty <SqlType>(), cancellationToken)).ConfigureAwait(false); await(session.Batcher.ExecuteNonQueryAsync(ps, cancellationToken)).ConfigureAwait(false); } finally { if (ps != null) { session.Batcher.CloseCommand(ps, null); } } } catch (DbException e) { throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "error performing bulk delete", deletes[i]); } } return(resultCount); } finally { await(DropTemporaryTableIfNecessaryAsync(persister, session, cancellationToken)).ConfigureAwait(false); } }
protected async Task <List <object> > DoListAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); bool statsEnabled = session.Factory.Statistics.IsStatisticsEnabled; var stopWatch = new Stopwatch(); if (statsEnabled) { stopWatch.Start(); } int rowCount = 0; var results = new List <object>(); var hydratedObjects = new List <object> [Translators.Count]; List <EntityKey[]>[] subselectResultKeys = new List <EntityKey[]> [Translators.Count]; bool[] createSubselects = new bool[Translators.Count]; try { using (var reader = await(resultSetsCommand.GetReaderAsync(_timeout, cancellationToken)).ConfigureAwait(false)) { if (log.IsDebugEnabled()) { log.Debug("Executing {0} queries", translators.Count); } for (int i = 0; i < translators.Count; i++) { ITranslator translator = Translators[i]; QueryParameters parameter = Parameters[i]; int entitySpan = translator.Loader.EntityPersisters.Length; hydratedObjects[i] = entitySpan > 0 ? new List <object>() : null; RowSelection selection = parameter.RowSelection; int maxRows = Loader.Loader.HasMaxRows(selection) ? selection.MaxRows : int.MaxValue; if (!dialect.SupportsLimitOffset || !translator.Loader.UseLimit(selection, dialect)) { await(Loader.Loader.AdvanceAsync(reader, selection, cancellationToken)).ConfigureAwait(false); } if (parameter.HasAutoDiscoverScalarTypes) { translator.Loader.AutoDiscoverTypes(reader); } LockMode[] lockModeArray = translator.Loader.GetLockModes(parameter.LockModes); EntityKey optionalObjectKey = Loader.Loader.GetOptionalObjectKey(parameter, session); createSubselects[i] = translator.Loader.IsSubselectLoadingEnabled; subselectResultKeys[i] = createSubselects[i] ? new List <EntityKey[]>() : null; translator.Loader.HandleEmptyCollections(parameter.CollectionKeys, reader, session); EntityKey[] keys = new EntityKey[entitySpan]; // we can reuse it each time if (log.IsDebugEnabled()) { log.Debug("processing result set"); } IList tempResults = new List <object>(); int count; for (count = 0; count < maxRows && await(reader.ReadAsync(cancellationToken)).ConfigureAwait(false); count++) { if (log.IsDebugEnabled()) { log.Debug("result set row: {0}", count); } rowCount++; object result = await(translator.Loader.GetRowFromResultSetAsync( reader, session, parameter, lockModeArray, optionalObjectKey, hydratedObjects[i], keys, true, cancellationToken)).ConfigureAwait(false); tempResults.Add(result); if (createSubselects[i]) { subselectResultKeys[i].Add(keys); keys = new EntityKey[entitySpan]; //can't reuse in this case } } if (log.IsDebugEnabled()) { log.Debug("done processing result set ({0} rows)", count); } results.Add(tempResults); if (log.IsDebugEnabled()) { log.Debug("Query {0} returned {1} results", i, tempResults.Count); } await(reader.NextResultAsync(cancellationToken)).ConfigureAwait(false); } for (int i = 0; i < translators.Count; i++) { ITranslator translator = translators[i]; QueryParameters parameter = parameters[i]; await(translator.Loader.InitializeEntitiesAndCollectionsAsync(hydratedObjects[i], reader, session, false, cancellationToken)).ConfigureAwait(false); if (createSubselects[i]) { translator.Loader.CreateSubselects(subselectResultKeys[i], parameter, session); } } } } catch (Exception sqle) { log.Error(sqle, "Failed to execute multi query: [{0}]", resultSetsCommand.Sql); throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle, "Failed to execute multi query", resultSetsCommand.Sql); } if (statsEnabled) { stopWatch.Stop(); session.Factory.StatisticsImplementor.QueryExecuted(string.Format("{0} queries (MultiQuery)", translators.Count), rowCount, stopWatch.Elapsed); } return(results); }
public override async Task <int> ExecuteUpdateAsync(IQueryExpression queryExpression, QueryParameters queryParameters, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (BeginProcess()) { queryParameters.ValidateParameters(); var plan = GetHQLQueryPlan(queryExpression, false); bool success = false; int result; try { result = await(plan.PerformExecuteUpdateAsync(queryParameters, this, cancellationToken)).ConfigureAwait(false); success = true; } finally { await(AfterOperationAsync(success, cancellationToken)).ConfigureAwait(false); } temporaryPersistenceContext.Clear(); return(result); } }
public void Bind(DbCommand command, IList <Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList <Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { TypedValue typedValue = queryParameters.NamedParameters[name]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { ExpectedType.NullSafeSet(command, typedValue.Value, position + singleSqlParametersOffset, session); } }
protected override Task ListFilterAsync(object collection, IQueryExpression queryExpression, QueryParameters parameters, IList results, CancellationToken cancellationToken) { throw new NotSupportedException(); }
public void Bind(DbCommand command, IList <Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { Bind(command, sqlQueryParametersList, 0, sqlQueryParametersList, queryParameters, session); }
public override Task <IList> ListFilterAsync(object collection, string filter, QueryParameters parameters, CancellationToken cancellationToken) { throw new NotSupportedException(); }
public abstract Task <int> ExecuteAsync(QueryParameters parameters, ISessionImplementor session, CancellationToken cancellationToken);
public override Task <IEnumerable <T> > EnumerableAsync <T>(IQueryExpression queryExpression, QueryParameters queryParameters, CancellationToken cancellationToken) { throw new NotImplementedException(); }
public abstract void List(string query, QueryParameters parameters, IList results);
/// <summary> /// List all groups. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.ApiManagement.IGroupsOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group. /// </param> /// <param name='serviceName'> /// Required. The name of the Api Management service. /// </param> /// <param name='query'> /// Optional. /// </param> /// <returns> /// List Groups operation response details. /// </returns> public static GroupListResponse List(this IGroupsOperations operations, string resourceGroupName, string serviceName, QueryParameters query) { return(Task.Factory.StartNew((object s) => { return ((IGroupsOperations)s).ListAsync(resourceGroupName, serviceName, query); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
protected virtual int BindQueryParameters(IDbCommand command, QueryParameters parameter, int colIndex) { colIndex += parameter.BindParameters(command, colIndex, session); return(colIndex); }
protected virtual int BindLimitParametersFirstIfNeccesary(IDbCommand command, QueryParameters parameter, int colIndex) { int limitParameterSpan = 0; RowSelection selection = parameter.RowSelection; if (Loader.Loader.UseLimit(selection, dialect) && dialect.BindLimitParametersFirst) { limitParameterSpan += Loader.Loader.BindLimitParameters(command, colIndex, selection, session); } return(limitParameterSpan); }
public abstract IEnumerable Enumerable(string query, QueryParameters parameters);
public abstract IEnumerable <T> Enumerable <T>(string query, QueryParameters queryParameters);
private static string Test(QueryParameters queryParameters) { return("Hello world!"); }
public static string UserDeniedAccess(PROVIDER_TYPE providerType, QueryParameters collection) { return "User denied access to share his details with this application"; }
public abstract IList <T> ListFilter <T>(object collection, string filter, QueryParameters parameters);