From a7b9899d1b227a7ea9d0019bdc07905c9eb12482 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 15 Mar 2016 22:55:57 +0100 Subject: * facades for sql maps --- app/php/facades/Facade.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/php/facades/Facade.php (limited to 'app/php/facades/Facade.php') diff --git a/app/php/facades/Facade.php b/app/php/facades/Facade.php new file mode 100644 index 0000000..5d71a89 --- /dev/null +++ b/app/php/facades/Facade.php @@ -0,0 +1,43 @@ +_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); + } + +} + +?> -- cgit v1.2.3