Selects terms with a matching slug.
@param slug The slug.
@return The terms or an empty list if none.
@throws SQLException on database error.
488421
public List<Term> selectSlugTerms(final String slug) throws SQLException {
      try(Connection conn = connectionSupplier.getConnection();
          PreparedStatement stmt = conn.prepareStatement(selectTermSlugSQL);
          Timer.Context ctx = metrics.selectTermTimer.time()) {
         stmt.setString(1, slug);
         try(ResultSet rs = stmt.executeQuery()) {
            List<Term> terms = Lists.newArrayListWithExpectedSize(2);
            while(rs.next()) {
               terms.add(new Term(rs.getLong(1), rs.getString(2), rs.getString(3)));
            }
            return terms;
         }
      }
   }
1230361
public ResultSet executeQuery(String sql) throws SQLException {
    if (executeInternal(sql, fetchSize, Statement.NO_GENERATED_KEYS)) {
      return results.getResultSet();
    }
    return SelectResultSet.createEmptyResultSet();
  }
666269
@Override
	public ResultSet doQuery(final SqlContext sqlContext, final PreparedStatement preparedStatement,
			final ResultSet resultSet) throws SQLException {
		if (getFilters().isEmpty()) {
			return resultSet;
		}
		ResultSet rs = resultSet;
		for (final SqlFilter filter : getFilters()) {
			rs = filter.doQuery(sqlContext, preparedStatement, rs);
		}
		return rs;
	}
278616
public TaxonomyTerm selectTaxonomyTerm(final String taxonomy, final String name) throws SQLException {

      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      long taxonomyTermId = 0L;
      long termId = 0L;
      String description = "";
      Timer.Context ctx = metrics.selectTaxonomyTermTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(selectTaxonomyTermSQL);
         stmt.setString(1, name);
         stmt.setString(2, taxonomy);
         rs = stmt.executeQuery();
         if(rs.next()) {
            taxonomyTermId = rs.getLong(1);
            termId = rs.getLong(2);
            description = rs.getString(3);
         } else {
            return null;
         }
      } finally {
         ctx.stop();
         closeQuietly(conn, stmt, rs);
      }
      return new TaxonomyTerm(taxonomyTermId, taxonomy, selectTerm(termId), description);
   }
1093786
private static List<String> getColumnLabels(ResultSet result) throws SQLException {
        // 存放结果集中的列名
        List<String> listColumns = new ArrayList<String>();
        // 获取结果集元数据
        ResultSetMetaData rsmd = result.getMetaData();
        // 将字段名放入数组中
        for (int i = 0; i < rsmd.getColumnCount(); i++) {
            listColumns.add(rsmd.getColumnLabel(i + 1));
        }

        return listColumns;
    }
255611
public static function findBySlugType( $slug, $type, $config = [] ) {

		return self::queryBySlugType( $slug, $type, $config )->one();
	}
125735
@NotNull
    public List<T> queryList() throws SQLException {
        List<T> res = new ArrayList<>();
        try (ResultSet r = statement.executeQuery()) {
            while (r.next()) {
                res.add(resultMapper.map(r));
            }
        }
        return res;
    }
1084144
public List<QueryResult> executeQuery() throws SQLException {
        final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
        SQLExecuteCallback<QueryResult> executeCallback = new SQLExecuteCallback<QueryResult>(getDatabaseType(), isExceptionThrown) {
            
            @Override
            protected QueryResult executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
                return getQueryResult(routeUnit, statement, connectionMode);
            }
        };
        return executeCallback(executeCallback);
    }
1229236
public List<SchemaName> getSchemas() throws SQLException {
        final List<SchemaName> list = new ArrayList<>();
        try (ResultSet results = databaseMetadata.getSchemas()) {
            if (results != null) {
                bind(results, SchemaName.class, list);
            }
        }
        return list;
    }
1245963
public function slug($slug = null): self
    {
        if (! empty($slug)) {
            // set this slug to be used in with callback
            $this->slug = $slug;

            // exception to filter on specific slug
            $exception = function ($query) {
                $query->where('slug', '=', $this->slug);
            };

            // load term to filter
            return $this->whereHas('term', $exception);
        }

        return $this;
    }
802986
@Override
	public ResultSet doQuery(final SqlContext sqlContext, final PreparedStatement preparedStatement,
			final ResultSet resultSet) throws SQLException {
		return resultSet;
	}
355212
public List<T> query(ConnectionSource connectionSource, PreparedStmt<T> preparedStmt, ObjectCache objectCache)
			throws SQLException {
		SelectIterator<T, ID> iterator = buildIterator(/* no dao specified because no removes */null, connectionSource,
				preparedStmt, objectCache, DatabaseConnection.DEFAULT_RESULT_FLAGS);
		try {
			List<T> results = new ArrayList<T>();
			while (iterator.hasNextThrow()) {
				results.add(iterator.nextThrow());
			}
			logger.debug("query of '{}' returned {} results", preparedStmt.getStatement(), results.size());
			return results;
		} finally {
			IOUtils.closeThrowSqlException(iterator, "iterator");
		}
	}
163711
public Term createTerm(final String name, final String slug) throws SQLException {

      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      Timer.Context ctx = metrics.createTermTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS);
         stmt.setString(1, name);
         stmt.setString(2, slug);
         stmt.executeUpdate();
         rs = stmt.getGeneratedKeys();
         if(rs.next()) {
            return new Term(rs.getLong(1), name, slug);
         } else {
            throw new SQLException("Problem creating term (no generated id)");
         }
      } finally {
         ctx.stop();
         closeQuietly(conn, stmt, rs);
      }
   }
1045626
public ResultSet runSelect(String logMessage, String query, Object[] arguments) throws SQLException {
        long before = System.currentTimeMillis();
        try {
            return runSelect(query, arguments);
        }
        finally {
            if (logger.isDebugEnabled()) {
                long after = System.currentTimeMillis();
                logger.debug(logMessage + " (" + (after - before) + " ms): " + DbAccess.substitute(query, arguments));
            }
        }
    }
933922
public function getBySlug($lang, $slug)
    {
        $postType = PostType::collection()->where('slug', $slug);
        if(!$postType->isEmpty()) {
            return $postType->first();
        }
        return [];
    }
834241
public <T> List<T> querySingleColumnTypedResults(String sql, String[] args) {
		@SuppressWarnings("unchecked")
		List<T> result = (List<T>) querySingleColumnResults(sql, args);
		return result;
	}
666720
public function getBySlug($slug)
    {
        if (empty($slug))
            throw new Exception("Cannot retrieve object [".get_class($this->getModel())."] without slug");

        $results = $this->multiGetBySlug((array)$slug);
        if (isset($results[$slug]))
            return $results[$slug];

        throw new Exception(get_class($this->getModel()).' not found for slug: '.$slug);

    }