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
05d96951
Commit
05d96951
authored
Jan 09, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
d14e19a6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
24 deletions
+111
-24
Query.php
lib/Doctrine/Db/Profiler/Query.php
+2
-2
location.php
models/location.php
+25
-0
MultiJoinTestCase.php
tests/Query/MultiJoinTestCase.php
+49
-0
OneToOneTestCase.php
tests/Relation/OneToOneTestCase.php
+1
-14
PgsqlTestCase.php
tests/Sequence/PgsqlTestCase.php
+20
-0
run.php
tests/run.php
+14
-8
No files found.
lib/Doctrine/Db/Profiler/Query.php
View file @
05d96951
...
...
@@ -36,7 +36,7 @@ class Doctrine_Db_Profiler_Query
*/
protected
$query
=
''
;
/**
* @var integer One of the
Zend
_Db_Profiler constants for query type, set by $queryType argument in constructor.
* @var integer One of the
Doctrine
_Db_Profiler constants for query type, set by $queryType argument in constructor.
*/
protected
$queryType
=
0
;
...
...
@@ -56,7 +56,7 @@ class Doctrine_Db_Profiler_Query
/**
* Class constructor. A query is about to be started, save the query text ($query) and its
* type (one of the
Zend
_Db_Profiler::* constants).
* type (one of the
Doctrine
_Db_Profiler::* constants).
*
* @param string $query
* @param int $queryType
...
...
models/location.php
0 → 100644
View file @
05d96951
<?php
class
Record_Country
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
public
function
setUp
()
{
$this
->
hasMany
(
'Record_City as City'
,
'City.country_id'
);
}
}
class
Record_City
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
$this
->
hasColumn
(
'country_id'
,
'integer'
);
$this
->
hasColumn
(
'district_id'
,
'integer'
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Record_Country as Country'
,
'Record_City.country_id'
);
$this
->
hasOne
(
'Record_District as District'
,
'Record_City.district_id'
);
}
}
class
Record_District
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
}
tests/Query/MultiJoinTestCase.php
View file @
05d96951
...
...
@@ -149,3 +149,52 @@ class Doctrine_Query_MultiJoin_TestCase extends Doctrine_UnitTestCase {
$users
=
$query
->
query
(
"FROM User.Album.Song WHERE User.id IN (4,5) ORDER BY User.Album.Song.title DESC"
);
}
}
class
Record_District
extends
Record
{
public
function
setUp
()
{
$this
->
hasOne
(
'Record_Card as Card'
,
'Record_District.district_id'
);
$this
->
hasOne
(
'Record_City as City'
,
'Record_District.city_id'
);
$this
->
hasMany
(
'Record_Building as Building'
,
'Record_BuildingDistrict.building_id'
);
}
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'district'
);
$this
->
hasColumn
(
'district_id'
,
'integer'
,
8
,
array
(
'primary'
,
'unsigned'
,
'notnull'
,
'default'
=>
0
));
$this
->
hasColumn
(
'city_id'
,
'integer'
,
8
,
array
(
'unsigned'
,
'notnull'
));
$this
->
hasColumn
(
'city'
,
'string'
,
50
,
array
(
'notnull'
,
'default'
=>
''
));
$this
->
hasColumn
(
'district'
,
'string'
,
50
,
array
(
'notnull'
,
'default'
=>
''
));
$this
->
hasColumn
(
'matchword'
,
'string'
,
50
);
$this
->
has_coord_columns
();
$this
->
has_status_columns
();
}
}
$dql_building
=
"
FROM Record_Building b
LEFT JOIN b.District d
LEFT JOIN d.City c
LEFT JOIN b.Address a
WHERE b.building_id =
{
$id
}
"
;
$collection
=
$this
->
db
->
query
(
$dql_building
);
$br
=
$collection
[
0
];
echo
"building:
{
$br
->
building_id
}
\n
"
;
foreach
(
$br
->
District
as
$district
)
{
echo
"district:
{
$district
->
district_id
}
{
$district
->
district
}
{
$district
->
City
->
city
}
\n
"
;
}
// Notice: Trying to get property of non-object in /www/igglo2_doctrine/core/class/BuildingDAO.php on line 92
tests/Relation/OneToOneTestCase.php
View file @
05d96951
...
...
@@ -38,17 +38,4 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase {
$this
->
assertTrue
(
$country
instanceof
Record_Country
);
}
}
class
Record_Country
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
}
class
Record_City
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
$this
->
hasColumn
(
'country_id'
,
'integer'
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Record_Country as Country'
,
'Record_City.country_id'
);
}
}
tests/Sequence/PgsqlTestCase.php
View file @
05d96951
...
...
@@ -31,4 +31,24 @@
* @version $Revision$
*/
class
Doctrine_Sequence_Pgsql_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testCurrIdExecutesSql
()
{
$this
->
sequence
->
currId
(
'user'
);
$q
=
"SELECT (last_number-1) FROM user_sequences WHERE sequence_name='user_seq' OR sequence_name='USER_SEQ'"
;
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
$q
);
}
public
function
testNextIdExecutesSql
()
{
$id
=
$this
->
sequence
->
nextId
(
'user'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
"SELECT NEXTVAL('user_seq')"
);
}
public
function
testLastInsertIdExecutesSql
()
{
$this
->
sequence
->
lastInsertId
(
'user'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'SELECT user_seq.currval'
);
}
}
tests/run.php
View file @
05d96951
...
...
@@ -40,24 +40,36 @@ function autoload($class) {
require_once
dirname
(
__FILE__
)
.
'/../lib/Doctrine.php'
;
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
spl_autoload_register
(
'autoload'
);
require_once
dirname
(
__FILE__
)
.
'/../models/location.php'
;
require_once
(
'classes.php'
);
require_once
(
'simpletest/unit_tester.php'
);
require_once
(
'simpletest/reporter.php'
);
require_once
(
'UnitTestCase.php'
);
require_once
(
'DriverTestCase.php'
);
error_reporting
(
E_ALL
);
print
'<pre>'
;
$test
=
new
GroupTest
(
'Doctrine Framework Unit Tests'
);
$test
->
addTestCase
(
new
Doctrine_Sequence_Mysql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Join_TestCase
());
/**
$test->addTestCase(new Doctrine_Sequence_Firebird_TestCase());
$test->addTestCase(new Doctrine_Sequence_Informix_TestCase());
$test->addTestCase(new Doctrine_Sequence_Mysql_TestCase());
$test->addTestCase(new Doctrine_Sequence_Mssql_TestCase());
$test->addTestCase(new Doctrine_Sequence_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Sequence_Oracle_TestCase());
$test->addTestCase(new Doctrine_Sequence_Sqlite_TestCase());
// DATABASE ABSTRACTION tests
/**
// Connection drivers (not yet fully tested)
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Connection_Oracle_TestCase());
...
...
@@ -89,13 +101,7 @@ $test->addTestCase(new Doctrine_DataDict_Sqlite_TestCase());
// Sequence module (not yet fully tested)
$test->addTestCase(new Doctrine_Sequence_TestCase());
$test->addTestCase(new Doctrine_Sequence_Firebird_TestCase());
$test->addTestCase(new Doctrine_Sequence_Informix_TestCase());
$test->addTestCase(new Doctrine_Sequence_Mssql_TestCase());
$test->addTestCase(new Doctrine_Sequence_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Sequence_Oracle_TestCase());
$test->addTestCase(new Doctrine_Sequence_Sqlite_TestCase());
// Export module (not yet fully tested)
$test->addTestCase(new Doctrine_Export_TestCase());
...
...
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