Result.php
1.89 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
104
105
106
107
108
109
110
111
<?php
/**
* Created by PhpStorm.
* User: Zip
* Date: 14/11/28
* Time: 上午1:32
*/
namespace Hood\Dao\Db\PDOMySQL;
/**
* 结果
* Class Result
* @package Hood\Dao\Db\PDOMySQL
*/
class Result
{
/**
*
* @var \PDO
*/
private $_PDOConn;
/**
* @var \PDOStatement
*/
private $_PDOStatement;
/**
* @param $PDOConn
* @param $PDOStatement
*/
public function __construct($PDOConn, $PDOStatement)
{
$this->_PDOConn = $PDOConn;
$this->_PDOStatement = $PDOStatement;
}
/**
* 获取插入的ID
* @param null $name
* @return int
*/
public function lastInsertId($name = null)
{
return $this->_PDOConn->lastInsertId($name);
}
/**
* 在一个多行集语句句柄中推进到下一个行集
* @return bool
*/
public function nextRowset()
{
return $this->_PDOStatement->nextRowset();
}
/**
* 获取更新数量
* @return int
*/
public function rowCount()
{
return $this->_PDOStatement->rowCount();
}
/**
* 状态
* @return bool
*/
public function status()
{
return $this->_PDOStatement->errorCode() === '00000';
}
/**
* 获取statement Error Code
* @return string
*/
public function statementErrorCode()
{
return $this->_PDOStatement->errorCode();
}
/**
* 获取statement Error Info
* @return array
*/
public function statementErrorInfo()
{
return $this->_PDOStatement->errorInfo();
}
/**
* 获取pdo error code
* @return mixed
*/
public function pdoErrorCode()
{
return $this->_PDOConn->errorCode();
}
/**
* 获取PDO Error Info
* @return array
*/
public function pdoErrorInfo()
{
return $this->_PDOConn->errorInfo();
}
}