Skip to content

Commit

Permalink
Move methods that return SQL into the SQLDialectTrait.
Browse files Browse the repository at this point in the history
The dialects should be responsible for all SQL snippets. This should
help consolidate platform differences into once place.
  • Loading branch information
markstory committed Mar 24, 2013
1 parent 9e63eae commit dbd2469
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
29 changes: 0 additions & 29 deletions lib/Cake/Model/Datasource/Database/Driver.php
Expand Up @@ -97,35 +97,6 @@ public function supportsSavePoints() {
return true;
}

/**
* Returns a SQL snippet for creating a new transaction savepoint
*
* @param string save point name
* @return string
**/
public function savePointSQL($name) {
return 'SAVEPOINT LEVEL' . $name;
}

/**
* Returns a SQL snippet for releasing a previously created save point
*
* @param string save point name
* @return string
**/
public function releaseSavePointSQL($name) {
return 'RELEASE SAVEPOINT LEVEL' . $name;
}

/**
* Returns a SQL snippet for rollbacking a previously created save point
*
* @param string save point name
* @return string
**/
public function rollbackSavePointSQL($name) {
return 'ROLLBACK TO SAVEPOINT LEVEL' . $name;
}

/**
* Returns a value in a safe representation to be used in a query string
Expand Down
30 changes: 30 additions & 0 deletions lib/Cake/Model/Datasource/Database/SqlDialectTrait.php
Expand Up @@ -160,4 +160,34 @@ protected function _insertQueryTranslator($query) {
return $query;
}

/**
* Returns a SQL snippet for creating a new transaction savepoint
*
* @param string save point name
* @return string
*/
public function savePointSQL($name) {
return 'SAVEPOINT LEVEL' . $name;
}

/**
* Returns a SQL snippet for releasing a previously created save point
*
* @param string save point name
* @return string
*/
public function releaseSavePointSQL($name) {
return 'RELEASE SAVEPOINT LEVEL' . $name;
}

/**
* Returns a SQL snippet for rollbacking a previously created save point
*
* @param string save point name
* @return string
*/
public function rollbackSavePointSQL($name) {
return 'ROLLBACK TO SAVEPOINT LEVEL' . $name;
}

}

0 comments on commit dbd2469

Please sign in to comment.