Skip to content

Commit

Permalink
fix: SQL INSERT, improved the exception in case the type name is missing
Browse files Browse the repository at this point in the history
Fixed issue #1612
  • Loading branch information
lvca committed May 24, 2024
1 parent 2fdb6a2 commit 1ae471a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.arcadedb.query.sql.executor;

import com.arcadedb.database.MutableDocument;
import com.arcadedb.exception.CommandSQLParsingException;
import com.arcadedb.exception.TimeoutException;
import com.arcadedb.schema.DocumentType;
import com.arcadedb.schema.LocalEdgeType;
Expand All @@ -36,6 +37,10 @@ public class CreateRecordStep extends AbstractExecutionStep {

public CreateRecordStep(final String typeName, final CommandContext context, final int total) {
super(context);

if (typeName == null || typeName.isEmpty())
throw new CommandSQLParsingException("Record type is not specified");

this.typeName = typeName;
this.total = total;
}
Expand Down Expand Up @@ -77,7 +82,7 @@ else if (type instanceof LocalEdgeType)

return new UpdatableResult(instance);
} finally {
if( context.isProfiling() ) {
if (context.isProfiling()) {
cost += (System.nanoTime() - begin);
}
}
Expand All @@ -92,7 +97,7 @@ public String prettyPrint(final int depth, final int indent) {
final StringBuilder result = new StringBuilder();
result.append(spaces);
result.append("+ CREATE EMPTY RECORDS");
if( context.isProfiling() ) {
if (context.isProfiling()) {
result.append(" (").append(getCostFormatted()).append(")");
}
result.append("\n");
Expand Down

0 comments on commit 1ae471a

Please sign in to comment.