Skip to content

Commit

Permalink
Merge pull request #13532 from niden/T13529-shared-lock-bug
Browse files Browse the repository at this point in the history
[#13529] - Moved the sharedLock in the dialects. PostgreSql and Sqlit…
  • Loading branch information
niden committed Oct 18, 2018
2 parents 28886f3 + f5c70c2 commit a225614
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
13 changes: 0 additions & 13 deletions phalcon/db/dialect.zep
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ abstract class Dialect implements DialectInterface
return sqlQuery . " FOR UPDATE";
}

/**
* Returns a SQL modified with a LOCK IN SHARE MODE clause
*
*<code>
* $sql = $dialect->sharedLock("SELECT * FROM robots");
* echo $sql; // SELECT * FROM robots LOCK IN SHARE MODE
*</code>
*/
public function sharedLock(string! sqlQuery) -> string
{
return sqlQuery . " LOCK IN SHARE MODE";
}

/**
* Gets a list of columns with escaped identifiers
*
Expand Down
13 changes: 13 additions & 0 deletions phalcon/db/dialect/mysql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -752,4 +752,17 @@ class Mysql extends Dialect

return sql;
}

/**
* Returns a SQL modified with a LOCK IN SHARE MODE clause
*
*<code>
* $sql = $dialect->sharedLock("SELECT * FROM robots");
* echo $sql; // SELECT * FROM robots LOCK IN SHARE MODE
*</code>
*/
public function sharedLock(string! sqlQuery) -> string
{
return sqlQuery . " LOCK IN SHARE MODE";
}
}
9 changes: 9 additions & 0 deletions phalcon/db/dialect/postgresql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -678,4 +678,13 @@ class Postgresql extends Dialect
{
return "";
}

/**
* Returns a SQL modified a shared lock statement. For now this method
* returns the original query
*/
public function sharedLock(string! sqlQuery) -> string
{
return sqlQuery;
}
}
9 changes: 9 additions & 0 deletions phalcon/db/dialect/sqlite.zep
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,13 @@ class Sqlite extends Dialect
{
return "";
}

/**
* Returns a SQL modified a shared lock statement. For now this method
* returns the original query
*/
public function sharedLock(string! sqlQuery) -> string
{
return sqlQuery;
}
}

0 comments on commit a225614

Please sign in to comment.