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
deef2137
Commit
deef2137
authored
Jun 13, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ported sequence methods from MDB2
parent
8d8b66eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
Pgsql.php
lib/Doctrine/Export/Pgsql.php
+57
-0
No files found.
lib/Doctrine/Export/Pgsql.php
View file @
deef2137
...
...
@@ -57,6 +57,40 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
$query
=
'DROP DATABASE '
.
$this
->
conn
->
quoteIdentifier
(
$name
);
$this
->
conn
->
exec
(
$query
);
}
/**
* getAdvancedForeignKeyOptions
* Return the FOREIGN KEY query section dealing with non-standard options
* as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
*
* @param array $definition foreign key definition
* @return string
* @access protected
*/
public
function
getAdvancedForeignKeyOptions
(
array
$definition
)
{
$query
=
''
;
if
(
isset
(
$definition
[
'match'
]))
{
$query
.=
' MATCH '
.
$definition
[
'match'
];
}
if
(
isset
(
$definition
[
'onUpdate'
]))
{
$query
.=
' ON UPDATE '
.
$definition
[
'on_update'
];
}
if
(
isset
(
$definition
[
'onDelete'
]))
{
$query
.=
' ON DELETE '
.
$definition
[
'on_delete'
];
}
if
(
isset
(
$definition
[
'deferrable'
]))
{
$query
.=
' DEFERRABLE'
;
}
else
{
$query
.=
' NOT DEFERRABLE'
;
}
if
(
isset
(
$definition
[
'feferred'
]))
{
$query
.=
' INITIALLY DEFERRED'
;
}
else
{
$query
.=
' INITIALLY IMMEDIATE'
;
}
return
$query
;
}
/**
* alter an existing table
*
...
...
@@ -216,5 +250,28 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
$this
->
conn
->
exec
(
'ALTER TABLE '
.
$name
.
' RENAME TO '
.
$changeName
);
}
}
/**
* create sequence
*
* @param string $sequenceName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
*/
public
function
createSequence
(
$sequenceName
,
$start
=
1
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$sequenceName
),
true
);
return
$this
->
conn
->
exec
(
'CREATE SEQUENCE '
.
$sequenceName
.
' INCREMENT 1'
.
(
$start
<
1
?
' MINVALUE '
.
$start
:
''
)
.
' START '
.
$start
);
}
/**
* drop existing sequence
*
* @param string $sequenceName name of the sequence to be dropped
*/
public
function
dropSequence
(
$sequenceName
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getSequenceName
(
$sequenceName
),
true
);
return
$this
->
conn
->
exec
(
'DROP SEQUENCE '
.
$sequenceName
);
}
}
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