DB Backup Bug
This commit is contained in:
@@ -92,8 +92,27 @@ public class DatabaseManagementService {
|
||||
sqlDump.append(value.toString());
|
||||
} else {
|
||||
// Handle all other types as strings (String, UUID, Timestamp, CLOB, TEXT, etc.)
|
||||
// Escape single quotes and wrap in quotes
|
||||
String escapedValue = value.toString().replace("'", "''");
|
||||
String stringValue;
|
||||
|
||||
// Special handling for CLOB types
|
||||
if (value instanceof Clob) {
|
||||
Clob clob = (Clob) value;
|
||||
try {
|
||||
stringValue = clob.getSubString(1, (int) clob.length());
|
||||
} catch (SQLException e) {
|
||||
stringValue = value.toString();
|
||||
}
|
||||
} else {
|
||||
stringValue = value.toString();
|
||||
}
|
||||
|
||||
// Debug: log if we're dealing with a large content field
|
||||
if (stringValue.length() > 1000) {
|
||||
System.out.println("Processing large field (length: " + stringValue.length() + ") with quotes: " + stringValue.contains("'") + " type: " + value.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
// Escape single quotes by replacing ' with ''
|
||||
String escapedValue = stringValue.replace("'", "''");
|
||||
sqlDump.append("'").append(escapedValue).append("'");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user