Search in sources :

Example 1 with DialectException

use of com.github.drinkjava2.jdialects.DialectException in project jDialects by drinkjava2.

the class DialectTest method testPagination.

@Test
public void testPagination() {
    Dialect[] dialects = Dialect.values();
    for (Dialect dialect : dialects) {
        System.out.println("=========" + dialect + "==========");
        String result = "";
        try {
            System.out.println(dialect);
            result = dialect.paginate(1, 10, sql1);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.paginate(3, 10, sql1);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.paginate(1, 10, sql2);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.paginate(3, 10, sql2);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
    }
}
Also used : DialectException(com.github.drinkjava2.jdialects.DialectException) DerbyDialect(com.github.drinkjava2.jdialects.Dialect.DerbyDialect) PostgresPlusDialect(com.github.drinkjava2.jdialects.Dialect.PostgresPlusDialect) DB2Dialect(com.github.drinkjava2.jdialects.Dialect.DB2Dialect) Dialect(com.github.drinkjava2.jdialects.Dialect) MySQLDialect(com.github.drinkjava2.jdialects.Dialect.MySQLDialect) PostgreSQL81Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL81Dialect) PostgreSQL9Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL9Dialect) Oracle10gDialect(com.github.drinkjava2.jdialects.Dialect.Oracle10gDialect) PostgreSQL82Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL82Dialect) SybaseASE15Dialect(com.github.drinkjava2.jdialects.Dialect.SybaseASE15Dialect) SybaseAnywhereDialect(com.github.drinkjava2.jdialects.Dialect.SybaseAnywhereDialect) DerbyTenSixDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect) SQLServerDialect(com.github.drinkjava2.jdialects.Dialect.SQLServerDialect) HSQLDialect(com.github.drinkjava2.jdialects.Dialect.HSQLDialect) DerbyTenSevenDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect) H2Dialect(com.github.drinkjava2.jdialects.Dialect.H2Dialect) Oracle8iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle8iDialect) Oracle9iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle9iDialect) InformixDialect(com.github.drinkjava2.jdialects.Dialect.InformixDialect) SQLiteDialect(com.github.drinkjava2.jdialects.Dialect.SQLiteDialect) MySQL5Dialect(com.github.drinkjava2.jdialects.Dialect.MySQL5Dialect) DB2400Dialect(com.github.drinkjava2.jdialects.Dialect.DB2400Dialect) IngresDialect(com.github.drinkjava2.jdialects.Dialect.IngresDialect) DerbyTenFiveDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect) Test(org.junit.Test)

Example 2 with DialectException

use of com.github.drinkjava2.jdialects.DialectException in project jDialects by drinkjava2.

the class DialectTest method testPagination2.

@Test
public void testPagination2() {
    Dialect[] dialects = Dialect.values();
    for (Dialect dialect : dialects) {
        System.out.println("=========" + dialect + "==========");
        String result = "";
        try {
            result = dialect.paginate(1, 10, sql3);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.paginate(3, 10, sql4);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.paginate(1, 10, sql3);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.paginate(3, 10, sql4);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
    }
}
Also used : DialectException(com.github.drinkjava2.jdialects.DialectException) DerbyDialect(com.github.drinkjava2.jdialects.Dialect.DerbyDialect) PostgresPlusDialect(com.github.drinkjava2.jdialects.Dialect.PostgresPlusDialect) DB2Dialect(com.github.drinkjava2.jdialects.Dialect.DB2Dialect) Dialect(com.github.drinkjava2.jdialects.Dialect) MySQLDialect(com.github.drinkjava2.jdialects.Dialect.MySQLDialect) PostgreSQL81Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL81Dialect) PostgreSQL9Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL9Dialect) Oracle10gDialect(com.github.drinkjava2.jdialects.Dialect.Oracle10gDialect) PostgreSQL82Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL82Dialect) SybaseASE15Dialect(com.github.drinkjava2.jdialects.Dialect.SybaseASE15Dialect) SybaseAnywhereDialect(com.github.drinkjava2.jdialects.Dialect.SybaseAnywhereDialect) DerbyTenSixDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect) SQLServerDialect(com.github.drinkjava2.jdialects.Dialect.SQLServerDialect) HSQLDialect(com.github.drinkjava2.jdialects.Dialect.HSQLDialect) DerbyTenSevenDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect) H2Dialect(com.github.drinkjava2.jdialects.Dialect.H2Dialect) Oracle8iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle8iDialect) Oracle9iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle9iDialect) InformixDialect(com.github.drinkjava2.jdialects.Dialect.InformixDialect) SQLiteDialect(com.github.drinkjava2.jdialects.Dialect.SQLiteDialect) MySQL5Dialect(com.github.drinkjava2.jdialects.Dialect.MySQL5Dialect) DB2400Dialect(com.github.drinkjava2.jdialects.Dialect.DB2400Dialect) IngresDialect(com.github.drinkjava2.jdialects.Dialect.IngresDialect) DerbyTenFiveDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect) Test(org.junit.Test)

