Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
ON DUPLICATE KEY not supported by sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 11, 2013
1 parent 3cb7689 commit ed2d4e4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/src/plugins/conf.sql/class.sqlConfDriver.php
Expand Up @@ -513,13 +513,18 @@ function filterUsersByGroup(&$flatUsersList, $baseGroup = "/", $fullTree = false
* @param string $groupLabel
* @return mixed
*/
function createGroup($groupPath, $groupLabel){
dibi::query(
"INSERT INTO [ajxp_groups]",
array("groupPath" => $groupPath, "groupLabel" => $groupLabel),
"ON DUPLICATE KEY UPDATE %a",
array("groupPath" => $groupPath, "groupLabel" => $groupLabel)
);
public function createGroup($groupPath, $groupLabel)
{
$test = dibi::query("SELECT groupPath FROM [ajxp_groups] WHERE groupPath = %s", $groupPath);
$res = $test->fetchAll();
if(count($res)){
dibi::query("UPDATE [ajxp_groups] SET [groupLabel]=%s WHERE [groupPath]=%s", $groupLabel, $groupPath);
}else{
dibi::query(
"INSERT INTO [ajxp_groups]",
array("groupPath" => $groupPath, "groupLabel" => $groupLabel)
);
}
}

function relabelGroup($groupPath, $groupLabel){
Expand Down

0 comments on commit ed2d4e4

Please sign in to comment.