промежуточный. Рефакторинг публикации теста из текущего проекта.
This commit is contained in:
@@ -77,23 +77,14 @@ public abstract class Database {
|
||||
table.Data.put(o.getPK(), o);
|
||||
return o;
|
||||
}
|
||||
public DBObject InsertWithCheck(DBObject o) throws Exception {
|
||||
DBTable table = tables.get(o.getClass());
|
||||
if (!table.Data.containsKey(o.getPK())) {
|
||||
insert(table, o);
|
||||
table.Data.put(o.getPK(), o);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " уже содержит объект с ключом " + Utils.Brackets(o.getPK().toString()));
|
||||
return o;
|
||||
}
|
||||
public DBObject InsertWithCheck_(DBObject o) throws Exception {
|
||||
DBTable table = tables.get(o.getClass());
|
||||
if (!table.Data.containsKey(o.getPK())) {
|
||||
insert(table, o);
|
||||
table.Data.put(o.getPK(), o);
|
||||
return o;
|
||||
}
|
||||
return null;
|
||||
//метод для вставки в серверную базу.
|
||||
public DBObject InsertS(DBObject object) throws Exception {
|
||||
DBTable table = tables.get(object.getClass());
|
||||
if (!(object instanceof iDBObject) && table.Data.containsKey(object.getPK()))
|
||||
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " уже содержит объект с ключом " + Utils.Brackets(object.getPK().toString()));
|
||||
insert(table, object);
|
||||
table.Data.put(object.getPK(), object);
|
||||
return object;
|
||||
}
|
||||
// не работает с автоинкрементом.
|
||||
public DBObject UpdateWithCheck(DBObject to_update) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user