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
75dbc8c8
Commit
75dbc8c8
authored
Jul 21, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several bugfixes for the export module (expecially pgsql).
parent
6348e5f7
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1885 additions
and
1813 deletions
+1885
-1813
Pgsql.php
lib/Doctrine/DataDict/Pgsql.php
+621
-621
Export.php
lib/Doctrine/Export.php
+1094
-1093
Pgsql.php
lib/Doctrine/Export/Pgsql.php
+63
-0
PgsqlTestCase.php
tests/Export/PgsqlTestCase.php
+98
-98
SingleRootTestCase.php
tests/NestedSet/SingleRootTestCase.php
+8
-0
run.php
tests/run.php
+1
-1
No files found.
lib/Doctrine/DataDict/Pgsql.php
View file @
75dbc8c8
This diff is collapsed.
Click to expand it.
lib/Doctrine/Export.php
View file @
75dbc8c8
This diff is collapsed.
Click to expand it.
lib/Doctrine/Export/Pgsql.php
View file @
75dbc8c8
...
...
@@ -283,5 +283,68 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
return
'DROP SEQUENCE '
.
$sequenceName
;
}
/**
* Creates a table.
*
* @param unknown_type $name
* @param array $fields
* @param array $options
* @return unknown
*/
public
function
createTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
{
if
(
!
$name
)
{
throw
new
Doctrine_Export_Exception
(
'no valid table name specified'
);
}
if
(
empty
(
$fields
))
{
throw
new
Doctrine_Export_Exception
(
'no fields specified for table '
.
$name
);
}
$queryFields
=
$this
->
getFieldDeclarationList
(
$fields
);
if
(
isset
(
$options
[
'primary'
])
&&
!
empty
(
$options
[
'primary'
]))
{
$queryFields
.=
', PRIMARY KEY('
.
implode
(
', '
,
array_values
(
$options
[
'primary'
]))
.
')'
;
}
$name
=
$this
->
conn
->
quoteIdentifier
(
$name
,
true
);
$query
=
'CREATE TABLE '
.
$name
.
' ('
.
$queryFields
.
')'
;
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$index
=>
$definition
)
{
$sql
[]
=
$this
->
createIndexSql
(
$name
,
$index
,
$definition
);
}
}
if
(
isset
(
$options
[
'foreignKeys'
]))
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$k
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
$sql
[]
=
$this
->
createForeignKeySql
(
$name
,
$definition
);
}
}
}
return
$sql
;
}
/**
* createForeignKeySql
*
* @param string $table name of the table on which the foreign key is to be created
* @param array $definition associative array that defines properties of the foreign key to be created.
* @return string
*/
public
function
createForeignKeySql
(
$table
,
array
$definition
)
{
$table
=
$this
->
conn
->
quoteIdentifier
(
$table
);
$query
=
'ALTER TABLE '
.
$table
.
' ADD '
.
$this
->
getForeignKeyDeclaration
(
$definition
);
return
$query
;
}
}
tests/Export/PgsqlTestCase.php
View file @
75dbc8c8
This diff is collapsed.
Click to expand it.
tests/NestedSet/SingleRootTestCase.php
View file @
75dbc8c8
...
...
@@ -49,6 +49,14 @@ class Doctrine_NestedSet_SingleRoot_TestCase extends Doctrine_UnitTestCase
$node2
->
name
=
'node2'
;
$node2
->
getNode
()
->
insertAsLastChildOf
(
$node
);
}
public
function
testLftRgtValues
()
{
$treeMngr
=
$this
->
conn
->
getTable
(
'NestedSetTest_SingleRootNode'
)
->
getTree
();
$root
=
$treeMngr
->
fetchRoot
();
$this
->
assertEqual
(
1
,
$root
[
'lft'
]);
$this
->
assertEqual
(
4
,
$root
[
'rgt'
]);
}
public
function
testGetDescendants
()
{
...
...
tests/run.php
View file @
75dbc8c8
...
...
@@ -336,7 +336,7 @@ $test->addTestCase(new Doctrine_Search_TestCase());
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
//
$test->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase());
$test
->
addTestCase
(
new
Doctrine_NestedSet_SingleRoot_TestCase
());
// Cache tests
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
...
...
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