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
3cd4fc55
Commit
3cd4fc55
authored
Aug 02, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Intermediate checkin.
parent
e704cd0f
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
790 additions
and
880 deletions
+790
-880
ActiveEntity.php
lib/Doctrine/ActiveEntity.php
+455
-0
Configuration.php
lib/Doctrine/Configuration.php
+2
-2
Connection.php
lib/Doctrine/Connection.php
+34
-95
Mock.php
lib/Doctrine/Connection/Mock.php
+4
-1
Statement.php
lib/Doctrine/Connection/Statement.php
+29
-53
DatabasePlatform.php
lib/Doctrine/DatabasePlatform.php
+87
-48
FirebirdPlatform.php
lib/Doctrine/DatabasePlatform/FirebirdPlatform.php
+0
-20
MsSqlPlatform.php
lib/Doctrine/DatabasePlatform/MsSqlPlatform.php
+0
-18
MySqlPlatform.php
lib/Doctrine/DatabasePlatform/MySqlPlatform.php
+40
-42
OraclePlatform.php
lib/Doctrine/DatabasePlatform/OraclePlatform.php
+3
-20
PostgreSqlPlatform.php
lib/Doctrine/DatabasePlatform/PostgreSqlPlatform.php
+36
-26
SqlitePlatform.php
lib/Doctrine/DatabasePlatform/SqlitePlatform.php
+0
-20
Entity.php
lib/Doctrine/Entity.php
+28
-479
RecordDriver.php
lib/Doctrine/Hydrator/RecordDriver.php
+8
-8
Parser.php
lib/Doctrine/Query/Parser.php
+0
-1
Atom.php
lib/Doctrine/Query/Production/Atom.php
+17
-16
Scanner.php
lib/Doctrine/Query/Scanner.php
+30
-15
Parser.php
lib/Doctrine/Relation/Parser.php
+2
-1
Mysql.php
lib/Doctrine/Sequence/Mysql.php
+4
-4
Oracle.php
lib/Doctrine/Sequence/Oracle.php
+4
-4
AccessorTest.php
tests/Orm/Entity/AccessorTest.php
+4
-6
SelectSqlGenerationTest.php
tests/Orm/Query/SelectSqlGenerationTest.php
+3
-1
No files found.
lib/Doctrine/ActiveEntity.php
0 → 100644
View file @
3cd4fc55
This diff is collapsed.
Click to expand it.
lib/Doctrine/Configuration.php
View file @
3cd4fc55
...
...
@@ -63,13 +63,13 @@ class Doctrine_Configuration
/**
* Initializes the attributes.
* Changes null default values to references to the Null object to allow
* fast isset() checks instead of array_key_exists().
*
* @return void
*/
private
function
_initAttributes
()
{
// Change null default values to references to the Null object to allow
// fast isset() checks instead of array_key_exists().
foreach
(
$this
->
_attributes
as
$key
=>
$value
)
{
if
(
$value
===
null
)
{
$this
->
_attributes
[
$key
]
=
$this
->
_nullObject
;
...
...
lib/Doctrine/Connection.php
View file @
3cd4fc55
...
...
@@ -26,7 +26,7 @@
#use Doctrine::DBAL::Exceptions::ConnectionException;
/**
* A thin
connection wrapper on top of PDO
.
* A thin
wrapper on top of the PDO class
.
*
* 1. Event listeners
* An easy to use, pluggable eventlistener architecture. Aspects such as
...
...
@@ -117,9 +117,9 @@ abstract class Doctrine_Connection
protected
$_quoteIdentifiers
;
/**
* @var array
$serverInfo
* @var array
*/
protected
$serverInfo
=
array
();
protected
$
_
serverInfo
=
array
();
/**
* The parameters used during creation of the Connection.
...
...
@@ -154,11 +154,18 @@ abstract class Doctrine_Connection
protected
$_platform
;
/**
*
Enter description here..
.
*
The transaction object
.
*
* @var Doctrine::DBAL::Transactions::Transaction
*/
protected
$_transaction
;
/**
* The sequence manager.
*
* @var Doctrine::DBAL::Sequencing::SequenceManager
*/
protected
$_sequenceManager
;
/**
* Constructor.
...
...
@@ -339,20 +346,13 @@ abstract class Doctrine_Connection
*
* @return string
* @todo make abstract, implement in subclasses.
* @todo throw different exception?
*/
protected
function
_constructPdoDsn
()
{
throw
Doctrine_Exception
::
notImplemented
(
'_constructPdoDsn'
,
get_class
(
$this
));
}
/**
* @todo Remove. Breaks encapsulation.
*/
public
function
incrementQueryCount
()
{
$this
->
_queryCount
++
;
}
/**
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
* query, except that if there is already a row in the table with the same
...
...
@@ -360,8 +360,8 @@ abstract class Doctrine_Connection
* inserting a new row.
*
* The REPLACE type of query does not make part of the SQL standards. Since
* practically only MySQL and SQL
I
te implement it natively, this type of
* query isemulated through this method for other DBMS using standard types
* practically only MySQL and SQL
i
te implement it natively, this type of
* query is
emulated through this method for other DBMS using standard types
* of queries inside a transaction to assure the atomicity of the operation.
*
* @param string name of the table on which the REPLACE query will
...
...
@@ -490,7 +490,7 @@ abstract class Doctrine_Connection
// column names are specified as array keys
$cols
=
array
();
// the query VALUES will contain either expresions (eg 'NOW()') or ?
// the query VALUES will contain either expres
s
ions (eg 'NOW()') or ?
$a
=
array
();
foreach
(
$data
as
$columnName
=>
$value
)
{
$cols
[]
=
$this
->
quoteIdentifier
(
$columnName
);
...
...
@@ -502,13 +502,10 @@ abstract class Doctrine_Connection
}
}
// build the statement
$query
=
'INSERT INTO '
.
$this
->
quoteIdentifier
(
$tableName
)
.
' ('
.
implode
(
', '
,
$cols
)
.
') '
.
'VALUES ('
;
$query
.=
implode
(
', '
,
$a
)
.
')'
;
// prepare and execute the statement
return
$this
->
exec
(
$query
,
array_values
(
$data
));
}
...
...
@@ -567,14 +564,15 @@ abstract class Doctrine_Connection
// quick fix for the identifiers that contain a dot
if
(
strpos
(
$str
,
'.'
))
{
$e
=
explode
(
'.'
,
$str
);
return
$this
->
quoteIdentifier
(
$e
[
0
])
.
'.'
return
$this
->
quoteIdentifier
(
$e
[
0
])
.
'.'
.
$this
->
quoteIdentifier
(
$e
[
1
]);
}
$q
=
$this
->
properties
[
'identifier_quoting'
];
$str
=
str_replace
(
$q
[
'end'
],
$q
[
'escape'
]
.
$q
[
'end'
],
$str
);
return
$q
[
'start'
]
.
$str
.
$q
[
'end'
];
$c
=
$this
->
_platform
->
getIdentifierQuoteCharacter
();
$str
=
str_replace
(
$c
,
$c
.
$c
,
$str
);
return
$c
.
$str
.
$c
;
}
/**
...
...
@@ -603,55 +601,16 @@ abstract class Doctrine_Connection
}
/**
* Quotes given input parameter
* Quotes given input parameter
.
*
* @param mixed $input
parameter to be quoted
* @param string $type
* @return
mixed
* @param mixed $input
Parameter to be quoted.
* @param string $type
Type of the parameter.
* @return
string The quoted parameter.
*/
public
function
quote
(
$input
,
$type
=
null
)
{
return
$this
->
_pdo
->
quote
(
$input
,
$type
);
}
/**
* quote
* quotes given input parameter
*
* @param mixed $input parameter to be quoted
* @param string $type
* @return mixed
*/
/*public function quote($input, $type = null)
{
if ($type == null) {
$type = gettype($input);
}
switch ($type) {
case 'integer':
case 'enum':
case 'boolean':
case 'double':
case 'float':
case 'bool':
case 'decimal':
case 'int':
return $input;
case 'array':
case 'object':
$input = serialize($input);
case 'date':
case 'time':
case 'timestamp':
case 'string':
case 'char':
case 'varchar':
case 'text':
case 'gzip':
case 'blob':
case 'clob':
return $this->conn->quote($input);
}
}*/
/**
* Set the date/time format for the current connection
...
...
@@ -882,21 +841,14 @@ abstract class Doctrine_Connection
* @throws Doctrine_Connection_Exception
*/
public
function
rethrowException
(
Exception
$e
,
$invoker
)
{
//$event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR);
//$this->getListener()->preError($event);
{
$name
=
'Doctrine_Connection_'
.
$this
->
_driverName
.
'_Exception'
;
$exc
=
new
$name
(
$e
->
getMessage
(),
(
int
)
$e
->
getCode
());
if
(
!
is_array
(
$e
->
errorInfo
))
{
$e
->
errorInfo
=
array
(
null
,
null
,
null
,
null
);
}
$exc
->
processErrorInfo
(
$e
->
errorInfo
);
throw
$exc
;
//$this->getListener()->postError($event);
}
/**
...
...
@@ -1007,7 +959,7 @@ abstract class Doctrine_Connection
*/
public
function
commit
(
$savepoint
=
null
)
{
return
$this
->
transaction
->
commit
(
$savepoint
);
return
$this
->
_
transaction
->
commit
(
$savepoint
);
}
/**
...
...
@@ -1025,7 +977,7 @@ abstract class Doctrine_Connection
*/
public
function
rollback
(
$savepoint
=
null
)
{
$this
->
transaction
->
rollback
(
$savepoint
);
$this
->
_
transaction
->
rollback
(
$savepoint
);
}
/**
...
...
@@ -1202,31 +1154,18 @@ abstract class Doctrine_Connection
return
Doctrine_Lib
::
getConnectionAsString
(
$this
);
}
/*
* ----------- Mixed methods (need to figure out where they go) ---------------
*/
/**
* retrieves a database connection attribute
* Gets the SequenceManager that can be used to retrieve sequence values
* through this connection.
*
* @param integer $attribute
* @return mixed
* @todo Implementation or remove if not needed. Configuration is the main
* container for all the attributes now.
* @return Doctrine::DBAL::Sequencing::SequenceManager
*/
public
function
getAttribute
(
$attribute
)
{
if
(
$attribute
==
Doctrine
::
ATTR_QUOTE_IDENTIFIER
)
{
return
false
;
}
}
public
function
getSequenceManager
()
{
if
(
!
$this
->
modules
[
'sequence'
]
)
{
if
(
!
$this
->
_sequenceManager
)
{
$class
=
"Doctrine_Sequence_"
.
$this
->
_driverName
;
$this
->
modules
[
'sequence'
]
=
new
$class
;
$this
->
_sequenceManager
=
new
$class
;
}
return
$this
->
modules
[
'sequence'
]
;
return
$this
->
_sequenceManager
;
}
}
lib/Doctrine/Connection/Mock.php
View file @
3cd4fc55
...
...
@@ -58,7 +58,10 @@ class Doctrine_Connection_Mock extends Doctrine_Connection_Common
}
public
function
quote
(
$input
,
$type
=
null
)
{
{
if
(
$type
===
'string'
)
{
return
"'"
.
$input
.
"'"
;
}
return
$input
;
}
}
\ No newline at end of file
lib/Doctrine/Connection/Statement.php
View file @
3cd4fc55
...
...
@@ -18,12 +18,10 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine
::
autoload
(
'Doctrine_Adapter_Statement_Interface'
);
/**
*
Doctrine_Connection_Statement
*
A thin wrapper around PDOStatement.
*
* @package Doctrine
* @subpackage Connection
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
...
...
@@ -31,7 +29,7 @@ Doctrine::autoload('Doctrine_Adapter_Statement_Interface');
* @version $Revision: 1532 $
* @todo Do we seriously need this wrapper?
*/
class
Doctrine_Connection_Statement
implements
Doctrine_Adapter_Statement_Interface
class
Doctrine_Connection_Statement
{
/**
* @var Doctrine_Connection $conn Doctrine_Connection object, every connection
...
...
@@ -40,7 +38,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
protected
$_conn
;
/**
* @var
mixed
$_stmt PDOStatement object, boolean false or Doctrine_Adapter_Statement object
* @var
PDOStatement
$_stmt PDOStatement object, boolean false or Doctrine_Adapter_Statement object
*/
protected
$_stmt
;
...
...
@@ -81,7 +79,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* bindColumn
* Bind a column to a PHP variable
*
* @param mixed $column Number of the column (1-indexed) or name of the column in the result set.
...
...
@@ -125,7 +122,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* bindParam
* Binds a PHP variable to a corresponding named or question mark placeholder in the
* SQL statement that was use to prepare the statement. Unlike Doctrine_Adapter_Statement_Interface->bindValue(),
* the variable is bound as a reference and will only be evaluated at the time
...
...
@@ -161,7 +157,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* closeCursor
* Closes the cursor, enabling the statement to be executed again.
*
* @return boolean Returns TRUE on success or FALSE on failure.
...
...
@@ -172,7 +167,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* columnCount
* Returns the number of columns in the result set
*
* @return integer Returns the number of columns in the result set represented
...
...
@@ -185,7 +179,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* errorCode
* Fetch the SQLSTATE associated with the last operation on the statement handle
*
* @see Doctrine_Adapter_Interface::errorCode()
...
...
@@ -197,7 +190,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* errorInfo
* Fetch extended error information associated with the last operation on the statement handle
*
* @see Doctrine_Adapter_Interface::errorInfo()
...
...
@@ -209,7 +201,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* execute
* Executes a prepared statement
*
* If the prepared statement included parameter markers, you must either:
...
...
@@ -226,24 +217,22 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
public
function
execute
(
$params
=
null
)
{
try
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
STMT_EXECUTE
,
$this
->
getQuery
(),
$params
);
$this
->
_conn
->
getListener
()
->
preStmtExecute
(
$event
);
//
$event = new Doctrine_Event($this, Doctrine_Event::STMT_EXECUTE, $this->getQuery(), $params);
//
$this->_conn->getListener()->preStmtExecute($event);
$result
=
true
;
if
(
!
$event
->
skipOperation
)
{
//
if ( ! $event->skipOperation) {
$result
=
$this
->
_stmt
->
execute
(
$params
);
$this
->
_conn
->
incrementQueryCount
();
}
//
$this->_conn->incrementQueryCount();
//
}
$this
->
_conn
->
getListener
()
->
postStmtExecute
(
$event
);
//
$this->_conn->getListener()->postStmtExecute($event);
return
$result
;
}
catch
(
PDOException
$e
)
{
}
catch
(
Doctrine_Adapter_Exception
$e
)
{
}
catch
(
PDOException
$e
)
{
$this
->
_conn
->
rethrowException
(
$e
,
$this
);
}
$this
->
_conn
->
rethrowException
(
$e
,
$this
);
return
false
;
}
...
...
@@ -278,25 +267,23 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
$cursorOrientation
=
Doctrine
::
FETCH_ORI_NEXT
,
$cursorOffset
=
null
)
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
STMT_FETCH
,
$this
->
getQuery
());
$event
->
fetchMode
=
$fetchMode
;
$event
->
cursorOrientation
=
$cursorOrientation
;
$event
->
cursorOffset
=
$cursorOffset
;
//$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->getQuery());
//$event->fetchMode = $fetchMode;
//$event->cursorOrientation = $cursorOrientation;
//$event->cursorOffset = $cursorOffset;
$data
=
$this
->
_conn
->
getListener
()
->
preFetch
(
$event
);
//
$data = $this->_conn->getListener()->preFetch($event);
if
(
!
$event
->
skipOperation
)
{
//
if ( ! $event->skipOperation) {
$data
=
$this
->
_stmt
->
fetch
(
$fetchMode
,
$cursorOrientation
,
$cursorOffset
);
}
//
}
$this
->
_conn
->
getListener
()
->
postFetch
(
$event
);
//
$this->_conn->getListener()->postFetch($event);
return
$data
;
}
/**
* fetchAll
* Returns an array containing all of the result set rows
*
* @param integer $fetchMode Controls how the next row will be returned to the caller.
...
...
@@ -308,32 +295,28 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
*
* @return array
*/
public
function
fetchAll
(
$fetchMode
=
Doctrine
::
FETCH_BOTH
,
$columnIndex
=
null
)
public
function
fetchAll
(
$fetchMode
=
Doctrine
::
FETCH_BOTH
,
$columnIndex
=
null
)
{
$event
=
new
Doctrine_Event
(
$this
,
Doctrine_Event
::
STMT_FETCHALL
,
$this
->
getQuery
());
$event
->
fetchMode
=
$fetchMode
;
$event
->
columnIndex
=
$columnIndex
;
$this
->
_conn
->
getListener
()
->
preFetchAll
(
$event
);
//$event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->getQuery());
//$event->fetchMode = $fetchMode;
//$event->columnIndex = $columnIndex;
//$this->_conn->getListener()->preFetchAll($event);
if
(
!
$event
->
skipOperation
)
{
//
if ( ! $event->skipOperation) {
if
(
$columnIndex
!==
null
)
{
$data
=
$this
->
_stmt
->
fetchAll
(
$fetchMode
,
$columnIndex
);
}
else
{
$data
=
$this
->
_stmt
->
fetchAll
(
$fetchMode
);
}
//$event->data = $data;
//}
$event
->
data
=
$data
;
}
$this
->
_conn
->
getListener
()
->
postFetchAll
(
$event
);
//$this->_conn->getListener()->postFetchAll($event);
return
$data
;
}
/**
* fetchColumn
* Returns a single column from the next row of a
* result set or FALSE if there are no more rows.
*
...
...
@@ -349,7 +332,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* fetchObject
* Fetches the next row and returns it as an object.
*
* Fetches the next row and returns it as an object. This function is an alternative to
...
...
@@ -367,7 +349,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* getAttribute
* Retrieve a statement attribute
*
* @param integer $attribute
...
...
@@ -380,7 +361,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* getColumnMeta
* Returns metadata for a column in a result set
*
* @param integer $column The 0-indexed column in the result set.
...
...
@@ -401,7 +381,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* nextRowset
* Advances to the next rowset in a multi-rowset statement handle
*
* Some database servers support stored procedures that return more than one rowset
...
...
@@ -417,7 +396,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* rowCount
* rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
* executed by the corresponding object.
*
...
...
@@ -434,7 +412,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* setAttribute
* Set a statement attribute
*
* @param integer $attribute
...
...
@@ -447,7 +424,6 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf
}
/**
* setFetchMode
* Set the default fetch mode for this statement
*
* @param integer $mode The fetch mode must be one of the Doctrine::FETCH_* constants.
...
...
lib/Doctrine/DatabasePlatform.php
View file @
3cd4fc55
...
...
@@ -10,66 +10,64 @@
* @author Roman Borschel <roman@code-factory.org>
*/
abstract
class
Doctrine_DatabasePlatform
{
{
/**
* An array containing all features this platform supports, keys representing feature
* names and values as one of the following (true, false, 'emulated').
* Constructor.
*/
public
function
__construct
()
{}
/**
* Gets the character used for identifier quoting.
*
* @
var array
* @
return string
*/
protected
$_supported
=
array
();
public
function
getIdentifierQuoteCharacter
()
{
return
'"'
;
}
/**
* Platform specific properties. Subclasses can override these in the
* constructor.
*
* @var array $properties
*/
protected
$_properties
=
array
(
'sql_comments'
=>
array
(
array
(
'start'
=>
'--'
,
'end'
=>
"
\n
"
,
'escape'
=>
false
),
array
(
'start'
=>
'/*'
,
'end'
=>
'*/'
,
'escape'
=>
false
)
),
'identifier_quoting'
=>
array
(
'start'
=>
'"'
,
'end'
=>
'"'
,
'escape'
=>
'"'
),
'string_quoting'
=>
array
(
'start'
=>
"'"
,
'end'
=>
"'"
,
'escape'
=>
false
,
'escape_pattern'
=>
false
),
'wildcards'
=>
array
(
'%'
,
'_'
),
'varchar_max_length'
=>
255
,
);
* Gets the string portion that starts an SQL comment.
*
* @return string
*/
public
function
getSqlCommentStartString
()
{
return
"--"
;
}
public
function
__construct
()
{}
/**
* Gets the string portion that starts an SQL comment.
*
* @return string
*/
public
function
getSqlCommentEndString
()
{
return
"
\n
"
;
}
/**
* Gets the maximum length of a varchar field.
*
* @return integer
*/
public
function
getVarcharMaxLength
()
{
return
255
;
}
/**
*
Checks whether a certain feature is supported
.
*
Gets all SQL wildcard characters of the platform
.
*
* @param string $feature the name of the feature
* @return boolean whether or not this drivers supports given feature
* @return array
*/
public
function
supports
(
$feature
)
public
function
getWildcards
(
)
{
return
(
isset
(
$this
->
_supported
[
$feature
])
&&
(
$this
->
_supported
[
$feature
]
===
'emulated'
||
$this
->
_supported
[
$feature
]));
return
array
(
'%'
,
'_'
);
}
/**
* regexp
* returns the regular expression operator
* Returns the regular expression operator.
*
* @return string
*/
...
...
@@ -889,9 +887,10 @@ abstract class Doctrine_DatabasePlatform
*
* @param string $query The SQL string to write to / append to.
* @return string
* @todo Remove the ORM dependency
*/
public
function
writeLimitClauseInSubquery
(
Doctrine_ClassMetadata
$rootClass
,
$query
,
$limit
=
false
,
$offset
=
false
)
public
function
writeLimitClauseInSubquery
(
Doctrine_ClassMetadata
$rootClass
,
$
query
,
$
limit
=
false
,
$offset
=
false
)
{
return
$this
->
modifyLimitQuery
(
$query
,
$limit
,
$offset
);
}
...
...
@@ -910,6 +909,46 @@ abstract class Doctrine_DatabasePlatform
}
return
$this
->
_properties
[
$name
];
}
public
function
supportsSequences
()
{
return
false
;
}
public
function
supportsIdentityColumns
()
{
return
false
;
}
public
function
supportsIndexes
()
{
return
true
;
}
public
function
supportsTransactions
()
{
return
true
;
}
public
function
supportsSavepoints
()
{
return
true
;
}
public
function
supportsPrimaryConstraints
()
{
return
true
;
}
public
function
supportsForeignKeyConstraints
()
{
return
true
;
}
public
function
supportsGettingAffectedRows
()
{
return
true
;
}
}
...
...
lib/Doctrine/DatabasePlatform/FirebirdPlatform.php
View file @
3cd4fc55
...
...
@@ -16,26 +16,6 @@ class Doctrine_DatabasePlatform_FirebirdPlatform extends Doctrine_DatabasePlatfo
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_supported
=
array
(
'sequences'
=>
true
,
'indexes'
=>
true
,
'affected_rows'
=>
true
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'transactions'
=>
true
,
'savepoints'
=>
true
,
'current_id'
=>
true
,
'limit_queries'
=>
'emulated'
,
'LOBs'
=>
true
,
'replace'
=>
'emulated'
,
'sub_selects'
=>
true
,
'auto_increment'
=>
true
,
'primary_key'
=>
true
,
'result_introspection'
=>
true
,
'prepared_statements'
=>
true
,
'identifier_quoting'
=>
false
,
'pattern_escaping'
=>
true
);
}
/**
...
...
lib/Doctrine/DatabasePlatform/MsSqlPlatform.php
View file @
3cd4fc55
...
...
@@ -8,24 +8,6 @@ class Doctrine_DatabasePlatform_MsSqlPlatform extends Doctrine_DatabasePlatform
public
function
__construct
()
{
parent
::
__construct
();
// initialize all driver options
$this
->
_supported
=
array
(
'sequences'
=>
'emulated'
,
'indexes'
=>
true
,
'affected_rows'
=>
true
,
'transactions'
=>
true
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'current_id'
=>
'emulated'
,
'limit_queries'
=>
'emulated'
,
'LOBs'
=>
true
,
'replace'
=>
'emulated'
,
'sub_selects'
=>
true
,
'auto_increment'
=>
true
,
'primary_key'
=>
true
,
'result_introspection'
=>
true
,
'prepared_statements'
=>
'emulated'
,
);
}
/**
...
...
lib/Doctrine/DatabasePlatform/MySqlPlatform.php
View file @
3cd4fc55
...
...
@@ -15,7 +15,7 @@ class Doctrine_DatabasePlatform_MySqlPlatform extends Doctrine_DatabasePlatform
* @var array
* @todo Needed? What about lazy initialization?
*/
protected
static
$_reservedKeywords
=
array
(
/*
protected static $_reservedKeywords = array(
'ADD', 'ALL', 'ALTER',
'ANALYZE', 'AND', 'AS',
'ASC', 'ASENSITIVE', 'BEFORE',
...
...
@@ -90,56 +90,30 @@ class Doctrine_DatabasePlatform_MySqlPlatform extends Doctrine_DatabasePlatform
'WHEN', 'WHERE', 'WHILE',
'WITH', 'WRITE', 'X509',
'XOR', 'YEAR_MONTH', 'ZEROFILL'
);
);*/
/**
* Constructor.
* Creates a new MySqlPlatform.
* Creates a new MySqlPlatform
instance
.
*/
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_supported
=
array
(
'sequences'
=>
'emulated'
,
'indexes'
=>
true
,
'affected_rows'
=>
true
,
'transactions'
=>
true
,
'savepoints'
=>
false
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'current_id'
=>
'emulated'
,
'limit_queries'
=>
true
,
'LOBs'
=>
true
,
'replace'
=>
true
,
'sub_selects'
=>
true
,
'auto_increment'
=>
true
,
'primary_key'
=>
true
,
'result_introspection'
=>
true
,
'prepared_statements'
=>
'emulated'
,
'identifier_quoting'
=>
true
,
'pattern_escaping'
=>
true
);
$this
->
_properties
[
'string_quoting'
]
=
array
(
'start'
=>
"'"
,
'end'
=>
"'"
,
'escape'
=>
'\\'
,
'escape_pattern'
=>
'\\'
);
$this
->
_properties
[
'identifier_quoting'
]
=
array
(
'start'
=>
'`'
,
'end'
=>
'`'
,
'escape'
=>
'`'
);
$this
->
_properties
[
'sql_comments'
]
=
array
(
array
(
'start'
=>
'-- '
,
'end'
=>
"
\n
"
,
'escape'
=>
false
),
array
(
'start'
=>
'#'
,
'end'
=>
"
\n
"
,
'escape'
=>
false
),
array
(
'start'
=>
'/*'
,
'end'
=>
'*/'
,
'escape'
=>
false
),
);
$this
->
properties
[
'varchar_max_length'
]
=
255
;
parent
::
__construct
();
}
/**
* Gets the character used for identifier quoting.
*
* @return string
* @override
*/
public
function
getIdentifierQuoteCharacter
()
{
return
'`'
;
}
/**
*
returns the regular expression operator
*
Returns the regular expression operator.
*
* @return string
* @override
...
...
@@ -204,6 +178,7 @@ class Doctrine_DatabasePlatform_MySqlPlatform extends Doctrine_DatabasePlatform
}
$match
.=
"'"
;
$match
.=
$this
->
patternEscapeString
();
return
$match
;
}
...
...
@@ -555,6 +530,29 @@ class Doctrine_DatabasePlatform_MySqlPlatform extends Doctrine_DatabasePlatform
{
return
true
;
}
/**
* Whether the platform supports identity columns.
* MySql supports this through AUTO_INCREMENT columns.
*
* @return boolean
* @override
*/
public
function
supportsIdentityColumns
()
{
return
true
;
}
/**
* Whether the platform supports savepoints. MySql does not.
*
* @return boolean
* @override
*/
public
function
supportsSavepoints
()
{
return
false
;
}
}
?>
\ No newline at end of file
lib/Doctrine/DatabasePlatform/OraclePlatform.php
View file @
3cd4fc55
...
...
@@ -8,26 +8,6 @@ class Doctrine_DatabasePlatform_OraclePlatform extends Doctrine_DatabasePlatform
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_supported
=
array
(
'sequences'
=>
true
,
'indexes'
=>
true
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'current_id'
=>
true
,
'affected_rows'
=>
true
,
'transactions'
=>
true
,
'savepoints'
=>
true
,
'limit_queries'
=>
true
,
'LOBs'
=>
true
,
'replace'
=>
'emulated'
,
'sub_selects'
=>
true
,
'auto_increment'
=>
false
,
// implementation is broken
'primary_key'
=>
true
,
'result_introspection'
=>
true
,
'prepared_statements'
=>
true
,
'identifier_quoting'
=>
true
,
'pattern_escaping'
=>
true
,
);
}
/**
...
...
@@ -44,6 +24,9 @@ class Doctrine_DatabasePlatform_OraclePlatform extends Doctrine_DatabasePlatform
return
$this
->
_createLimitSubquery
(
$query
,
$limit
,
$offset
);
}
/**
* @todo Doc
*/
private
function
_createLimitSubquery
(
$query
,
$limit
,
$offset
,
$column
=
null
)
{
$limit
=
(
int
)
$limit
;
...
...
lib/Doctrine/DatabasePlatform/PostgreSqlPlatform.php
View file @
3cd4fc55
...
...
@@ -9,7 +9,7 @@ class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlat
* @param array
* @todo Nedded? What about lazy initialization?
*/
protected
static
$_reservedKeywords
=
array
(
/*
protected static $_reservedKeywords = array(
'abort', 'absolute', 'access', 'action', 'add', 'after', 'aggregate',
'all', 'alter', 'analyse', 'analyze', 'and', 'any', 'as', 'asc',
'assertion', 'assignment', 'at', 'authorization', 'backward', 'before',
...
...
@@ -54,7 +54,7 @@ class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlat
'unknown', 'unlisten', 'until', 'update', 'usage', 'user', 'using',
'vacuum', 'valid', 'validator', 'values', 'varchar', 'varying',
'verbose', 'version', 'view', 'volatile', 'when', 'where', 'with',
'without'
,
'work'
,
'write'
,
'year'
,
'zone'
);
'without', 'work', 'write', 'year','zone');
*/
/**
...
...
@@ -63,28 +63,7 @@ class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlat
*/
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_supported
=
array
(
'sequences'
=>
true
,
'indexes'
=>
true
,
'affected_rows'
=>
true
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'transactions'
=>
true
,
'savepoints'
=>
true
,
'current_id'
=>
true
,
'limit_queries'
=>
true
,
'LOBs'
=>
true
,
'replace'
=>
'emulated'
,
'sub_selects'
=>
true
,
'auto_increment'
=>
'emulated'
,
'primary_key'
=>
true
,
'result_introspection'
=>
true
,
'prepared_statements'
=>
true
,
'identifier_quoting'
=>
true
,
'pattern_escaping'
=>
true
,
);
parent
::
__construct
();
$this
->
_properties
[
'string_quoting'
]
=
array
(
'start'
=>
"'"
,
'end'
=>
"'"
,
'escape'
=>
"'"
,
...
...
@@ -94,7 +73,6 @@ class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlat
'escape'
=>
'"'
);
}
/**
* Obtain DBMS specific SQL code portion needed to declare an text type
* field to be used in statements like CREATE TABLE.
...
...
@@ -509,7 +487,39 @@ class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlat
public
function
parseBoolean
(
$value
)
{
return
$value
;
}
}
/**
* Whether the platform supports sequences.
* Postgres has native support for sequences.
*
* @return boolean
*/
public
function
supportsSequences
()
{
return
true
;
}
/**
* Whether the platform supports identity columns.
* Postgres supports these through the SERIAL keyword.
*
* @return boolean
*/
public
function
supportsIdentityColumns
()
{
return
true
;
}
/**
* Whether the platform prefers sequences for ID generation.
*
* @return boolean
*/
public
function
prefersSequences
()
{
return
true
;
}
}
?>
\ No newline at end of file
lib/Doctrine/DatabasePlatform/SqlitePlatform.php
View file @
3cd4fc55
...
...
@@ -16,26 +16,6 @@ class Doctrine_DatabasePlatform_SqlitePlatform extends Doctrine_DatabasePlatform
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_supported
=
array
(
'sequences'
=>
'emulated'
,
'indexes'
=>
true
,
'affected_rows'
=>
true
,
'summary_functions'
=>
true
,
'order_by_text'
=>
true
,
'current_id'
=>
'emulated'
,
'limit_queries'
=>
true
,
'LOBs'
=>
true
,
'replace'
=>
true
,
'transactions'
=>
true
,
'savepoints'
=>
false
,
'sub_selects'
=>
true
,
'auto_increment'
=>
true
,
'primary_key'
=>
true
,
'result_introspection'
=>
false
,
// not implemented
'prepared_statements'
=>
'emulated'
,
'identifier_quoting'
=>
true
,
'pattern_escaping'
=>
false
,
);
}
/**
...
...
lib/Doctrine/Entity.php
View file @
3cd4fc55
This diff is collapsed.
Click to expand it.
lib/Doctrine/Hydrator/RecordDriver.php
View file @
3cd4fc55
...
...
@@ -74,7 +74,7 @@ class Doctrine_Hydrator_RecordDriver
$relatedClass
=
$relation
->
getTable
();
$coll
=
$this
->
getElementCollection
(
$relatedClass
->
getClassName
());
$coll
->
setReference
(
$entity
,
$relation
);
$entity
->
_
raw
SetReference
(
$name
,
$coll
);
$entity
->
_
internal
SetReference
(
$name
,
$coll
);
$this
->
_initializedRelations
[
$entity
->
getOid
()][
$name
]
=
true
;
}
}
...
...
@@ -97,23 +97,23 @@ class Doctrine_Hydrator_RecordDriver
public
function
addRelatedIndexedElement
(
Doctrine_Entity
$entity1
,
$property
,
Doctrine_Entity
$entity2
,
$indexField
)
{
$entity1
->
_
rawGetReference
(
$property
)
->
add
(
$entity2
,
$entity2
->
_raw
GetField
(
$indexField
));
$entity1
->
_
internalGetReference
(
$property
)
->
add
(
$entity2
,
$entity2
->
_internal
GetField
(
$indexField
));
}
public
function
addRelatedElement
(
Doctrine_Entity
$entity1
,
$property
,
Doctrine_Entity
$entity2
)
{
$entity1
->
_
raw
GetReference
(
$property
)
->
add
(
$entity2
);
$entity1
->
_
internal
GetReference
(
$property
)
->
add
(
$entity2
);
}
public
function
setRelatedElement
(
Doctrine_Entity
$entity1
,
$property
,
$entity2
)
{
$entity1
->
_
raw
SetReference
(
$property
,
$entity2
);
$entity1
->
_
internal
SetReference
(
$property
,
$entity2
);
}
public
function
isIndexKeyInUse
(
Doctrine_Entity
$entity
,
$assocField
,
$indexField
)
{
return
$entity
->
_
raw
GetReference
(
$assocField
)
->
contains
(
$indexField
);
return
$entity
->
_
internal
GetReference
(
$assocField
)
->
contains
(
$indexField
);
}
public
function
isFieldSet
(
Doctrine_Entity
$entity
,
$field
)
...
...
@@ -123,17 +123,17 @@ class Doctrine_Hydrator_RecordDriver
public
function
getFieldValue
(
Doctrine_Entity
$entity
,
$field
)
{
return
$entity
->
_
raw
GetField
(
$field
);
return
$entity
->
_
internal
GetField
(
$field
);
}
public
function
getReferenceValue
(
Doctrine_Entity
$entity
,
$field
)
{
return
$entity
->
_
raw
GetReference
(
$field
);
return
$entity
->
_
internal
GetReference
(
$field
);
}
public
function
addElementToIndexedCollection
(
$coll
,
$entity
,
$keyField
)
{
$coll
->
add
(
$entity
,
$entity
->
_
raw
GetField
(
$keyField
));
$coll
->
add
(
$entity
,
$entity
->
_
internal
GetField
(
$keyField
));
}
public
function
addElementToCollection
(
$coll
,
$entity
)
...
...
lib/Doctrine/Query/Parser.php
View file @
3cd4fc55
...
...
@@ -165,7 +165,6 @@ class Doctrine_Query_Parser
if
(
!
$isMatch
)
{
// No definition for value checking.
$this
->
syntaxError
(
$this
->
_keywordTable
->
getLiteral
(
$token
));
}
$this
->
next
();
...
...
lib/Doctrine/Query/Production/Atom.php
View file @
3cd4fc55
...
...
@@ -45,26 +45,26 @@ class Doctrine_Query_Production_Atom extends Doctrine_Query_Production
case
Doctrine_Query_Token
::
T_STRING
:
$this
->
_parser
->
match
(
Doctrine_Query_Token
::
T_STRING
);
$this
->
_type
=
'string'
;
break
;
break
;
case
Doctrine_Query_Token
::
T_INTEGER
:
$this
->
_parser
->
match
(
Doctrine_Query_Token
::
T_INTEGER
);
$this
->
_type
=
'integer'
;
break
;
break
;
case
Doctrine_Query_Token
::
T_FLOAT
:
$this
->
_parser
->
match
(
Doctrine_Query_Token
::
T_FLOAT
);
$this
->
_type
=
'float'
;
break
;
break
;
case
Doctrine_Query_Token
::
T_INPUT_PARAMETER
:
$this
->
_parser
->
match
(
Doctrine_Query_Token
::
T_INPUT_PARAMETER
);
$this
->
_type
=
'param'
;
break
;
break
;
default
:
$this
->
_parser
->
syntaxError
(
'string, number or parameter (? or :)'
);
break
;
break
;
}
$this
->
_value
=
$this
->
_parser
->
token
[
'value'
];
...
...
@@ -78,19 +78,20 @@ class Doctrine_Query_Production_Atom extends Doctrine_Query_Production
switch
(
$this
->
_type
)
{
case
'param'
:
return
$this
->
_value
;
break
;
case
'integer'
:
case
'float'
:
case
'string'
:
//FIXME: Remove the quotes from _value! Should the scanner do that or where?
// 'mystring' => mystring. Otherwise 'mystring' is the content (with quotes)!
// Eg: select ... from ... where f.foo = 'bar'
// => $conn->quote('bar',...), CURRENTLY: $conn->quote("'bar'",...)
// This fix looks a bit ugly or ... ? Should this happen earlier? Syntax?
// Scanner?
if
(
strpos
(
$this
->
_value
,
"'"
)
===
0
)
{
$this
->
_value
=
substr
(
$this
->
_value
,
1
,
strlen
(
$this
->
_value
)
-
2
);
}
return
$conn
->
quote
(
$this
->
_value
,
$this
->
_type
);
break
;
default
:
$stringQuoting
=
$conn
->
getDatabasePlatform
()
->
getProperty
(
'string_quoting'
);
return
$stringQuoting
[
'start'
]
.
$conn
->
quote
(
$this
->
_value
,
$this
->
_type
)
.
$stringQuoting
[
'end'
];
break
;
return
$conn
->
quote
(
$this
->
_value
,
$this
->
_type
);
}
}
...
...
lib/Doctrine/Query/Scanner.php
View file @
3cd4fc55
...
...
@@ -33,14 +33,18 @@
class
Doctrine_Query_Scanner
{
/**
* Array of scanned tokens
* Array of scanned tokens
.
*
* @var array
*/
protected
$_tokens
=
array
();
/**
* @todo Doc
*/
protected
$_position
=
0
;
/**
* @todo Doc
*/
protected
$_peek
=
0
;
/**
...
...
@@ -109,7 +113,9 @@ class Doctrine_Query_Scanner
}
}
/**
* @todo Doc
*/
protected
function
_getType
(
&
$value
)
{
// $value is referenced because it can be changed if it is numeric.
...
...
@@ -117,30 +123,32 @@ class Doctrine_Query_Scanner
$type
=
Doctrine_Query_Token
::
T_NONE
;
$newVal
=
$this
->
_getNumeric
(
$value
);
if
(
$newVal
!==
false
){
if
(
$newVal
!==
false
){
$value
=
$newVal
;
if
(
strpos
(
$value
,
'.'
)
!==
false
||
stripos
(
$value
,
'e'
)
!==
false
)
{
$type
=
Doctrine_Query_Token
::
T_FLOAT
;
}
else
{
}
else
{
$type
=
Doctrine_Query_Token
::
T_INTEGER
;
}
}
if
(
$value
[
0
]
===
"'"
&&
$value
[
strlen
(
$value
)
-
1
]
===
"'"
)
{
$type
=
Doctrine_Query_Token
::
T_STRING
;
}
elseif
(
ctype_alpha
(
$value
[
0
])
||
$value
[
0
]
===
'_'
)
{
}
else
if
(
ctype_alpha
(
$value
[
0
])
||
$value
[
0
]
===
'_'
)
{
$type
=
$this
->
_checkLiteral
(
$value
);
}
elseif
(
$value
[
0
]
===
'?'
||
$value
[
0
]
===
':'
)
{
}
else
if
(
$value
[
0
]
===
'?'
||
$value
[
0
]
===
':'
)
{
$type
=
Doctrine_Query_Token
::
T_INPUT_PARAMETER
;
}
return
$type
;
}
/**
* @todo Doc
*/
protected
function
_getNumeric
(
$value
)
{
if
(
!
is_scalar
(
$value
))
{
if
(
!
is_scalar
(
$value
))
{
return
false
;
}
// Checking for valid numeric numbers: 1.234, -1.234e-2
...
...
@@ -164,7 +172,9 @@ class Doctrine_Query_Scanner
}
/**
* @todo Doc
*/
public
function
isA
(
$value
,
$token
)
{
$type
=
$this
->
_getType
(
$value
);
...
...
@@ -172,7 +182,9 @@ class Doctrine_Query_Scanner
return
$type
===
$token
;
}
/**
* @todo Doc
*/
public
function
peek
()
{
if
(
isset
(
$this
->
_tokens
[
$this
->
_position
+
$this
->
_peek
]))
{
...
...
@@ -182,13 +194,14 @@ class Doctrine_Query_Scanner
}
}
/**
* @todo Doc
*/
public
function
resetPeek
()
{
$this
->
_peek
=
0
;
}
/**
* Returns the next token in the input string.
*
...
...
@@ -211,7 +224,9 @@ class Doctrine_Query_Scanner
}
}
/**
* @todo Doc
*/
public
function
resetPosition
(
$position
=
0
)
{
$this
->
_position
=
$position
;
...
...
lib/Doctrine/Relation/Parser.php
View file @
3cd4fc55
...
...
@@ -29,7 +29,8 @@
* @version $Revision: 1397 $
* @link www.phpdoctrine.org
* @since 1.0
* @todo Composite key support?
* @todo Composite key support?
* @todo Remove. Association mapping needs a reimplementation.
*/
class
Doctrine_Relation_Parser
{
...
...
lib/Doctrine/Sequence/Mysql.php
View file @
3cd4fc55
...
...
@@ -44,9 +44,9 @@ class Doctrine_Sequence_Mysql extends Doctrine_Sequence
*/
public
function
nextId
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (NULL)'
;
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES (NULL)'
;
try
{
$this
->
conn
->
exec
(
$query
);
...
...
@@ -68,7 +68,7 @@ class Doctrine_Sequence_Mysql extends Doctrine_Sequence
$query
=
'DELETE FROM '
.
$sequenceName
.
' WHERE '
.
$seqcolName
.
' < '
.
$value
;
try
{
$this
->
conn
->
exec
(
$query
);
}
catch
(
Doctrine_Exception
$e
)
{
}
catch
(
Doctrine_Exception
$e
)
{
throw
new
Doctrine_Sequence_Exception
(
'could not delete previous sequence table values from '
.
$seqName
);
}
}
...
...
lib/Doctrine/Sequence/Oracle.php
View file @
3cd4fc55
...
...
@@ -40,7 +40,7 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
*
* @return integer next id in the given sequence
*/
public
function
nextI
D
(
$seqName
,
$onDemand
=
true
)
public
function
nextI
d
(
$seqName
,
$onDemand
=
true
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT '
.
$sequenceName
.
'.nextval FROM DUAL'
;
...
...
@@ -69,10 +69,10 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
* @param string name of the table into which a new row was inserted
* @param string name of the field into which a new row was inserted
*/
public
function
lastInsertI
D
(
$table
=
null
,
$field
=
null
)
public
function
lastInsertI
d
(
$table
=
null
,
$field
=
null
)
{
$seqName
=
$table
.
(
empty
(
$field
)
?
''
:
'_'
.
$field
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
return
$this
->
conn
->
fetchOne
(
'SELECT '
.
$sequenceName
.
'.currval'
);
}
...
...
@@ -84,7 +84,7 @@ class Doctrine_Sequence_Oracle extends Doctrine_Sequence
*
* @return integer current id in the given sequence
*/
public
function
currI
D
(
$seqName
)
public
function
currI
d
(
$seqName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT (last_number-1) FROM user_sequences'
;
...
...
tests/Orm/Entity/AccessorTest.php
View file @
3cd4fc55
...
...
@@ -13,8 +13,6 @@ class Orm_Entity_AccessorTest extends Doctrine_OrmTestCase
$entity2
->
username
=
'romanb'
;
$this
->
assertEquals
(
'romanb?!'
,
$entity1
->
username
);
}
}
...
...
@@ -41,12 +39,12 @@ class CustomAccessorMutatorTestEntity extends Doctrine_Entity
public
function
getUsernameCustom
()
{
return
$this
->
_
rawGetField
(
'username'
)
.
"!"
;
return
$this
->
_
get
(
'username'
)
.
"!"
;
}
public
function
setUsernameCustom
(
$username
)
{
$this
->
_
rawSetField
(
'username'
,
$username
.
"?"
);
$this
->
_
set
(
'username'
,
$username
.
"?"
);
}
}
...
...
@@ -69,11 +67,11 @@ class MagicAccessorMutatorTestEntity extends Doctrine_Entity
public
function
getUsername
()
{
return
$this
->
_
rawGetField
(
'username'
)
.
"!"
;
return
$this
->
_
get
(
'username'
)
.
"!"
;
}
public
function
setUsername
(
$username
)
{
$this
->
_
rawSetField
(
'username'
,
$username
.
"?"
);
$this
->
_
set
(
'username'
,
$username
.
"?"
);
}
}
\ No newline at end of file
tests/Orm/Query/SelectSqlGenerationTest.php
View file @
3cd4fc55
...
...
@@ -134,7 +134,9 @@ class Orm_Query_SelectSqlGenerationTest extends Doctrine_OrmTestCase
{
$this
->
assertSqlGeneration
(
"SELECT u.name FROM CmsUser u WHERE TRIM(u.name) = 'someone'"
,
"SELECT cu.name AS cu__name FROM cms_user cu WHERE TRIM(cu.name) = ''someone''"
// SQLite double slashes for strings
// String quoting in the SQL usually depends on the database platform.
// This test works with a mock connection which uses ' for string quoting.
"SELECT cu.name AS cu__name FROM cms_user cu WHERE TRIM(cu.name) = 'someone'"
);
}
...
...
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