Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
b8fb0fd8
Commit
b8fb0fd8
authored
Sep 12, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved connectionfactory. removed old adapters.
parent
b56d8da6
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
4 additions
and
2138 deletions
+4
-2138
Adapter.php
lib/Doctrine/Adapter.php
+0
-106
Db2.php
lib/Doctrine/Adapter/Db2.php
+0
-334
Exception.php
lib/Doctrine/Adapter/Db2/Exception.php
+0
-34
Exception.php
lib/Doctrine/Adapter/Exception.php
+0
-35
Interface.php
lib/Doctrine/Adapter/Interface.php
+0
-46
Mock.php
lib/Doctrine/Adapter/Mock.php
+0
-163
Mysqli.php
lib/Doctrine/Adapter/Mysqli.php
+0
-142
Oracle.php
lib/Doctrine/Adapter/Oracle.php
+0
-272
Resource.php
lib/Doctrine/Adapter/Resource.php
+0
-108
Statement.php
lib/Doctrine/Adapter/Statement.php
+0
-90
Interface.php
lib/Doctrine/Adapter/Statement/Interface.php
+0
-294
Mock.php
lib/Doctrine/Adapter/Statement/Mock.php
+0
-349
ConnectionFactory.php
lib/Doctrine/ConnectionFactory.php
+0
-112
Exception.php
lib/Doctrine/ConnectionFactory/Exception.php
+0
-49
EntityManager.php
lib/Doctrine/EntityManager.php
+2
-2
Doctrine_TestUtil.php
tests/lib/Doctrine_TestUtil.php
+2
-2
No files found.
lib/Doctrine/Adapter.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
*
* Doctrine_Adapter
*
* @package Doctrine
* @subpackage Adapter
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Remove.
*/
class
Doctrine_Adapter
{
const
ATTR_AUTOCOMMIT
=
0
;
const
ATTR_CASE
=
8
;
const
ATTR_CLIENT_VERSION
=
5
;
const
ATTR_CONNECTION_STATUS
=
7
;
const
ATTR_CURSOR
=
10
;
const
ATTR_CURSOR_NAME
=
9
;
const
ATTR_DRIVER_NAME
=
16
;
const
ATTR_ERRMODE
=
3
;
const
ATTR_FETCH_CATALOG_NAMES
=
15
;
const
ATTR_FETCH_TABLE_NAMES
=
14
;
const
ATTR_MAX_COLUMN_LEN
=
18
;
const
ATTR_ORACLE_NULLS
=
11
;
const
ATTR_PERSISTENT
=
12
;
const
ATTR_PREFETCH
=
1
;
const
ATTR_SERVER_INFO
=
6
;
const
ATTR_SERVER_VERSION
=
4
;
const
ATTR_STATEMENT_CLASS
=
13
;
const
ATTR_STRINGIFY_FETCHES
=
17
;
const
ATTR_TIMEOUT
=
2
;
const
CASE_LOWER
=
2
;
const
CASE_NATURAL
=
0
;
const
CASE_UPPER
=
1
;
const
CURSOR_FWDONLY
=
0
;
const
CURSOR_SCROLL
=
1
;
const
ERR_ALREADY_EXISTS
=
NULL
;
const
ERR_CANT_MAP
=
NULL
;
const
ERR_CONSTRAINT
=
NULL
;
const
ERR_DISCONNECTED
=
NULL
;
const
ERR_MISMATCH
=
NULL
;
const
ERR_NO_PERM
=
NULL
;
const
ERR_NONE
=
'00000'
;
const
ERR_NOT_FOUND
=
NULL
;
const
ERR_NOT_IMPLEMENTED
=
NULL
;
const
ERR_SYNTAX
=
NULL
;
const
ERR_TRUNCATED
=
NULL
;
const
ERRMODE_EXCEPTION
=
2
;
const
ERRMODE_SILENT
=
0
;
const
ERRMODE_WARNING
=
1
;
const
FETCH_ASSOC
=
2
;
const
FETCH_BOTH
=
4
;
const
FETCH_BOUND
=
6
;
const
FETCH_CLASS
=
8
;
const
FETCH_CLASSTYPE
=
262144
;
const
FETCH_COLUMN
=
7
;
const
FETCH_FUNC
=
10
;
const
FETCH_GROUP
=
65536
;
const
FETCH_INTO
=
9
;
const
FETCH_LAZY
=
1
;
const
FETCH_NAMED
=
11
;
const
FETCH_NUM
=
3
;
const
FETCH_OBJ
=
5
;
const
FETCH_ORI_ABS
=
4
;
const
FETCH_ORI_FIRST
=
2
;
const
FETCH_ORI_LAST
=
3
;
const
FETCH_ORI_NEXT
=
0
;
const
FETCH_ORI_PRIOR
=
1
;
const
FETCH_ORI_REL
=
5
;
const
FETCH_SERIALIZE
=
524288
;
const
FETCH_UNIQUE
=
196608
;
const
NULL_EMPTY_STRING
=
1
;
const
NULL_NATURAL
=
0
;
const
NULL_TO_STRING
=
NULL
;
const
PARAM_BOOL
=
5
;
const
PARAM_INPUT_OUTPUT
=
-
2147483648
;
const
PARAM_INT
=
1
;
const
PARAM_LOB
=
3
;
const
PARAM_NULL
=
0
;
const
PARAM_STMT
=
4
;
const
PARAM_STR
=
2
;
}
lib/Doctrine/Adapter/Db2.php
deleted
100644 → 0
View file @
b56d8da6
This diff is collapsed.
Click to expand it.
lib/Doctrine/Adapter/Db2/Exception.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine
::
autoload
(
'Doctrine_Adapter_Exception'
);
/**
* Doctrine_Adapter_Db2_Exception
*
* @package Doctrine
* @subpackage Adapter
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_Adapter_Db2_Exception
extends
Doctrine_Adapter_Exception
{
}
lib/Doctrine/Adapter/Exception.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Exception
*
* @package Doctrine
* @subpackage Adapter
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class
Doctrine_Adapter_Exception
extends
Doctrine_Exception
{
}
lib/Doctrine/Adapter/Interface.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Interface
* This adapter interface should be implemented by all custom adapters
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @deprecated
*/
interface
Doctrine_Adapter_Interface
{
public
function
prepare
(
$prepareString
);
public
function
query
(
$queryString
);
public
function
quote
(
$input
);
public
function
exec
(
$statement
);
public
function
lastInsertId
();
public
function
beginTransaction
();
public
function
commit
();
public
function
rollBack
();
public
function
errorCode
();
public
function
errorInfo
();
}
lib/Doctrine/Adapter/Mock.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Mock
* This class is used for special testing purposes.
*
* @package Doctrine
* @subpackage Adapter
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @deprecated
*/
class
Doctrine_Adapter_Mock
implements
Doctrine_Adapter_Interface
,
Countable
{
private
$name
;
private
$queries
=
array
();
private
$exception
=
array
();
private
$lastInsertIdFail
=
false
;
public
function
__construct
(
$name
=
null
)
{
$this
->
name
=
$name
;
}
public
function
getName
()
{
return
$this
->
name
;
}
public
function
pop
()
{
return
array_pop
(
$this
->
queries
);
}
public
function
forceException
(
$name
,
$message
=
''
,
$code
=
0
)
{
$this
->
exception
=
array
(
$name
,
$message
,
$code
);
}
public
function
prepare
(
$query
)
{
$mock
=
new
Doctrine_Adapter_Statement_Mock
(
$this
,
$query
);
$mock
->
queryString
=
$query
;
return
$mock
;
}
public
function
addQuery
(
$query
)
{
$this
->
queries
[]
=
$query
;
}
public
function
query
(
$query
)
{
$this
->
queries
[]
=
$query
;
$e
=
$this
->
exception
;
if
(
!
empty
(
$e
))
{
$name
=
$e
[
0
];
$this
->
exception
=
array
();
throw
new
$name
(
$e
[
1
],
$e
[
2
]);
}
$stmt
=
new
Doctrine_Adapter_Statement_Mock
(
$this
,
$query
);
$stmt
->
queryString
=
$query
;
return
$stmt
;
}
public
function
getAll
()
{
return
$this
->
queries
;
}
public
function
quote
(
$input
)
{
return
"'"
.
addslashes
(
$input
)
.
"'"
;
}
public
function
exec
(
$statement
)
{
$this
->
queries
[]
=
$statement
;
$e
=
$this
->
exception
;
if
(
!
empty
(
$e
))
{
$name
=
$e
[
0
];
$this
->
exception
=
array
();
throw
new
$name
(
$e
[
1
],
$e
[
2
]);
}
return
0
;
}
public
function
forceLastInsertIdFail
(
$fail
=
true
)
{
if
(
$fail
)
{
$this
->
lastInsertIdFail
=
true
;
}
else
{
$this
->
lastInsertIdFail
=
false
;
}
}
public
function
lastInsertId
()
{
$this
->
queries
[]
=
'LAST_INSERT_ID()'
;
if
(
$this
->
lastInsertIdFail
)
{
return
null
;
}
else
{
return
1
;
}
}
public
function
count
()
{
return
count
(
$this
->
queries
);
}
public
function
beginTransaction
()
{
$this
->
queries
[]
=
'BEGIN TRANSACTION'
;
}
public
function
commit
()
{
$this
->
queries
[]
=
'COMMIT'
;
}
public
function
rollBack
()
{
$this
->
queries
[]
=
'ROLLBACK'
;
}
public
function
errorCode
()
{
}
public
function
errorInfo
()
{
}
public
function
getAttribute
(
$attribute
)
{
if
(
$attribute
==
Doctrine
::
ATTR_DRIVER_NAME
)
return
strtolower
(
$this
->
name
);
}
public
function
setAttribute
(
$attribute
,
$value
)
{
}
public
function
sqliteCreateFunction
()
{
}
}
lib/Doctrine/Adapter/Mysqli.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id: Mock.php 1080 2007-02-10 18:17:08Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Mysqli
* This class is used for special testing purposes.
*
* @package Doctrine
* @subpackage Adapter
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @deprecated
*/
class
Doctrine_Adapter_Mysqli
extends
Doctrine_Adapter
{
/**
* Creates a connection to the database.
*
* @return void
* @throws Doctrine_Adapter_Mysqli_Exception
*/
protected
function
_connect
()
{
if
(
$this
->
_connection
)
{
return
;
}
// Suppress connection warnings here.
// Throw an exception instead.
@
$this
->
_connection
=
new
mysqli
(
$this
->
_config
[
'host'
],
$this
->
_config
[
'username'
],
$this
->
_config
[
'password'
],
$this
->
_config
[
'dbname'
]
);
if
(
$this
->
_connection
===
false
||
mysqli_connect_errno
())
{
throw
new
Doctrine_Adapter_Mysqli_Exception
(
mysqli_connect_error
());
}
}
/**
* Force the connection to close.
*
* @return void
*/
public
function
closeConnection
()
{
$this
->
_connection
->
close
();
$this
->
_connection
=
null
;
}
/**
* Prepare a statement and return a PDOStatement-like object.
*
* @param string $sql SQL query
* @return Doctrine_Statement_Mysqli
*/
public
function
prepare
(
$sql
)
{
$this
->
_connect
();
$stmt
=
new
Doctrine_Statement_Mysqli
(
$this
,
$sql
);
$stmt
->
setFetchMode
(
$this
->
_fetchMode
);
return
$stmt
;
}
/**
* Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
*
* As a convention, on RDBMS brands that support sequences
* (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence
* from the arguments and returns the last id generated by that sequence.
* On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method
* returns the last value generated for such a column, and the table name
* argument is disregarded.
*
* MySQL does not support sequences, so $tableName and $primaryKey are ignored.
*
* @param string $tableName OPTIONAL Name of table.
* @param string $primaryKey OPTIONAL Name of primary key column.
* @return integer
*/
public
function
lastInsertId
(
$tableName
=
null
,
$primaryKey
=
null
)
{
$mysqli
=
$this
->
_connection
;
return
$mysqli
->
insert_id
;
}
/**
* Begin a transaction.
*
* @return void
*/
protected
function
_beginTransaction
()
{
$this
->
_connect
();
$this
->
_connection
->
autocommit
(
false
);
}
/**
* Commit a transaction.
*
* @return void
*/
protected
function
_commit
()
{
$this
->
_connect
();
$this
->
_connection
->
commit
();
$this
->
_connection
->
autocommit
(
true
);
}
/**
* Roll-back a transaction.
*
* @return void
*/
protected
function
_rollBack
()
{
$this
->
_connect
();
$this
->
_connection
->
rollback
();
$this
->
_connection
->
autocommit
(
true
);
}
}
lib/Doctrine/Adapter/Oracle.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id: Mock.php 1080 2007-02-10 18:17:08Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine
::
autoload
(
'Doctrine_Adapter'
);
/**
* Doctrine_Adapter_Oracle
* [BORROWED FROM ZEND FRAMEWORK]
*
* @package Doctrine
* @subpackage Adapter
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
*/
class
Doctrine_Adapter_Oracle
extends
Doctrine_Adapter
{
/**
* User-provided configuration.
*
* Basic keys are:
*
* username => (string) Connect to the database as this username.
* password => (string) Password associated with the username.
* dbname => Either the name of the local Oracle instance, or the
* name of the entry in tnsnames.ora to which you want to connect.
*
* @var array
*/
protected
$_config
=
array
(
'dbname'
=>
null
,
'username'
=>
null
,
'password'
=>
null
,
);
/**
* @var integer
*/
protected
$_execute_mode
=
OCI_COMMIT_ON_SUCCESS
;
/**
* Constructor.
*
* $config is an array of key/value pairs containing configuration
* options. These options are common to most adapters:
*
* username => (string) Connect to the database as this username.
* password => (string) Password associated with the username.
* dbname => Either the name of the local Oracle instance, or the
* name of the entry in tnsnames.ora to which you want to connect.
*
* @param array $config An array of configuration keys.
* @throws Doctrine_Adapter_Exception
*/
public
function
__construct
(
array
$config
)
{
if
(
!
isset
(
$config
[
'password'
])
||
!
isset
(
$config
[
'username'
]))
{
throw
new
Doctrine_Adapter_Exception
(
'config array must have at least a username and a password'
);
}
// @todo Let this protect backward-compatibility for one release, then remove
if
(
!
isset
(
$config
[
'database'
])
||
!
isset
(
$config
[
'dbname'
]))
{
$config
[
'dbname'
]
=
$config
[
'database'
];
unset
(
$config
[
'database'
]);
trigger_error
(
"Deprecated config key 'database', use 'dbname' instead."
,
E_USER_NOTICE
);
}
// keep the config
$this
->
_config
=
array_merge
(
$this
->
_config
,
(
array
)
$config
);
// create a profiler object
$enabled
=
false
;
if
(
array_key_exists
(
'profiler'
,
$this
->
_config
))
{
$enabled
=
(
bool
)
$this
->
_config
[
'profiler'
];
unset
(
$this
->
_config
[
'profiler'
]);
}
$this
->
_profiler
=
new
Doctrine_Profiler
(
$enabled
);
}
/**
* Creates a connection resource.
*
* @return void
* @throws Doctrine_Adapter_Oracle_Exception
*/
protected
function
_connect
()
{
if
(
is_resource
(
$this
->
_connection
))
{
// connection already exists
return
;
}
if
(
!
extension_loaded
(
'oci8'
))
{
throw
new
Doctrine_Adapter_Oracle_Exception
(
'The OCI8 extension is required for this adapter but not loaded'
);
}
if
(
isset
(
$this
->
_config
[
'dbname'
]))
{
$this
->
_connection
=
@
oci_connect
(
$this
->
_config
[
'username'
],
$this
->
_config
[
'password'
],
$this
->
_config
[
'dbname'
]);
}
else
{
$this
->
_connection
=
oci_connect
(
$this
->
_config
[
'username'
],
$this
->
_config
[
'password'
]);
}
// check the connection
if
(
!
$this
->
_connection
)
{
throw
new
Doctrine_Adapter_Oracle_Exception
(
oci_error
());
}
}
/**
* Force the connection to close.
*
* @return void
*/
public
function
closeConnection
()
{
if
(
is_resource
(
$this
->
_connection
))
{
oci_close
(
$this
->
_connection
);
}
$this
->
_connection
=
null
;
}
/**
* Returns an SQL statement for preparation.
*
* @param string $sql The SQL statement with placeholders.
* @return Doctrine_Statement_Oracle
*/
public
function
prepare
(
$sql
)
{
$this
->
_connect
();
$stmt
=
new
Doctrine_Statement_Oracle
(
$this
,
$sql
);
$stmt
->
setFetchMode
(
$this
->
_fetchMode
);
return
$stmt
;
}
/**
* Quote a raw string.
*
* @param string $value Raw string
* @return string Quoted string
*/
protected
function
_quote
(
$value
)
{
$value
=
str_replace
(
"'"
,
"''"
,
$value
);
return
"'"
.
addcslashes
(
$value
,
"
\000\n\r\\\032
"
)
.
"'"
;
}
/**
* Quote a table identifier and alias.
*
* @param string|array|Doctrine_Expr $ident The identifier or expression.
* @param string $alias An alias for the table.
* @return string The quoted identifier and alias.
*/
public
function
quoteTableAs
(
$ident
,
$alias
)
{
// Oracle doesn't allow the 'AS' keyword between the table identifier/expression and alias.
return
$this
->
_quoteIdentifierAs
(
$ident
,
$alias
,
' '
);
}
/**
* Leave autocommit mode and begin a transaction.
*
* @return void
*/
protected
function
_beginTransaction
()
{
$this
->
_setExecuteMode
(
OCI_DEFAULT
);
}
/**
* Commit a transaction and return to autocommit mode.
*
* @return void
* @throws Doctrine_Adapter_Oracle_Exception
*/
protected
function
_commit
()
{
if
(
!
oci_commit
(
$this
->
_connection
))
{
throw
new
Doctrine_Adapter_Oracle_Exception
(
oci_error
(
$this
->
_connection
));
}
$this
->
_setExecuteMode
(
OCI_COMMIT_ON_SUCCESS
);
}
/**
* Roll back a transaction and return to autocommit mode.
*
* @return void
* @throws Doctrine_Adapter_Oracle_Exception
*/
protected
function
_rollBack
()
{
if
(
!
oci_rollback
(
$this
->
_connection
))
{
throw
new
Doctrine_Adapter_Oracle_Exception
(
oci_error
(
$this
->
_connection
));
}
$this
->
_setExecuteMode
(
OCI_COMMIT_ON_SUCCESS
);
}
/**
* Set the fetch mode.
*
* @todo Support FETCH_CLASS and FETCH_INTO.
*
* @param integer $mode A fetch mode.
* @return void
* @throws Doctrine_Adapter_Exception
*/
public
function
setFetchMode
(
$mode
)
{
switch
(
$mode
)
{
case
Doctrine
::
FETCH_NUM
:
// seq array
case
Doctrine
::
FETCH_ASSOC
:
// assoc array
case
Doctrine
::
FETCH_BOTH
:
// seq+assoc array
case
Doctrine
::
FETCH_OBJ
:
// object
$this
->
_fetchMode
=
$mode
;
break
;
default
:
throw
new
Doctrine_Adapter_Exception
(
'Invalid fetch mode specified'
);
break
;
}
}
/**
* @param integer $mode
* @throws Doctrine_Adapter_Exception
*/
private
function
_setExecuteMode
(
$mode
)
{
switch
(
$mode
)
{
case
OCI_COMMIT_ON_SUCCESS
:
case
OCI_DEFAULT
:
case
OCI_DESCRIBE_ONLY
:
$this
->
_execute_mode
=
$mode
;
break
;
default
:
throw
new
Doctrine_Adapter_Exception
(
'wrong execution mode specified'
);
break
;
}
}
/**
* @return
*/
public
function
_getExecuteMode
()
{
return
$this
->
_execute_mode
;
}
}
lib/Doctrine/Adapter/Resource.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Resource
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2702 $
* @deprecated
* @todo Remove
*/
class
Doctrine_Adapter_Resource
implements
Doctrine_Adapter_Interface
{
protected
$resourceUrl
;
public
function
__construct
(
$resourceUrl
)
{
$this
->
resourceUrl
=
$resourceUrl
;
}
public
function
prepare
(
$sql
)
{
}
public
function
query
(
$sql
)
{
}
public
function
quote
(
$input
)
{
}
public
function
exec
(
$sql
)
{
}
public
function
lastInsertId
()
{
}
public
function
beginTransaction
()
{
}
public
function
commit
()
{
}
public
function
rollBack
()
{
}
public
function
errorCode
()
{
}
public
function
errorInfo
()
{
}
public
function
getAttribute
()
{
return
'sqlite'
;
}
public
function
setAttribute
()
{
}
public
function
sqliteCreateFunction
()
{
}
}
\ No newline at end of file
lib/Doctrine/Adapter/Statement.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Adapter_Statement
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
*/
abstract
class
Doctrine_Adapter_Statement
{
public
function
bindValue
(
$no
,
$value
)
{
}
/**
* fetch
*
* @see Doctrine::FETCH_* constants
* @param integer $fetchStyle Controls how the next row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_* constants,
* defaulting to Doctrine::FETCH_BOTH
*
* @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller.
* This value must be one of the Doctrine::FETCH_ORI_* constants, defaulting to
* Doctrine::FETCH_ORI_NEXT. To request a scrollable cursor for your
* Doctrine_Adapter_Statement_Interface object,
* you must set the Doctrine::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
* prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
*
* @param integer $cursorOffset For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the
* $cursorOrientation parameter is set to Doctrine::FETCH_ORI_ABS, this value specifies
* the absolute number of the row in the result set that shall be fetched.
*
* For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for
* which the $cursorOrientation parameter is set to Doctrine::FETCH_ORI_REL, this value
* specifies the row to fetch relative to the cursor position before
* Doctrine_Adapter_Statement_Interface->fetch() was called.
*
* @return mixed
*/
public
function
fetch
()
{
}
public
function
nextRowset
()
{
}
public
function
execute
()
{
}
public
function
errorCode
()
{
}
public
function
errorInfo
()
{
}
public
function
rowCount
()
{
}
public
function
setFetchMode
(
$mode
)
{
}
public
function
columnCount
()
{
}
}
lib/Doctrine/Adapter/Statement/Interface.php
deleted
100644 → 0
View file @
b56d8da6
This diff is collapsed.
Click to expand it.
lib/Doctrine/Adapter/Statement/Mock.php
deleted
100644 → 0
View file @
b56d8da6
This diff is collapsed.
Click to expand it.
lib/Doctrine/ConnectionFactory.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::DBAL;
/**
* Factory for creating dbms-specific Connection instances.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
class
Doctrine_ConnectionFactory
{
/**
* List of supported drivers and their mappings to the driver class.
*
* @var array
*/
private
$_drivers
=
array
(
'mysql'
=>
'Doctrine_Connection_Mysql'
,
'sqlite'
=>
'Doctrine_Connection_Sqlite'
,
'pgsql'
=>
'Doctrine_Connection_Pgsql'
,
'oci'
=>
'Doctrine_Connection_Oracle'
,
'oci8'
=>
'Doctrine_Connection_Oracle'
,
'oracle'
=>
'Doctrine_Connection_Oracle'
,
'mssql'
=>
'Doctrine_Connection_Mssql'
,
'dblib'
=>
'Doctrine_Connection_Mssql'
,
'firebird'
=>
'Doctrine_Connection_Firebird'
,
'informix'
=>
'Doctrine_Connection_Informix'
,
);
public
function
__construct
()
{
}
/**
* Creates a connection object with the specified parameters.
*
* @param array $params
* @return Connection
*/
public
function
createConnection
(
array
$params
,
Doctrine_Common_Configuration
$config
=
null
,
Doctrine_Common_EventManager
$eventManager
=
null
)
{
// create default config and event manager, if not set
if
(
!
$config
)
{
$config
=
new
Doctrine_Common_Configuration
();
}
if
(
!
$eventManager
)
{
$eventManager
=
new
Doctrine_Common_EventManager
();
}
// check for existing pdo object
if
(
isset
(
$params
[
'pdo'
])
&&
!
$params
[
'pdo'
]
instanceof
PDO
)
{
throw
Doctrine_ConnectionFactory_Exception
::
invalidPDOInstance
();
}
else
if
(
isset
(
$params
[
'pdo'
]))
{
$params
[
'driver'
]
=
$params
[
'pdo'
]
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
);
}
else
{
$this
->
_checkParams
(
$params
);
}
if
(
isset
(
$params
[
'driverClass'
]))
{
$className
=
$params
[
'driverClass'
];
}
else
{
$className
=
$this
->
_drivers
[
$params
[
'driver'
]];
}
return
new
$className
(
$params
,
$config
,
$eventManager
);
}
/**
* Checks the list of parameters.
*
* @param array $params
*/
private
function
_checkParams
(
array
$params
)
{
// check existance of mandatory parameters
// driver
if
(
!
isset
(
$params
[
'driver'
])
&&
!
isset
(
$params
[
'driverClass'
]))
{
throw
Doctrine_ConnectionFactory_Exception
::
driverRequired
();
}
// check validity of parameters
// driver
if
(
isset
(
$params
[
'driver'
])
&&
!
isset
(
$this
->
_drivers
[
$params
[
'driver'
]]))
{
throw
Doctrine_ConnectionFactory_Exception
::
unknownDriver
(
$params
[
'driver'
]);
}
}
}
?>
\ No newline at end of file
lib/Doctrine/ConnectionFactory/Exception.php
deleted
100644 → 0
View file @
b56d8da6
<?php
/*
* $Id: Exception.php 1080 2007-02-10 18:17:08Z romanb $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_ConnectionFactory_Exception
*
* @package Doctrine
* @subpackage Hydrate
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_ConnectionFactory_Exception
extends
Doctrine_Exception
{
public
static
function
invalidPDOInstance
()
{
return
new
self
(
"Invalid PDO instance provided on connection creation."
);
}
public
static
function
driverRequired
()
{
return
new
self
(
"Please provide a driver or a driverClass to be able to start a Connection."
);
}
public
static
function
unknownDriver
(
$driver
)
{
return
new
self
(
"Unknown Connection driver '
$driver
'."
);
}
}
\ No newline at end of file
lib/Doctrine/EntityManager.php
View file @
b8fb0fd8
...
...
@@ -702,8 +702,8 @@ class Doctrine_EntityManager
Doctrine_EventManager
$eventManager
=
null
)
{
if
(
is_array
(
$conn
))
{
$connFactory
=
new
Doctrine_
ConnectionFactory
();
$conn
=
$connFactory
->
create
Connection
(
$conn
,
$config
,
$eventManager
);
$connFactory
=
new
Doctrine_
DBAL_DriverManager
();
$conn
=
$connFactory
->
get
Connection
(
$conn
,
$config
,
$eventManager
);
}
else
if
(
!
$conn
instanceof
Doctrine_Connection
)
{
throw
new
Doctrine_Exception
(
"Invalid parameter '
$conn
'."
);
}
...
...
tests/lib/Doctrine_TestUtil.php
View file @
b8fb0fd8
...
...
@@ -4,7 +4,7 @@ class Doctrine_TestUtil
{
public
static
function
getConnection
()
{
$connFactory
=
new
Doctrine_
ConnectionFactory
();
$connFactory
=
new
Doctrine_
DBAL_DriverManager
();
if
(
isset
(
$GLOBALS
[
'db_type'
],
$GLOBALS
[
'db_username'
],
$GLOBALS
[
'db_password'
],
$GLOBALS
[
'db_host'
],
$GLOBALS
[
'db_name'
]))
{
...
...
@@ -24,7 +24,7 @@ class Doctrine_TestUtil
);
}
return
$connFactory
->
create
Connection
(
$params
);
return
$connFactory
->
get
Connection
(
$params
);
}
/*
public static function autoloadModel($className)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment