-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed validation of name on setName and unsafe keyword parsing for al…
…ter, issue #3791
- Loading branch information
Showing
3 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
core/src/test/java/com/orientechnologies/orient/core/sql/SQLAlterClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.orientechnologies.orient.core.sql; | ||
|
||
import static org.testng.AssertJUnit.assertNotNull; | ||
|
||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; | ||
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; | ||
import com.orientechnologies.orient.core.exception.OSchemaException; | ||
|
||
public class SQLAlterClassTest { | ||
|
||
@Test | ||
public void alterClassRenameTest() { | ||
ODatabaseDocument db = new ODatabaseDocumentTx("memory:" + SQLAlterClassTest.class.getName()); | ||
db.create(); | ||
try { | ||
db.getMetadata().getSchema().createClass("TestClass"); | ||
|
||
try { | ||
db.command(new OCommandSQL("alter class TestClass name = 'test_class'")).execute(); | ||
Assert.fail("the rename should fail for wrong syntax"); | ||
} catch (OSchemaException ex) { | ||
|
||
} | ||
assertNotNull(db.getMetadata().getSchema().getClass("TestClass")); | ||
|
||
} finally { | ||
db.drop(); | ||
} | ||
} | ||
|
||
} |