Search in sources :

Example 1 with AstUpdate

use of com.developmentontheedge.sql.model.AstUpdate in project be5 by DevelopmentOnTheEdge.

the class AstUpdateBuildTest method testWhere.

@Test
public void testWhere() {
    AstUpdate update = Ast.update("users").set(Collections.singletonMap("name", "Test")).where(Collections.singletonMap("name", "test"));
    assertEquals("UPDATE users SET name ='Test' WHERE name =?", update.format());
}
Also used : AstUpdate(com.developmentontheedge.sql.model.AstUpdate) Test(org.junit.Test)

Example 2 with AstUpdate

use of com.developmentontheedge.sql.model.AstUpdate in project be5 by DevelopmentOnTheEdge.

the class AstUpdateBuildTest method test.

@Test
public void test() {
    AstUpdate update = Ast.update("users").set(Collections.singletonMap("name", "Test"));
    assertEquals("UPDATE users SET name ='Test'", update.format());
}
Also used : AstUpdate(com.developmentontheedge.sql.model.AstUpdate) Test(org.junit.Test)

Example 3 with AstUpdate

use of com.developmentontheedge.sql.model.AstUpdate in project be5 by DevelopmentOnTheEdge.

the class AstUpdateBuildTest method testAstFieldReference.

@Test
public void testAstFieldReference() {
    AstUpdate update = Ast.update("users").set(Collections.singletonMap(new AstFieldReference("___name", true), "Test"));
    assertEquals("UPDATE users SET \"___name\"='Test'", update.format());
}
Also used : AstUpdate(com.developmentontheedge.sql.model.AstUpdate) AstFieldReference(com.developmentontheedge.sql.model.AstFieldReference) Test(org.junit.Test)

Example 4 with AstUpdate

use of com.developmentontheedge.sql.model.AstUpdate in project be5 by DevelopmentOnTheEdge.

the class AstUpdateBuildTest method testEscapedColumns.

@Test
public void testEscapedColumns() {
    AstUpdate update = Ast.update("users").set(Collections.singletonMap("___name", "Test"));
    assertEquals("UPDATE users SET \"___name\"='Test'", update.format());
}
Also used : AstUpdate(com.developmentontheedge.sql.model.AstUpdate) Test(org.junit.Test)

Example 5 with AstUpdate

use of com.developmentontheedge.sql.model.AstUpdate in project be5 by DevelopmentOnTheEdge.

the class AstUpdateBuildTest method testWhereIN.

@Test
public void testWhereIN() {
    AstUpdate update = Ast.update("users").set(Collections.singletonMap("name", "Test")).whereInPredicate("ID", 3);
    assertEquals("UPDATE users SET name ='Test' WHERE ID IN (?, ?, ?)", update.format());
}
Also used : AstUpdate(com.developmentontheedge.sql.model.AstUpdate) Test(org.junit.Test)

Aggregations

AstUpdate (com.developmentontheedge.sql.model.AstUpdate)6 Test (org.junit.Test)6 AstFieldReference (com.developmentontheedge.sql.model.AstFieldReference)1 HashMap (java.util.HashMap)1