Implement generic delete method
parent
06ecdf1967
commit
23438e66e7
|
@ -48,7 +48,8 @@ namespace OpenSim.Data
|
||||||
|
|
||||||
PresenceData Get(UUID principalID);
|
PresenceData Get(UUID principalID);
|
||||||
|
|
||||||
bool SetDataItem(UUID principalID, string item, string value);
|
bool SetUserDataItem(UUID principalID, string item, string value);
|
||||||
|
bool SetRegionDataItem(UUID principalID, string item, string value);
|
||||||
|
|
||||||
bool Delete(UUID regionID);
|
bool Delete(UUID regionID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL
|
||||||
for (int i = 0 ; i < fields.Length ; i++)
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||||
terms.Add(fields[i] + " = ?" + fields[i]);
|
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
string where = String.Join(" and ", terms.ToArray());
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
|
@ -198,5 +198,18 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Delete(string field, string val)
|
||||||
|
{
|
||||||
|
MySqlCommand cmd = new MySqlCommand();
|
||||||
|
|
||||||
|
cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field);
|
||||||
|
cmd.Parameters.AddWithValue(field, val);
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue