Remove use of dialect.LikeStr (#104460)

* Fix TestIntegrationUpdatingProvisionionedDashboards* tests when running on Spanner by fixing case-insensitive search for dashboard title.

* Fix use of case-insensitive LIKE when running on Spanner.

* Fix use of LikeStr in anonstore.

* Fix use of LikeStr in ngalert/store and org/orgimpl.

* Fix use of LikeStr in queryhistory search.

* Fix use of LikeStr in serviceaccounts.

* Fix use of LikeStr in serviceaccounts.

* Fix use of LikeStr in services/team.

* Remove LikeStr method.
This commit is contained in:
Peter Štibraný
2025-05-02 11:23:57 +03:00
committed by GitHub
parent d7ebaafa94
commit e85acf047a
16 changed files with 82 additions and 51 deletions
@@ -476,8 +476,16 @@ func (r *xormRepositoryImpl) GetTags(ctx context.Context, query annotations.Tags
sql.WriteString(`WHERE annotation.org_id = ?`)
params = append(params, query.OrgID)
sql.WriteString(` AND (` + tagKey + ` ` + r.db.GetDialect().LikeStr() + ` ? OR ` + tagValue + ` ` + r.db.GetDialect().LikeStr() + ` ?)`)
params = append(params, `%`+query.Tag+`%`, `%`+query.Tag+`%`)
sql.WriteString(` AND (`)
s, p := r.db.GetDialect().LikeOperator(tagKey, true, query.Tag, true)
sql.WriteString(s)
params = append(params, p)
sql.WriteString(" OR ")
s, p = r.db.GetDialect().LikeOperator(tagValue, true, query.Tag, true)
sql.WriteString(s)
params = append(params, p)
sql.WriteString(")")
sql.WriteString(` GROUP BY ` + tagKey + `,` + tagValue)
sql.WriteString(` ORDER BY ` + tagKey + `,` + tagValue)