Example 3 with DialectException

use of com.github.drinkjava2.jdialects.DialectException in project jDialects by drinkjava2.

the class SortedUUIDGenerator method getNextID.

@Override
public Object getNextID(NormalJdbcTool jdbc, Dialect dialect, Type dataType) {
    String s = "" + AutoIdGenerator.INSTANCE.getNextID(jdbc, dialect, dataType);
    if (s.length() > (sortedLength - 1))
        throw new DialectException("SortedLength should set bigger than auto generated ID length");
    StringBuilder sb = new StringBuilder("1");
    for (int i = 1; i < sortedLength - s.length(); i++) sb.append("0");
    sb.append(s);
    sb.append(UUIDAnyGenerator.getAnyLengthRadix36UUID(uuidLength));
    return sb.toString();
}
Also used : DialectException(com.github.drinkjava2.jdialects.DialectException)

Example 4 with DialectException

use of com.github.drinkjava2.jdialects.DialectException in project jDialects by drinkjava2.

the class DialectTest method testPagination2.

@Test
public void testPagination2() {
    Dialect[] dialects = Dialect.values();
    for (Dialect dialect : dialects) {
        System.out.println("=========" + dialect + "==========");
        String result = "";
        try {
            result = dialect.pagin(1, 10, sql3);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.pagin(3, 10, sql4);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.pagin(1, 10, sql3);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
        try {
            result = dialect.pagin(3, 10, sql4);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        Assert.assertTrue(StrUtils.isEmpty(result) || 1 == StrUtils.countMatches(result, '?'));
    }
}
Also used : DialectException(com.github.drinkjava2.jdialects.DialectException) DerbyDialect(com.github.drinkjava2.jdialects.Dialect.DerbyDialect) PostgresPlusDialect(com.github.drinkjava2.jdialects.Dialect.PostgresPlusDialect) DB2Dialect(com.github.drinkjava2.jdialects.Dialect.DB2Dialect) Dialect(com.github.drinkjava2.jdialects.Dialect) PostgreSQL81Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL81Dialect) MySQLInnoDBDialect(com.github.drinkjava2.jdialects.Dialect.MySQLInnoDBDialect) PostgreSQL9Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL9Dialect) Oracle10gDialect(com.github.drinkjava2.jdialects.Dialect.Oracle10gDialect) PostgreSQL82Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL82Dialect) SybaseASE15Dialect(com.github.drinkjava2.jdialects.Dialect.SybaseASE15Dialect) MySQL5InnoDBDialect(com.github.drinkjava2.jdialects.Dialect.MySQL5InnoDBDialect) SybaseAnywhereDialect(com.github.drinkjava2.jdialects.Dialect.SybaseAnywhereDialect) DerbyTenSixDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect) SQLServerDialect(com.github.drinkjava2.jdialects.Dialect.SQLServerDialect) HSQLDialect(com.github.drinkjava2.jdialects.Dialect.HSQLDialect) DerbyTenSevenDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect) H2Dialect(com.github.drinkjava2.jdialects.Dialect.H2Dialect) Oracle8iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle8iDialect) Oracle9iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle9iDialect) InformixDialect(com.github.drinkjava2.jdialects.Dialect.InformixDialect) SQLiteDialect(com.github.drinkjava2.jdialects.Dialect.SQLiteDialect) DB2400Dialect(com.github.drinkjava2.jdialects.Dialect.DB2400Dialect) IngresDialect(com.github.drinkjava2.jdialects.Dialect.IngresDialect) DerbyTenFiveDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect) Test(org.junit.Test)

Example 5 with DialectException

use of com.github.drinkjava2.jdialects.DialectException in project jDialects by drinkjava2.

the class DialectTest method testPagination.

