Skip to content

Commit

Permalink
0004676: Insert into sym_data replaces current_timestamp string with
Browse files Browse the repository at this point in the history
question mark to allow specified timestamp but fails sometimes
  • Loading branch information
Philip Marzullo committed Dec 2, 2020
1 parent 126b9b4 commit 1d90d5f
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -112,6 +112,9 @@ public class DataService extends AbstractService implements IDataService {
private ISymmetricEngine engine;

private IExtensionService extensionService;

private String currentTimestampString = "current_timestamp";
private String scrubbedCurrentTimestampString;

public DataService(ISymmetricEngine engine, IExtensionService extensionService) {
super(engine.getParameterService(), engine.getSymmetricDialect());
Expand All @@ -123,6 +126,7 @@ public DataService(ISymmetricEngine engine, IExtensionService extensionService)
}
setSqlMap(new DataServiceSqlMap(symmetricDialect.getPlatform(),
createSqlReplacementTokens()));
scrubbedCurrentTimestampString = symmetricDialect.getPlatform().scrubSql(currentTimestampString);
}

protected Map<IHeartbeatListener, Long> lastHeartbeatTimestamps = new HashMap<IHeartbeatListener, Long>();
Expand Down Expand Up @@ -2047,7 +2051,7 @@ public long insertData(ISqlTransaction transaction, final Data data) {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.NUMERIC, Types.VARCHAR, Types.VARCHAR };

if (data.getCreateTime() != null) {
sql = sql.replace("current_timestamp", "?");
sql = sql.replace(scrubbedCurrentTimestampString, "?");
args = ArrayUtils.add(args, data.getCreateTime());
types = ArrayUtils.add(types, Types.TIMESTAMP);
}
Expand Down

0 comments on commit 1d90d5f

Please sign in to comment.