mirror of
https://github.com/moparisthebest/user_sql
synced 2024-11-22 09:12:20 -05:00
Check SQL Views on getTables function
This commit is contained in:
parent
eae75ba236
commit
6e4028275e
@ -326,23 +326,31 @@ class Helper {
|
|||||||
public function getColumns($parameters, $sql_driver, $table)
|
public function getColumns($parameters, $sql_driver, $table)
|
||||||
{
|
{
|
||||||
$cm = new \OC\DB\ConnectionFactory();
|
$cm = new \OC\DB\ConnectionFactory();
|
||||||
try {
|
try {
|
||||||
$conn = $cm -> getConnection($sql_driver, $parameters);
|
$conn = $cm -> getConnection($sql_driver, $parameters);
|
||||||
$platform = $conn -> getDatabasePlatform();
|
$platform = $conn -> getDatabasePlatform();
|
||||||
$query = $platform -> getListTableColumnsSQL($table);
|
$query = $platform -> getListTablesSQL();
|
||||||
$result = $conn -> executeQuery($query);
|
$result = $conn -> executeQuery($query);
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while($row = $result -> fetch())
|
while($row = $result -> fetch())
|
||||||
{
|
{
|
||||||
$name = $row['Field'];
|
$name = $row['Tables_in_'.$parameters['dbname']];
|
||||||
$ret[] = $name;
|
$ret[] = $name;
|
||||||
}
|
}
|
||||||
return $ret;
|
$query = $platform -> getListViewsSQL($parameters['dbname']);
|
||||||
}
|
$result = $conn -> executeQuery($query);
|
||||||
catch(\Exception $e)
|
$ret = array();
|
||||||
{
|
while($row = $result -> fetch())
|
||||||
return array();
|
{
|
||||||
}
|
$name = $row['TABLE_NAME'];
|
||||||
|
$ret[] = $name;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
catch(\Exception $e)
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user