MkFramework
 All Data Structures Functions
sgbd_pdo_sqlite.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_sqlite::getListColumn($sTable));
26 
27  $tObj=array();
28 
29  if(empty($pRs)){
30  return null;
31  }
32  while($tRow=$pRs->fetch(PDO::FETCH_NUM)){
33  $tObj[]=$tRow[1];
34  }
35  return $tObj;
36  }
37  public function getListTable(){
38  $pRs=$this->query(sgbd_syntax_sqlite::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  return $this->_pDb->lastInsertid();
62  }
63 
64  public function getWhereAll(){
65  return '1=1';
66  }
67 
68 }