|
|
|
|
@ -14,6 +14,7 @@ import static java.lang.System.Logger.Level.ERROR;
@@ -14,6 +14,7 @@ import static java.lang.System.Logger.Level.ERROR;
|
|
|
|
|
import static java.lang.System.Logger.Level.WARNING; |
|
|
|
|
import static java.text.MessageFormat.format; |
|
|
|
|
|
|
|
|
|
import de.srsoftware.tools.jdbc.Query; |
|
|
|
|
import de.srsoftware.umbrella.core.BaseDb; |
|
|
|
|
import de.srsoftware.umbrella.core.model.*; |
|
|
|
|
import de.srsoftware.umbrella.core.model.Location; |
|
|
|
|
@ -56,6 +57,16 @@ public class SqliteDb extends BaseDb implements StockDb {
@@ -56,6 +57,16 @@ public class SqliteDb extends BaseDb implements StockDb {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Location delete(DbLocation location) { |
|
|
|
|
try { |
|
|
|
|
Query.delete().from(TABLE_LOCATIONS).where(ID,equal(location.id())).execute(db); |
|
|
|
|
return location; |
|
|
|
|
} catch (SQLException e){ |
|
|
|
|
throw databaseException("Failed to delete \"{0}\"",location.name()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* id, owner, owner_id, code, name, location_id |
|
|
|
|
* @throws SQLException |
|
|
|
|
@ -333,7 +344,7 @@ public class SqliteDb extends BaseDb implements StockDb {
@@ -333,7 +344,7 @@ public class SqliteDb extends BaseDb implements StockDb {
|
|
|
|
|
rs.close(); |
|
|
|
|
if (prop == null) throw databaseException("Failed to add new property to item {0}",itemId); |
|
|
|
|
if ("".equals(value)){ |
|
|
|
|
delete().from(TABLE_ITEM_PROPERTIES).where(ITEM_ID,equal(itemId)).where(PROPERTY_ID,equal(existingPropId)).execute(db); |
|
|
|
|
Query.delete().from(TABLE_ITEM_PROPERTIES).where(ITEM_ID,equal(itemId)).where(PROPERTY_ID,equal(existingPropId)).execute(db); |
|
|
|
|
} else { |
|
|
|
|
replaceInto(TABLE_ITEM_PROPERTIES,ITEM_ID,PROPERTY_ID,VALUE).values(itemId,existingPropId,value).execute(db); |
|
|
|
|
} |
|
|
|
|
|