MkFramework
 All Data Structures Functions
sgbd_pdo_mssql.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_mssql::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_mssql::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 
61  public function getLastInsertId(){
62  $pRs=$this->query(sgbd_syntax_mssql::getLastInsertId());
63 
64  if(empty($pRs)){
65  return null;
66  }
67  $tRow=$pRs->fetch(PDO::FETCH_NUM);
68  return (int)$tRow[0];
69  }
70 
71  public function getWhereAll(){
72  return '1=1';
73  }
74 
75 }