blob: d63d22a969eec32af89301a424d3de99aad3a259 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
Prado::using('System.Data.SqlMap.TSqlMapGateway');
class Facade {
protected static $_instances = [];
protected $_sqlMap;
protected function __construct() {
$this->_sqlMap = Prado::getApplication()->getModule('sqlmap')->Client;
}
public static function getInstance() {
$className = get_called_class();
if (!isset(static::$_instances[$className])) {
static::$_instances[$className] = new static();
}
return static::$_instances[$className];
}
protected function getClient() {
return $this->_sqlMap;
}
protected function quoteString($string) {
return $this->getClient()->DbConnection->quoteString($string);
}
protected function fetch($sqlMap, $params) {
return $this->getClient()->queryForObject($sqlMap, $params);
}
protected function fetchList($sqlMap, $params) {
return $this->getClient()->queryForList($sqlMap, $params);
}
protected function fetchMap($sqlMap, $params, $key, $value=NULL) {
return $this->getClient()->queryForMap($sqlMap, $params, $key, $value);
}
}
?>
|