Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void prepare(DbScope scope)
String mdFormat = switch (_dateFormat)
{
case "mdy" -> "MM-dd";
case "dmy" -> "dd-MM";
case "dmy" -> "MM-dd";
default -> throw new IllegalStateException("Unsupported date format: " + _dateFormat);
};

Expand Down Expand Up @@ -171,108 +171,109 @@ public TimestampStatementWrapper(ConnectionWrapper conn, Statement stmt, String
}

@Override
public void setTimestamp(String parameterName, Timestamp x) throws SQLException
public void setTimestamp(String parameterName, Timestamp ts) throws SQLException
{
if (x != null)
if (ts != null)
{
setObject(parameterName, convert(x));
setObject(parameterName, convert(ts), Types.TIMESTAMP);
}
else
{
super.setTimestamp(parameterName, x);
super.setTimestamp(parameterName, ts);
}
}

@Override
public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException
public void setTimestamp(String parameterName, Timestamp ts, Calendar cal) throws SQLException
{
if (x != null)
if (ts != null)
{
setObject(parameterName, convert(x));
setTimestamp(parameterName, ts);
}
else
{
super.setTimestamp(parameterName, x, cal);
super.setTimestamp(parameterName, ts, cal);
}
}

@Override
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
public void setTimestamp(int parameterIndex, Timestamp ts) throws SQLException
{
if (x != null)
if (ts != null)
{
setObject(parameterIndex, convert(x));
setObject(parameterIndex, convert(ts), Types.TIMESTAMP);
}
else
{
super.setTimestamp(parameterIndex, x);
super.setTimestamp(parameterIndex, ts);
}
}

@Override
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
public void setTimestamp(int parameterIndex, Timestamp ts, Calendar cal) throws SQLException
{
if (x != null)
if (ts != null)
{
setObject(parameterIndex, convert(x));
setTimestamp(parameterIndex, ts);
}
else
{
super.setTimestamp(parameterIndex, x, cal);
super.setTimestamp(parameterIndex, ts, cal);
}
}

@Override
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
{
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp)
setObject(parameterIndex, x);
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp ts)
setTimestamp(parameterIndex, ts);
else
super.setObject(parameterIndex, x, targetSqlType, scale);
}

@Override
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
{
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp)
setObject(parameterIndex, x);
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp ts)
setTimestamp(parameterIndex, ts);
else
super.setObject(parameterIndex, x, targetSqlType);
}

@Override
public void setObject(int parameterIndex, Object x) throws SQLException
{
super.setObject(parameterIndex, convert(x));
if (x instanceof Timestamp ts)
setTimestamp(parameterIndex, ts);
else
super.setObject(parameterIndex, x);
}

@Override
public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException
{
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp)
setObject(parameterName, x);
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp ts)
setTimestamp(parameterName, ts);
else
super.setObject(parameterName, x, targetSqlType, scale);
}

@Override
public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
{
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp)
setObject(parameterName, x);
if (targetSqlType == Types.TIMESTAMP && x instanceof Timestamp ts)
setTimestamp(parameterName, ts);
else
super.setObject(parameterName, x, targetSqlType);
}

@Override
public void setObject(String parameterName, Object x) throws SQLException
{
super.setObject(parameterName, convert(x));
}

private Object convert(Object x)
{
return x instanceof Timestamp ts ? convert(ts) : x;
if (x instanceof Timestamp ts)
setTimestamp(parameterName, ts);
else
super.setObject(parameterName, x);
}

private String convert(Timestamp ts)
Expand Down