Search in sources :

Example 36 with QueryExecutorExtend

use of org.sagacity.sqltoy.model.inner.QueryExecutorExtend in project sagacity-sqltoy by chenrenfei.

the class SqlToyDaoSupport method getCountByQuery.

/**
 * @todo 指定数据源查询记录数量
 * @param queryExecutor
 * @return
 */
protected Long getCountByQuery(final QueryExecutor queryExecutor) {
    QueryExecutorExtend extend = queryExecutor.getInnerModel();
    SqlToyConfig sqlToyConfig = sqlToyContext.getSqlToyConfig(extend.sql, SqlType.search, getDialect(extend.dataSource));
    return dialectFactory.getCountBySql(sqlToyContext, queryExecutor, sqlToyConfig, this.getDataSource(extend.dataSource, sqlToyConfig));
}
Also used : SqlToyConfig(org.sagacity.sqltoy.config.model.SqlToyConfig) QueryExecutorExtend(org.sagacity.sqltoy.model.inner.QueryExecutorExtend)

Aggregations

QueryExecutorExtend (org.sagacity.sqltoy.model.inner.QueryExecutorExtend)36 SqlToyResult (org.sagacity.sqltoy.config.model.SqlToyResult)19 SqlToyConfig (org.sagacity.sqltoy.config.model.SqlToyConfig)15 DataAccessException (org.sagacity.sqltoy.exception.DataAccessException)11 Connection (java.sql.Connection)8 List (java.util.List)8 DataSourceCallbackHandler (org.sagacity.sqltoy.callback.DataSourceCallbackHandler)8 ArrayList (java.util.ArrayList)7 QueryResult (org.sagacity.sqltoy.model.QueryResult)7 DataSetResult (org.sagacity.sqltoy.model.inner.DataSetResult)4 NoSqlConfigModel (org.sagacity.sqltoy.config.model.NoSqlConfigModel)3 QueryExecutor (org.sagacity.sqltoy.model.QueryExecutor)3 JSONObject (com.alibaba.fastjson.JSONObject)2 ShardingStrategyConfig (org.sagacity.sqltoy.config.model.ShardingStrategyConfig)2 SqlWithAnalysis (org.sagacity.sqltoy.config.model.SqlWithAnalysis)2 Page (org.sagacity.sqltoy.model.Page)2 DataSource (javax.sql.DataSource)1 PageOptimize (org.sagacity.sqltoy.config.model.PageOptimize)1 PivotModel (org.sagacity.sqltoy.config.model.PivotModel)1 SqlParamsModel (org.sagacity.sqltoy.config.model.SqlParamsModel)1