mirror of
https://github.com/stashapp/stash.git
synced 2025-12-10 02:15:30 +01:00
Use arg for regex queries (#311)
This commit is contained in:
parent
bab7c8f250
commit
488cd5575d
2 changed files with 6 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
const testName = "Foo Bar"
|
||||
const testName = "Foo's Bar"
|
||||
const testExtension = ".mp4"
|
||||
|
||||
var testSeparators = []string{
|
||||
|
|
|
|||
|
|
@ -293,7 +293,9 @@ func getMultiCriterionClause(table string, joinTable string, joinTableField stri
|
|||
|
||||
func (qb *SceneQueryBuilder) QueryAllByPathRegex(regex string) ([]*Scene, error) {
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("scenes") + " WHERE scenes.path regexp '(?i)" + regex + "'"
|
||||
body := selectDistinctIDs("scenes") + " WHERE scenes.path regexp ?"
|
||||
|
||||
args = append(args, "(?i)"+regex)
|
||||
|
||||
idsResult, err := runIdsQuery(body, args)
|
||||
|
||||
|
|
@ -326,7 +328,8 @@ func (qb *SceneQueryBuilder) QueryByPathRegex(findFilter *FindFilterType) ([]*Sc
|
|||
body := selectDistinctIDs("scenes")
|
||||
|
||||
if q := findFilter.Q; q != nil && *q != "" {
|
||||
whereClauses = append(whereClauses, "scenes.path regexp '(?i)"+*q+"'")
|
||||
whereClauses = append(whereClauses, "scenes.path regexp ?")
|
||||
args = append(args, "(?i)"+*q)
|
||||
}
|
||||
|
||||
sortAndPagination := qb.getSceneSort(findFilter) + getPagination(findFilter)
|
||||
|
|
|
|||
Loading…
Reference in a new issue