MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
OCI8Connection.php
Ir para a documentação deste ficheiro.
1
<?php
2
/*
3
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
*
15
* This software consists of voluntary contributions made by many individuals
16
* and is licensed under the LGPL. For more information, see
17
* <http://www.doctrine-project.org>.
18
*/
19
20
namespace
Doctrine\DBAL\Driver\OCI8
;
21
27
class
OCI8Connection
implements
\Doctrine\DBAL\Driver\Connection
28
{
29
private
$_dbh;
30
31
private
$_executeMode = OCI_COMMIT_ON_SUCCESS;
32
40
public
function
__construct
($username, $password, $db,
$charset
=
null
, $sessionMode = OCI_DEFAULT)
41
{
42
if
(!defined(
'OCI_NO_AUTO_COMMIT'
)) {
43
define(
'OCI_NO_AUTO_COMMIT'
, 0);
44
}
45
46
$this->_dbh = @oci_connect($username, $password, $db,
$charset
, $sessionMode);
47
if
(!$this->_dbh) {
48
throw
OCI8Exception::fromErrorInfo
(oci_error());
49
}
50
}
51
58
public
function
prepare
($prepareString)
59
{
60
return
new
OCI8Statement
($this->_dbh, $prepareString, $this->_executeMode);
61
}
62
67
public
function
query
()
68
{
69
$args = func_get_args();
70
$sql = $args[0];
71
//$fetchMode = $args[1];
72
$stmt = $this->
prepare
($sql);
73
$stmt->execute();
74
return
$stmt;
75
}
76
84
public
function
quote
($input, $type=\PDO::PARAM_STR)
85
{
86
return
is_numeric($input) ? $input :
"'$input'"
;
87
}
88
94
public
function
exec
($statement)
95
{
96
$stmt = $this->
prepare
($statement);
97
$stmt->execute();
98
return
$stmt->rowCount();
99
}
100
101
public
function
lastInsertId
($name =
null
)
102
{
103
//TODO: throw exception or support sequences?
104
}
105
115
public
function
beginTransaction
()
116
{
117
$this->_executeMode = OCI_NO_AUTO_COMMIT;
118
return
true
;
119
}
120
125
public
function
commit
()
126
{
127
if
(!oci_commit($this->_dbh)) {
128
throw
OCI8Exception::fromErrorInfo
($this->
errorInfo
());
129
}
130
$this->_executeMode = OCI_COMMIT_ON_SUCCESS;
131
return
true
;
132
}
133
138
public
function
rollBack
()
139
{
140
if
(!oci_rollback($this->_dbh)) {
141
throw
OCI8Exception::fromErrorInfo
($this->
errorInfo
());
142
}
143
$this->_executeMode = OCI_COMMIT_ON_SUCCESS;
144
return
true
;
145
}
146
147
public
function
errorCode
()
148
{
149
$error = oci_error($this->_dbh);
150
if
($error !==
false
) {
151
$error = $error[
'code'
];
152
}
153
return
$error;
154
}
155
156
public
function
errorInfo
()
157
{
158
return
oci_error($this->_dbh);
159
}
160
}
Doctrine\DBAL\Driver\OCI8\OCI8Connection
Definição
OCI8Connection.php:28
Doctrine\DBAL\Driver\OCI8\OCI8Connection\__construct
__construct($username, $password, $db, $charset=null, $sessionMode=OCI_DEFAULT)
Definição
OCI8Connection.php:40
Doctrine\DBAL\Driver\OCI8\OCI8Connection\query
query()
Definição
OCI8Connection.php:67
Doctrine\DBAL\Driver\OCI8\OCI8Connection\errorCode
errorCode()
Definição
OCI8Connection.php:147
Doctrine\DBAL\Driver\OCI8\OCI8Connection\lastInsertId
lastInsertId($name=null)
Definição
OCI8Connection.php:101
Doctrine\DBAL\Driver\OCI8\OCI8Connection\exec
exec($statement)
Definição
OCI8Connection.php:94
Doctrine\DBAL\Driver\OCI8\OCI8Connection\errorInfo
errorInfo()
Definição
OCI8Connection.php:156
Doctrine\DBAL\Driver\OCI8\OCI8Connection\quote
quote($input, $type=\PDO::PARAM_STR)
Definição
OCI8Connection.php:84
Doctrine\DBAL\Driver\OCI8\OCI8Connection\prepare
prepare($prepareString)
Definição
OCI8Connection.php:58
Doctrine\DBAL\Driver\OCI8\OCI8Connection\rollBack
rollBack()
Definição
OCI8Connection.php:138
Doctrine\DBAL\Driver\OCI8\OCI8Connection\beginTransaction
beginTransaction()
Definição
OCI8Connection.php:115
Doctrine\DBAL\Driver\OCI8\OCI8Connection\commit
commit()
Definição
OCI8Connection.php:125
Doctrine\DBAL\Driver\OCI8\OCI8Exception\fromErrorInfo
static fromErrorInfo($error)
Definição
OCI8Exception.php:26
Doctrine\DBAL\Driver\OCI8\OCI8Statement
Definição
OCI8Statement.php:31
Doctrine\DBAL\Driver\Connection
Definição
Connection.php:31
Doctrine\DBAL\Driver\OCI8
Definição
Driver.php:22
$charset
$charset
Definição
base.php:7
classes
extensions
doctrine-dbal
Doctrine
DBAL
Driver
OCI8
OCI8Connection.php
Gerado por
1.10.0