mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-29 18:53:12 +08:00
fix(chat2db-oracle): correct timestamp scale
This commit is contained in:
@ -21,12 +21,14 @@ public class OracleTimeStampTZProcessor extends DefaultValueProcessor {
|
||||
|
||||
@Override
|
||||
public String convertJDBCValueByType(JDBCDataValue dataValue) {
|
||||
//2024-06-05 17:41:27.52 +0:00 ->
|
||||
String timeStampString = dataValue.getStringValue();
|
||||
int scale = dataValue.getScale();
|
||||
int lastSpaceIndex = timeStampString.lastIndexOf(" ");
|
||||
int nanosLength = lastSpaceIndex - timeStampString.indexOf(".") - 1;
|
||||
if (scale != 0 && nanosLength < scale) {
|
||||
int lastDotIndex = timeStampString.indexOf(".");
|
||||
int nanosLength = lastSpaceIndex - lastDotIndex - 1;
|
||||
if (scale == 0) {
|
||||
return timeStampString.substring(0, lastDotIndex) + timeStampString.substring(lastDotIndex + 2);
|
||||
} else if (nanosLength < scale) {
|
||||
// 计算需要补充的零的数量
|
||||
int zerosToAdd = scale - nanosLength;
|
||||
StringBuilder sb = new StringBuilder(timeStampString);
|
||||
|
Reference in New Issue
Block a user