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
4319d095
Commit
4319d095
authored
Jan 29, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
little sequence handling fix
parent
360c8ea2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
29 deletions
+30
-29
Cache.php
lib/Doctrine/Cache.php
+5
-5
Connection.php
lib/Doctrine/Connection.php
+4
-0
Mssql.php
lib/Doctrine/Connection/Mssql.php
+4
-4
Firebird.php
lib/Doctrine/Sequence/Firebird.php
+5
-5
Mssql.php
lib/Doctrine/Sequence/Mssql.php
+7
-7
Sqlite.php
lib/Doctrine/Sequence/Sqlite.php
+1
-1
run.php
tests/run.php
+4
-7
No files found.
lib/Doctrine/Cache.php
View file @
4319d095
...
...
@@ -32,9 +32,9 @@
*/
class
Doctrine_Cache
{
protected
$_options
=
array
(
'size'
=>
1000
,
'lifetime'
=>
3600
,
);
protected
$_options
=
array
(
'size'
=>
1000
,
'lifetime'
=>
3600
,
);
protected
$_queries
=
array
();
...
...
@@ -45,7 +45,7 @@ class Doctrine_Cache
* @param string $query sql query string
* @return void
*/
public
function
process
(
$query
)
public
function
addQuery
(
$query
)
{
$this
->
queries
[]
=
$query
;
}
...
...
@@ -54,7 +54,7 @@ class Doctrine_Cache
*
* @return boolean
*/
public
function
save
()
public
function
processAll
()
{
$content
=
file_get_contents
(
$this
->
_statsFile
);
$queries
=
explode
(
"
\n
"
,
$content
);
...
...
lib/Doctrine/Connection.php
View file @
4319d095
...
...
@@ -97,6 +97,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
),
'wildcards'
=>
array
(
'%'
,
'_'
)
);
/**
* @var array $serverInfo
*/
protected
$serverInfo
=
array
();
/**
* @var array $availibleDrivers an array containing all availible drivers
*/
...
...
lib/Doctrine/Connection/Mssql.php
View file @
4319d095
...
...
@@ -145,15 +145,15 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
* @return mixed array/string with version information or MDB2 error object
*/
public
function
getServerVersion
(
$native
=
false
)
{
if
(
$this
->
connected_server_i
nfo
)
{
$serverInfo
=
$this
->
connected_server_i
nfo
;
{
if
(
$this
->
serverI
nfo
)
{
$serverInfo
=
$this
->
serverI
nfo
;
}
else
{
$query
=
'SELECT @@VERSION'
;
$serverInfo
=
$this
->
fetchOne
(
$query
);
}
// cache server_info
$this
->
connected_server_i
nfo
=
$serverInfo
;
$this
->
serverI
nfo
=
$serverInfo
;
if
(
!
$native
)
{
if
(
preg_match
(
'/([0-9]+)\.([0-9]+)\.([0-9]+)/'
,
$serverInfo
,
$tmp
))
{
$serverInfo
=
array
(
...
...
lib/Doctrine/Sequence/Firebird.php
View file @
4319d095
...
...
@@ -47,7 +47,7 @@ class Doctrine_Sequence_Firebird extends Doctrine_Sequence
$query
=
'SELECT GEN_ID('
.
$sequenceName
.
', 1) as the_value FROM RDB$DATABASE'
;
try
{
$result
=
$this
->
query
One
(
$query
,
'integer'
);
$result
=
$this
->
conn
->
fetch
One
(
$query
,
'integer'
);
}
catch
(
Doctrine_Connection_Exception
$e
)
{
if
(
$onDemand
&&
$e
->
getPortableCode
()
==
Doctrine
::
ERR_NOSUCHTABLE
)
{
...
...
@@ -75,9 +75,9 @@ class Doctrine_Sequence_Firebird 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
)
{
throw
new
Doctrine_Sequence_Exception
(
'method not implemented'
);
return
$this
->
conn
->
getDbh
()
->
lastInsertId
(
);
}
/**
* Returns the current id of a sequence
...
...
@@ -86,14 +86,14 @@ class Doctrine_Sequence_Firebird 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
->
getSequenceName
(
$seqName
),
true
);
$query
=
'SELECT GEN_ID('
.
$sequenceName
.
', 0) as the_value FROM RDB$DATABASE'
;
try
{
$value
=
$this
->
query
One
(
$query
);
$value
=
$this
->
conn
->
fetch
One
(
$query
);
}
catch
(
Doctrine_Connection_Exception
$e
)
{
throw
new
Doctrine_Sequence_Exception
(
'Unable to select from '
.
$seqName
);
}
...
...
lib/Doctrine/Sequence/Mssql.php
View file @
4319d095
...
...
@@ -40,7 +40,7 @@ class Doctrine_Sequence_Mssql 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
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
...
...
@@ -71,7 +71,7 @@ class Doctrine_Sequence_Mssql extends Doctrine_Sequence
}
}
$value
=
$this
->
lastInsertI
D
(
$sequenceName
);
$value
=
$this
->
lastInsertI
d
(
$sequenceName
);
if
(
is_numeric
(
$value
))
{
$query
=
'DELETE FROM '
.
$sequenceName
.
' WHERE '
.
$seqcolName
.
' < '
.
$value
;
...
...
@@ -92,9 +92,9 @@ class Doctrine_Sequence_Mssql 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
)
{
$serverInfo
=
$this
->
getServerVersion
();
$serverInfo
=
$this
->
conn
->
getServerVersion
();
if
(
is_array
(
$serverInfo
)
&&
!
is_null
(
$serverInfo
[
'major'
])
&&
$serverInfo
[
'major'
]
>=
8
)
{
...
...
@@ -105,7 +105,7 @@ class Doctrine_Sequence_Mssql extends Doctrine_Sequence
$query
=
'SELECT @@IDENTITY'
;
}
return
$this
->
fetchOne
(
$query
);
return
$this
->
conn
->
fetchOne
(
$query
);
}
/**
* Returns the current id of a sequence
...
...
@@ -114,10 +114,10 @@ class Doctrine_Sequence_Mssql extends Doctrine_Sequence
*
* @return integer current id in the given sequence
*/
public
function
currI
D
(
$seqName
)
public
function
currI
d
(
$seqName
)
{
$this
->
warnings
[]
=
'database does not support getting current
sequence value, the sequence value was incremented'
;
return
$this
->
nextI
D
(
$seqName
);
return
$this
->
nextI
d
(
$seqName
);
}
}
lib/Doctrine/Sequence/Sqlite.php
View file @
4319d095
...
...
@@ -90,7 +90,7 @@ class Doctrine_Sequence_Sqlite extends Doctrine_Sequence
*/
public
function
lastInsertId
(
$table
=
null
,
$field
=
null
)
{
return
$this
->
conn
->
getDbh
()
->
lastInsertI
D
();
return
$this
->
conn
->
getDbh
()
->
lastInsertI
d
();
}
/**
* Returns the current id of a sequence
...
...
tests/run.php
View file @
4319d095
<?php
ob_start
();
ini_set
(
'max_execution_time'
,
900
);
ini_set
(
'max_execution_time'
,
900
);
function
autoload
(
$class
)
{
if
(
strpos
(
$class
,
'TestCase'
)
===
false
)
...
...
@@ -135,7 +135,6 @@ $test->addTestCase(new Doctrine_Expression_Pgsql_TestCase());
$test
->
addTestCase
(
new
Doctrine_Expression_Oracle_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Expression_Sqlite_TestCase
());
// Core
$test
->
addTestCase
(
new
Doctrine_Access_TestCase
());
...
...
@@ -197,14 +196,11 @@ $test->addTestCase(new Doctrine_Query_MultiJoin_TestCase());
$test
->
addTestCase
(
new
Doctrine_Query_ReferenceModel_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Condition_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_ComponentAlias_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Subquery_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_ShortAliases_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Delete_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Where_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Limit_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_IdentifierQuoting_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Update_TestCase
());
...
...
@@ -219,8 +215,9 @@ $test->addTestCase(new Doctrine_Query_JoinCondition_TestCase());
$test
->
addTestCase
(
new
Doctrine_ColumnAlias_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Subquery_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Orderby_TestCase
());
// Cache tests
...
...
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