// Query a raw sql and return records as []map[string][]byte
184894
func (engine *Engine) Query(sqlorArgs ...interface{}) (resultsSlice []map[string][]byte, err error) {
	session := engine.NewSession()
	defer session.Close()
	return session.Query(sqlorArgs...)
}
893642
func (this *Engine) GetRows(sql string, params ...interface{}) []*ResultSet {
	sql = this.ReplaceTablePrefix(sql)
	result, err := this.RawQuery(sql, params...)
	if err != nil {
		this.TLogger.Base.Error(err)
	}
	return result
}
1144112
func (engine *Engine) Sql(querystring string, args ...interface{}) *Session {
	return engine.SQL(querystring, args...)
}
131153
func GetAllQueries(req *http.Request) map[string][]string {
	if ok, values := extractQueries(req); ok {
		return values
	}
	return nil
}
53866
func Query(query url.Values) RequestOption {
	return func(req *http.Request) error {
		req.URL.RawQuery = query.Encode()
		return nil
	}
}
1278395
func (this *Engine) RawFetchAll(fields string, table string, where string, params ...interface{}) []map[string]string {
	if fields == "" {
		fields = "*"
	} else {
		fields = this.ReplaceTablePrefix(fields)
	}
	sql := `SELECT ` + fields + ` FROM ` + this.fullTableName(table) + ` WHERE ` + this.ReplaceTablePrefix(where)
	if len(params) == 1 {
		switch params[0].(type) {
		case []interface{}:
			return this.RawQueryStr(sql, params[0].([]interface{})...)
		}
	}
	return this.RawQueryStr(sql, params...)
}
740498
func (tx *Tx) Query(model interface{}, query interface{}, params ...interface{}) (Result, error) {
	return tx.query(context.TODO(), model, query, params...)
}
26823
func (session *Session) QueryString(sqlorArgs ...interface{}) ([]map[string]string, error) {
	if session.isAutoClose {
		defer session.Close()
	}

	sqlStr, args, err := session.genQuerySQL(sqlorArgs...)
	if err != nil {
		return nil, err
	}

	rows, err := session.queryRows(sqlStr, args...)
	if err != nil {
		return nil, err
	}
	defer rows.Close()

	return rows2Strings(rows)
}
1345646
func Query(q string) func(r *Rego) {
	return func(r *Rego) {
		r.query = q
	}
}
798699
func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) {
	list := make([]namedValue, len(args))
	for i, v := range args {
		list[i] = namedValue{
			Ordinal: i + 1,
			Value:   v,
		}
	}
	return c.query(context.Background(), query, list)
}
665059
func Query(db *sql.DB, terms []string) ([]*CertificateMetadata, error) {
	tx, err := db.Begin()
	if err != nil {
		return nil, err
	}
	defer tx.Rollback()

	certs, err := certdb.AllCertificates(tx)
	if err != nil {
		return nil, err
	}

	results := make([]*CertificateMetadata, len(certs))
	for i := range certs {
		results[i], err = LoadCertificateMetadata(tx, certs[i])
		if err != nil {
			return nil, err
		}
	}

	filters := make([]CertificateFilter, 0, len(terms))
	for _, term := range terms {
		f, err := ParseQuery(term)
		if err != nil {
			return nil, err
		}

		filters = append(filters, f)
	}

	err = tx.Commit()
	return filterCertificates(results, filters), err
}
913353
func (scope *Scope) Raw(sql string) *Scope {
	scope.SQL = strings.Replace(sql, "$$$", "?", -1)
	return scope
}
1275887
func (api *KrakenApi) Query(method string, data map[string]string) (interface{}, error) {
	values := url.Values{}
	for key, value := range data {
		values.Set(key, value)
	}

	// Check if method is public or private
	if isStringInSlice(method, publicMethods) {
		return api.queryPublic(method, values, nil)
	} else if isStringInSlice(method, privateMethods) {
		return api.queryPrivate(method, values, nil)
	}

	return nil, fmt.Errorf("Method '%s' is not valid", method)
}
628547
func SelectBySql(query string, value ...interface{}) *SelectStmt {
	return &SelectStmt{
		raw: raw{
			Query: query,
			Value: value,
		},
		LimitCount:  -1,
		OffsetCount: -1,
	}
}
515731
func (tx *Tx) Query(sql string, args ...interface{}) (*Rows, error) {
	return tx.QueryEx(context.Background(), sql, nil, args...)
}
384287
func (db DBWrapper) Query(sqlText string, args ...interface{}) (qr QueryResult) {
	rows, err := db.DB.Query(sqlText, args...)
	defer func() {
		if rows != nil {
			rows.Close()
		}
	}()

	if err != nil {
		db.logError(err, sqlText, args)
		qr.Error = err
		return
	}

	qr.Cols, err = rows.Columns()
	if err != nil {
		db.logError(err, sqlText, args)
		qr.Error = err
		return
	}
	qr.Rows = make([]Row, 0, 10) // Default len 10
	for rows.Next() {
		row := make([]interface{}, len(qr.Cols))
		for i, _ := range row {
			row[i] = new([]byte)
		}

		rows.Scan(row...)
		qr.Rows = append(qr.Rows, row)
	}
	return
}
1083804
func (txc *TxConnection) RecordQuery(query string) {
	txc.Queries = append(txc.Queries, query)
}