1
0
mirror of https://github.com/moparisthebest/user_sql synced 2024-11-21 16:55:02 -05:00

Check SQL Views on getTables function

This commit is contained in:
Fèlix Casanellas 2017-06-21 15:15:20 +02:00
parent eae75ba236
commit 6e4028275e

View File

@ -326,23 +326,31 @@ class Helper {
public function getColumns($parameters, $sql_driver, $table)
{
$cm = new \OC\DB\ConnectionFactory();
try {
$conn = $cm -> getConnection($sql_driver, $parameters);
$platform = $conn -> getDatabasePlatform();
$query = $platform -> getListTableColumnsSQL($table);
$result = $conn -> executeQuery($query);
$ret = array();
while($row = $result -> fetch())
{
$name = $row['Field'];
$ret[] = $name;
}
return $ret;
}
catch(\Exception $e)
{
return array();
}
try {
$conn = $cm -> getConnection($sql_driver, $parameters);
$platform = $conn -> getDatabasePlatform();
$query = $platform -> getListTablesSQL();
$result = $conn -> executeQuery($query);
$ret = array();
while($row = $result -> fetch())
{
$name = $row['Tables_in_'.$parameters['dbname']];
$ret[] = $name;
}
$query = $platform -> getListViewsSQL($parameters['dbname']);
$result = $conn -> executeQuery($query);
$ret = array();
while($row = $result -> fetch())
{
$name = $row['TABLE_NAME'];
$ret[] = $name;
}
return $ret;
}
catch(\Exception $e)
{
return array();
}
}