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("$"));
}
}
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, '?'));
}
}
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();
}
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, '?'));
}
}
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("$"));
}
}
Aggregations