Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return value of CREATE PROPERTY for DEFAULT attribute #1831

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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 @@ -53,7 +53,15 @@ public CreatePropertyAttributeStatement copy() {

public Object setOnProperty(final Property internalProp, final CommandContext context) {
final String attrName = settingName.getStringValue();
final Object attrValue = this.settingValue == null ? true : this.settingValue.execute((Identifiable) null, context);
final Object attrValue;
if (this.settingValue == null) {
attrValue = true;
} else if (attrName.equalsIgnoreCase("default")) {
attrValue = this.settingValue.toString();
} else {
attrValue = this.settingValue.execute((Identifiable) null, context);
}

try {
if (attrName.equalsIgnoreCase("readonly")) {
internalProp.setReadonly((boolean) attrValue);
Expand All @@ -68,7 +76,7 @@ public Object setOnProperty(final Property internalProp, final CommandContext co
} else if (attrName.equalsIgnoreCase("default")) {
if (this.settingValue == null)
throw new CommandExecutionException("Default value not set");
internalProp.setDefaultValue(this.settingValue.toString());
internalProp.setDefaultValue("" + attrValue);
} else if (attrName.equalsIgnoreCase("regexp")) {
internalProp.setRegexp("" + attrValue);
} else {
Expand Down
Loading