Driver.class.php
1.39 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* 数据库操作
*
* example:
* <pre>
*
* </pre>
*
* @name Util_Dao_Db
* @version 40 (2009-3-4 上午10:39:01)
* @package Q.Dao.Db
* @author peter.zyliu liuziyang@zadooo.com
* @since 1.0
*/
class Util_Dao_Db_Driver
{
/**
* Enter description here...
*
* @var Zend_Db
*/
private $pdo;
/**
* 初始化
*
* @param Array $params
* @param String $drivers
*/
public function __construct($params, $drivers = 'PDO_MYSQL')
{
$this->pdo = Util_Db::factory($drivers, $params);
}
/**
*
* 取得语句对象
*
* @param String $sql
* @param array $parameterMap 数组
* @return Util_Dao_Db_PdoQuery
*/
public function stmt($sql, $parameterMap = array())
{
return new Util_Dao_Db_PdoQuery($this->pdo, $sql, $parameterMap);
}
/**
* @return Zend_Db_Adapter_Abstract
*/
public function zendDB()
{
return $this->pdo;
}
/**
* 开始事务
*
*/
public function beginTransaction()
{
$this->pdo->beginTransaction();
}
/**
* 提交
*
*/
public function commit()
{
$this->pdo->commit();
}
/**
* 回滚
*
*/
public function rollBack()
{
$this->pdo->rollBack();
}
/**
* 关闭连接
*
*/
public function close()
{
$this->pdo->closeConnection();
}
/**
* 是否链接
* @param int $attr
*/
public function isConnected()
{
$this->pdo->__wakeup();
return $this->pdo->isConnected();
}
}