@Test
public void testPagination() {
    Dialect[] dialects = Dialect.values();
    for (Dialect dialect : dialects) {
        System.out.println("=========" + dialect + "==========");
        String result = "";
        try {
            System.out.println(dialect);
            result = dialect.pagin(1, 10, sql1);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.pagin(3, 10, sql1);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.pagin(1, 10, sql2);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
        try {
            result = dialect.pagin(3, 10, sql2);
            System.out.println(result);
        } catch (DialectException e) {
            System.out.println("Error:" + e.getMessage());
        }
        Assert.assertFalse(result.contains("$"));
    }
}
Also used : DialectException(com.github.drinkjava2.jdialects.DialectException) DerbyDialect(com.github.drinkjava2.jdialects.Dialect.DerbyDialect) PostgresPlusDialect(com.github.drinkjava2.jdialects.Dialect.PostgresPlusDialect) DB2Dialect(com.github.drinkjava2.jdialects.Dialect.DB2Dialect) Dialect(com.github.drinkjava2.jdialects.Dialect) PostgreSQL81Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL81Dialect) MySQLInnoDBDialect(com.github.drinkjava2.jdialects.Dialect.MySQLInnoDBDialect) PostgreSQL9Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL9Dialect) Oracle10gDialect(com.github.drinkjava2.jdialects.Dialect.Oracle10gDialect) PostgreSQL82Dialect(com.github.drinkjava2.jdialects.Dialect.PostgreSQL82Dialect) SybaseASE15Dialect(com.github.drinkjava2.jdialects.Dialect.SybaseASE15Dialect) MySQL5InnoDBDialect(com.github.drinkjava2.jdialects.Dialect.MySQL5InnoDBDialect) SybaseAnywhereDialect(com.github.drinkjava2.jdialects.Dialect.SybaseAnywhereDialect) DerbyTenSixDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect) SQLServerDialect(com.github.drinkjava2.jdialects.Dialect.SQLServerDialect) HSQLDialect(com.github.drinkjava2.jdialects.Dialect.HSQLDialect) DerbyTenSevenDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect) H2Dialect(com.github.drinkjava2.jdialects.Dialect.H2Dialect) Oracle8iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle8iDialect) Oracle9iDialect(com.github.drinkjava2.jdialects.Dialect.Oracle9iDialect) InformixDialect(com.github.drinkjava2.jdialects.Dialect.InformixDialect) SQLiteDialect(com.github.drinkjava2.jdialects.Dialect.SQLiteDialect) DB2400Dialect(com.github.drinkjava2.jdialects.Dialect.DB2400Dialect) IngresDialect(com.github.drinkjava2.jdialects.Dialect.IngresDialect) DerbyTenFiveDialect(com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect) Test(org.junit.Test)

Aggregations

DialectException (com.github.drinkjava2.jdialects.DialectException)6 TableModel (com.github.drinkjava2.jdialects.model.TableModel)5 Dialect (com.github.drinkjava2.jdialects.Dialect)4 DB2400Dialect (com.github.drinkjava2.jdialects.Dialect.DB2400Dialect)4 DB2Dialect (com.github.drinkjava2.jdialects.Dialect.DB2Dialect)4 DerbyDialect (com.github.drinkjava2.jdialects.Dialect.DerbyDialect)4 DerbyTenFiveDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect)4 DerbyTenSevenDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect)4 DerbyTenSixDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect)4 H2Dialect (com.github.drinkjava2.jdialects.Dialect.H2Dialect)4 HSQLDialect (com.github.drinkjava2.jdialects.Dialect.HSQLDialect)4 InformixDialect (com.github.drinkjava2.jdialects.Dialect.InformixDialect)4 IngresDialect (com.github.drinkjava2.jdialects.Dialect.IngresDialect)4 Oracle10gDialect (com.github.drinkjava2.jdialects.Dialect.Oracle10gDialect)4 Oracle8iDialect (com.github.drinkjava2.jdialects.Dialect.Oracle8iDialect)4 Oracle9iDialect (com.github.drinkjava2.jdialects.Dialect.Oracle9iDialect)4 PostgreSQL81Dialect (com.github.drinkjava2.jdialects.Dialect.PostgreSQL81Dialect)4 PostgreSQL82Dialect (com.github.drinkjava2.jdialects.Dialect.PostgreSQL82Dialect)4 PostgreSQL9Dialect (com.github.drinkjava2.jdialects.Dialect.PostgreSQL9Dialect)4 PostgresPlusDialect (com.github.drinkjava2.jdialects.Dialect.PostgresPlusDialect)4