FinaleExec.class.php
1.88 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
103
<?php
/**
* 执行最终的操作方法
*
* example:
* <pre>
*
* </pre>
*
* @name Util_Dao_Db_FinaleExec
* @version 448 (2009-4-17 下午02:24:48)
* @package Q.Dao.Db.FinaleExec
* @author Peter.zyliu liuziyang@zadooo.com
* @since 1.0
*/
final class Util_Dao_Db_FinaleExec {
/**
* pdo对象
*
* @var object
*/
private $pdo;
/**
* Enter description here...
*
* @var object
*/
private $stmt;
/**
* 返回sql执行状态
*
* @var bool
*/
private $retval;
/**
* 初始化
*
* @param Zend_Db::factory() $pdo
* @param Zend_Db::factory() $stmt
*/
public function __construct($pdo, $stmt,$retval=true) {
if(!is_object($pdo) || !is_object($stmt) ) {
throw new Util_Dao_Exception ( 'FinaleExec :\$pdo or \$stmt not\'s object ');
}
$this->pdo = $pdo;
$this->stmt = $stmt;
$this->retval = $retval;
}
/**
* 返回插入影响的行数
* @return integer
*/
public function rowCount() {
return $this->stmt->rowCount ();
}
/**
* 获取刚刚插入的数据ID
* @return Integer
*/
public function lastInsertId() {
return $this->pdo->lastInsertId ();
}
/**
* 返回执行sql的状态
* @return bool
*/
public function status() {
return $this->retval;
}
/**
* 返回错误码
* @return String
*/
public function errorCode() {
return $this->stmt->errorCode ();
}
/**
* 返回错误信息
* @return Array
*/
public function errorInfo() {
return $this->stmt->errorInfo ();
}
/**
*
* @param <type> $name
* @param <type> $arg
*/
public function __call($name, $arg) {
throw new Util_Dao_Exception ( 'FinaleExec :not ' .$name);
}
}