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:30:11 +0300
committerMarcin Łojewski <marcin.lojewski@mlojewski.me>2018-06-28 21:30:14 +0300
commita257855e07ec81b580f401da65f17420d099fafd (patch)
tree5bdffea4e950ec42bea76c6f1466aa7a10c071b2 /lib/Platform
parentecb04a331b5196bde44a74212925326ff1a92075 (diff)
autocomplete for columns
Diffstat (limited to 'lib/Platform')
-rw-r--r--lib/Platform/AbstractPlatform.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Platform/AbstractPlatform.php b/lib/Platform/AbstractPlatform.php
index 38d8f61..59052d4 100644
--- a/lib/Platform/AbstractPlatform.php
+++ b/lib/Platform/AbstractPlatform.php
@@ -108,12 +108,13 @@ abstract class AbstractPlatform
/**
* Get all the columns defined in the table.
*
- * @param string $table The table name.
+ * @param string $table The table name.
+ * @param string $phrase Show only columns containing given phrase.
*
* @return array Array with column names.
* @throws DBALException On a database exception.
*/
- public function getColumns($table)
+ public function getColumns($table, $phrase = "")
{
$platform = $this->connection->getDatabasePlatform();
$query = $platform->getListTableColumnsSQL($table);
@@ -123,7 +124,9 @@ abstract class AbstractPlatform
while ($row = $result->fetch()) {
$name = $this->getColumnName($row);
- $columns[] = $name;
+ if (preg_match("/.*$phrase.*/i", $name)) {
+ $columns[] = $name;
+ }
}
return $columns;