You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2019/11/18 15:32:46 UTC
[empire-db] branch master updated: EMPIREDB-282 null check for
timestamp value
This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push:
new 255a099 EMPIREDB-282 null check for timestamp value
255a099 is described below
commit 255a099c545d6965a246cc2d07d3e3df52613af4
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Mon Nov 18 16:32:42 2019 +0100
EMPIREDB-282
null check for timestamp value
---
.../src/main/java/org/apache/empire/db/DBRowSet.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java b/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
index a5085bc..891c04f 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRowSet.java
@@ -746,7 +746,8 @@ public abstract class DBRowSet extends DBExpr
DBTableColumn col = (DBTableColumn) columns.get(i);
if (timestampColumn == col)
{ // Make sure the update timestamp column is set
- cmd.set(col.to(timestamp));
+ if (timestamp!=null)
+ cmd.set(col.to(timestamp));
continue;
}
boolean empty = ObjectUtils.isEmpty(value);
@@ -814,10 +815,12 @@ public abstract class DBRowSet extends DBExpr
value = cmd.addParam(col, value);
cmd.where(col.is(value));
}
- else if (log.isDebugEnabled()) {
- log.debug("updateRecord has no value for timestamp column. Concurrent changes will not be detected.");
- }
- cmd.set(col.to(timestamp));
+ else if (value!=ObjectUtils.NO_VALUE) {
+ log.warn("updateRecord has no value for timestamp column. Concurrent changes will not be detected.");
+ }
+ // set new timestamp
+ if (timestamp!=null)
+ cmd.set(col.to(timestamp));
}
else if (modified && value!=ObjectUtils.NO_VALUE)
{ // Update a field
@@ -858,8 +861,8 @@ public abstract class DBRowSet extends DBExpr
throw new RecordUpdateFailedException(this, getRecordKey(rec));
}
// Correct Timestamp
- if (timestampColumn != null)
- { // Set the correct Timestamp
+ if (timestampColumn!=null && timestamp!=null)
+ { // Set the correct Timestamp
int i = rec.getFieldIndex(timestampColumn);
if (i >= 0)
fields[i] = timestamp;