MkFramework
 All Data Structures Functions
sgbd_pdo_pgsql.php
1 <?php
2 /*
3 This file is part of Mkframework.
4 
5 Mkframework is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License.
8 
9 Mkframework is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mkframework. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
19 
20  public static function getInstance($sConfig){
21  return self::_getInstance(__CLASS__,$sConfig);
22  }
23 
24  public function getListColumn($sTable){
25  $pRs=$this->query(sgbd_syntax_pgsql::getListColumn($sTable));
26  $tObj=array();
27 
28  if(empty($pRs)){
29  return null;
30  }
31 
32  while($tRow=$pRs->fetch(PDO::FETCH_NUM)){
33  $tObj[]=$tRow[0];
34  }
35  return $tObj;
36  }
37  public function getListTable(){
38  $pRs=$this->query(sgbd_syntax_pgsql::getListTable());
39 
40  if(empty($pRs)){
41  return null;
42  }
43 
44  $tObj=array();
45  while($tRow=$pRs->fetch(PDO::FETCH_NUM)){
46  $tObj[]=$tRow[0];
47  }
48  return $tObj;
49  }
50 
51  protected function connect(){
52  if(empty($this->_pDb)){
53  $this->_pDb=new PDO(
54  $this->_tConfig[$this->_sConfig.'.dsn'],
55  $this->_tConfig[$this->_sConfig.'.username'],
56  $this->_tConfig[$this->_sConfig.'.password']
57  );
58  }
59  }
60  public function getLastInsertId(){
61  $pRs=$this->query(sgbd_syntax_pgsql::getLastInsertId());
62 
63  if(empty($pRs)){
64  return null;
65  }
66  $tRow=$pRs->fetch(PDO::FETCH_NUM);
67  return (int)$tRow[0];
68  }
69 
70  public function getWhereAll(){
71  return '1=1';
72  }
73 
74 }