2014-12-22 06:35:15 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Administrator
|
|
|
|
* Date: 2014/12/4
|
|
|
|
* Time: 11:31
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Westdc\Visual;
|
|
|
|
|
|
|
|
|
|
|
|
class DataTableControl extends Database{
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function readTables()
|
|
|
|
{
|
2015-01-22 04:07:31 +00:00
|
|
|
$sql = "SELECT schemaname||'.'||tablename as tablename FROM pg_tables WHERE tableowner='gis' ORDER BY tablename ";
|
2014-12-22 06:35:15 +00:00
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
|
|
|
$row = $rs->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
|
return $row;
|
|
|
|
}
|
|
|
|
|
2015-01-22 04:07:31 +00:00
|
|
|
public function readFields($tablename)
|
2014-12-22 06:35:15 +00:00
|
|
|
{
|
2015-01-22 04:07:31 +00:00
|
|
|
$st=explode('.',$tablename);
|
|
|
|
$sql = "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where table_schema='".$st[0]."' and TABLE_NAME='".$st[1]."'";
|
2014-12-22 06:35:15 +00:00
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
return $rs->fetchAll(\PDO::FETCH_COLUMN);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|