mirror of
https://github.com/nextcloud/server.git
synced 2024-07-23 12:54:52 +02:00
Add escapeLikeParameter to IDBConnection
This commit is contained in:
parent
556fabf15d
commit
d514200b56
@ -258,4 +258,13 @@ class Db implements IDb {
|
|||||||
return $this->connection->tableExists($table);
|
return $this->connection->tableExists($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Espace a parameter to be used in a LIKE query
|
||||||
|
*
|
||||||
|
* @param string $param
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function escapeLikeParameter($param) {
|
||||||
|
return $this->connection->escapeLikeParameter($param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,4 +301,14 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
|
|||||||
public function inTransaction() {
|
public function inTransaction() {
|
||||||
return $this->getTransactionNestingLevel() > 0;
|
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, '\\_%');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,4 +206,13 @@ interface IDBConnection {
|
|||||||
* @since 8.0.0
|
* @since 8.0.0
|
||||||
*/
|
*/
|
||||||
public function tableExists($table);
|
public function tableExists($table);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escape a parameter to be used in a LIKE query
|
||||||
|
*
|
||||||
|
* @param string $param
|
||||||
|
* @return string
|
||||||
|
* @since 9.0.0
|
||||||
|
*/
|
||||||
|
public function escapeLikeParameter($param);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user