use of net.sf.jsqlparser.statement.DeclareStatement.TypeDefExpr in project JSqlParser by JSQLParser.
the class DeclareStatementTest method testDeclareTypeList.
@Test
public void testDeclareTypeList() throws JSQLParserException {
String statement = "DECLARE @group nvarchar (50), @sales money";
Statement parsed = assertSqlCanBeParsedAndDeparsed(statement);
DeclareStatement created = new DeclareStatement().addTypeDefExprList(asList(new TypeDefExpr(new UserVariable().withName("group"), new ColDataType().withDataType("nvarchar").addArgumentsStringList("50"), null), new TypeDefExpr(new UserVariable().withName("sales"), new ColDataType().withDataType("money"), null))).withDeclareType(DeclareType.TYPE);
assertDeparse(created, statement);
assertEqualsObjectTree(parsed, created);
}
use of net.sf.jsqlparser.statement.DeclareStatement.TypeDefExpr in project JSqlParser by JSQLParser.
the class DeclareStatementTest method testDeclareTypeWithDefault.
@Test
public void testDeclareTypeWithDefault() throws JSQLParserException {
String statement = "DECLARE @find varchar (30) = 'Man%'";
Statement parsed = assertSqlCanBeParsedAndDeparsed(statement);
DeclareStatement created = new DeclareStatement().addTypeDefExprList(new TypeDefExpr(new UserVariable().withName("find"), new ColDataType().withDataType("varchar").addArgumentsStringList("30"), new StringValue().withValue("Man%"))).withDeclareType(DeclareType.TYPE);
assertDeparse(created, statement);
assertEqualsObjectTree(parsed, created);
}
use of net.sf.jsqlparser.statement.DeclareStatement.TypeDefExpr in project JSqlParser by JSQLParser.
the class DeclareStatementTest method testDeclareType.
@Test
public void testDeclareType() throws JSQLParserException {
String statement = "DECLARE @find nvarchar (30)";
Statement parsed = assertSqlCanBeParsedAndDeparsed(statement);
DeclareStatement created = new DeclareStatement().addTypeDefExprList(new TypeDefExpr(new UserVariable().withName("find"), new ColDataType().withDataType("nvarchar").addArgumentsStringList("30"), null)).withDeclareType(DeclareType.TYPE);
assertDeparse(created, statement);
assertEqualsObjectTree(parsed, created);
}
Aggregations