-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Milestone
Description
I encountered an issue where not all the parameters would be replaced correctly.
The query in question is:
SELECT "f".*
FROM "oc_filecache" "f"
WHERE
(
(
("f"."storage" = :dcValue1) AND ("f"."path" LIKE :dcValue2 ESCAPE '\')
) OR (
("f"."storage" = :dcValue3) AND ("f"."path" LIKE :dcValue4 ESCAPE '\')
) OR (
"f"."storage" = :dcValue5
)
) AND (
("f"."mimetype" <> :dcValue6) OR ("f"."size" = 0)
) AND (
"f"."path" NOT LIKE :dcValue7
) AND (
"f"."path" NOT LIKE :dcValue8
)
ORDER BY "f"."mtime"
DESC LIMIT 500Manually replacing all the values runs this like a charm.
However it seems the split in getUnquotedStatementFragments doesn't like ESCAPING on \.
What happens is that :dcValue1 and :dcValue2 are properly found.
However then the regex interpets the \' as an escaped quote. Thus ignoring until the next escape statement.
The replaces statement thus looks like
SELECT "f".*
FROM "oc_filecache" "f"
WHERE
(
(
("f"."storage" = ?) AND ("f"."path" LIKE ? ESCAPE "\")
) OR (
("f"."storage" = :dcValue3) AND ("f"."path" LIKE :dcValue4 ESCAPE "\")
) OR (
"f"."storage" = :dcValue5
)
) AND (
("f"."mimetype" <> :dcValue6) OR ("f"."size" = 0)
) AND (
"f"."path" NOT LIKE :dcValue7
) AND (
"f"."path" NOT LIKE :dcValue8
)
ORDER BY "f"."mtime"
DESC LIMIT 500I'll try to dig a bit deeper or to come up with a PR that at least provides you with failing test cases to verify.