Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_sql.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Łojewski <marcin.lojewski@mlojewski.me>2018-06-28 21:16:43 +0300
committerMarcin Łojewski <marcin.lojewski@mlojewski.me>2018-06-28 21:23:35 +0300
commitecb04a331b5196bde44a74212925326ff1a92075 (patch)
tree765c9f29aaf9c352832ff52fb169a72ac72d3c11 /lib/Platform
parentffb28c62beff7492a90842a294bd680f165f324e (diff)
autocomplete for tables
Diffstat (limited to 'lib/Platform')
-rw-r--r--lib/Platform/AbstractPlatform.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Platform/AbstractPlatform.php b/lib/Platform/AbstractPlatform.php
index 63156ff..38d8f61 100644
--- a/lib/Platform/AbstractPlatform.php
+++ b/lib/Platform/AbstractPlatform.php
@@ -49,12 +49,13 @@ abstract class AbstractPlatform
/**
* Get all the tables defined in the database.
*
- * @param bool $schemaPrefix Show schema name in the results.
+ * @param string $phrase Show only tables containing given phrase.
+ * @param bool $schemaPrefix Show schema name in the results.
*
* @return array Array with table names.
* @throws DBALException On a database exception.
*/
- public function getTables($schemaPrefix = false)
+ public function getTables($phrase = "", $schemaPrefix = false)
{
$platform = $this->connection->getDatabasePlatform();
@@ -68,13 +69,17 @@ abstract class AbstractPlatform
$result = $this->connection->executeQuery($queryTables);
while ($row = $result->fetch()) {
$name = $this->getTableName($row, $schemaPrefix);
- $tables[] = $name;
+ if (preg_match("/.*$phrase.*/i", $name)) {
+ $tables[] = $name;
+ }
}
$result = $this->connection->executeQuery($queryViews);
while ($row = $result->fetch()) {
$name = $this->getViewName($row, $schemaPrefix);
- $tables[] = $name;
+ if (preg_match("/.*$phrase.*/i", $name)) {
+ $tables[] = $name;
+ }
}
return $tables;