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
ba893f6e
Commit
ba893f6e
authored
Nov 30, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added REPLACE support, fixes #238
parent
7556bfcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
Record.php
lib/Doctrine/Record.php
+26
-1
No files found.
lib/Doctrine/Record.php
View file @
ba893f6e
...
...
@@ -854,7 +854,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*
* this method also saves the related components
*
* @param Doctrine_Connection $conn
* @param Doctrine_Connection $conn
optional connection parameter
* @return void
*/
public
function
save
(
Doctrine_Connection
$conn
=
null
)
{
...
...
@@ -889,6 +889,31 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$conn
->
commit
();
}
/**
* replace
* 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
* key field values, the REPLACE query just updates its values instead of
* inserting a new row.
*
* The REPLACE type of query does not make part of the SQL standards. Since
* practically only MySQL and SQLIte implement it natively, this type of
* query isemulated through this method for other DBMS using standard types
* of queries inside a transaction to assure the atomicity of the operation.
*
* @param Doctrine_Connection $conn optional connection parameter
* @throws Doctrine_Connection_Exception if some of the key values was null
* @throws Doctrine_Connection_Exception if there were no key fields
* @throws PDOException if something fails at PDO level
* @return integer number of rows affected
*/
public
function
replace
(
Doctrine_Connection
$conn
=
null
)
{
if
(
$conn
===
null
)
{
$conn
=
$this
->
_table
->
getConnection
();
}
$conn
->
replace
(
$this
->
_table
->
getTableName
(),
$this
->
getPrepared
(),
$this
->
id
);
}
/**
* returns an array of modified fields and associated values
* @return array
...
...
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