aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-10-20 13:21:09 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-10-20 13:21:09 +0200
commit8ba1abbfb4a89bc4562b91551300ab36b56d4897 (patch)
tree3dddfa2ac33dfecadea9a9f80d40c2f27eb28e76
parentb00bdf5204088a29691b0428a14dd2e0ccf7bbcd (diff)
downloadnextcloud-server-8ba1abbfb4a89bc4562b91551300ab36b56d4897.tar.gz
nextcloud-server-8ba1abbfb4a89bc4562b91551300ab36b56d4897.zip
Adding escapeLikeParameter to \DB\Connection
-rw-r--r--lib/private/db/connection.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php
index 4d33cd968af..1b86d3d383a 100644
--- a/lib/private/db/connection.php
+++ b/lib/private/db/connection.php
@@ -301,4 +301,14 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
public function inTransaction() {
return $this->getTransactionNestingLevel() > 0;
}
+
+ /**
+ * Espace a parameter to be used in a LIKE query
+ *
+ * @param string $param
+ * @return string
+ */
+ public function escapeLikeParameter($param) {
+ return addcslashes($param, '\\_%');
+ }
}