Could not use "replace" as it is not supported by Postgres

This commit is contained in:
JT Smith 2002-12-04 18:58:26 +00:00
parent f5a68ba7a8
commit 96587791c0

View file

@ -18,18 +18,16 @@ sub saveParams {
($uid, $authMethod, $data) = @_; ($uid, $authMethod, $data) = @_;
foreach (keys(%$data)) { foreach (keys(%$data)) {
my $sql = "replace into authentication set userId=$uid, authMethod=".quote($authMethod).", fieldData=".quote($$data{$_}).", fieldName=".quote($_); WebGUI::SQL->write("delete from authentication where userId=$uid and authMethod=".quote($authMethod)." and fieldName=".quote($_));
WebGUI::SQL->write($sql); WebGUI::SQL->write("insert into authentication (userId,authMethod,fieldData,fieldName) values ($uid,".quote($authMethod).",".quote($$data{$_}).",".quote($_).")");
} }
} }
sub getParams { sub getParams {
my ($uid, $authMethod, $data); my ($uid, $authMethod);
$uid = shift; $uid = shift;
$authMethod = shift; $authMethod = shift;
$data = WebGUI::SQL->buildHashRef("select fieldName, fieldData from authentication where userId=$uid and authMethod='$authMethod'"); return WebGUI::SQL->buildHashRef("select fieldName, fieldData from authentication where userId=$uid and authMethod='$authMethod'");
return $data;
} }
sub deleteParams { sub deleteParams {