本文整理匯總了Java中org.jooq.SQLDialect.H2屬性的典型用法代碼示例。如果您正苦於以下問題:Java SQLDialect.H2屬性的具體用法?Java SQLDialect.H2怎麽用?Java SQLDialect.H2使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.jooq.SQLDialect
的用法示例。
在下文中一共展示了SQLDialect.H2屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test15
@Test(timeout = 4000)
public void test15() throws Throwable {
SQLDialect sQLDialect0 = SQLDialect.H2;
DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0);
Product product0 = new Product();
try {
new WorkspaceSnapshot(product0, defaultDSLContext0);
fail("Expecting exception: RuntimeException");
} catch (RuntimeException e) {
//
// Cannot execute query. No Connection configured
//
assertThrownBy("org.jooq.impl.AbstractQuery", e);
}
}
示例2: detectSqlDialect
private SQLDialect detectSqlDialect(DataSource dataSource) throws SQLException {
String databaseProductName;
try (Connection conn = dataSource.getConnection()) {
databaseProductName = conn.getMetaData().getDatabaseProductName();
}
if ("H2".equalsIgnoreCase(databaseProductName)) {
return SQLDialect.H2;
} else if ("MySQL".equalsIgnoreCase(databaseProductName)) {
return SQLDialect.MARIADB;
} else if ("PostgreSQL".equalsIgnoreCase(databaseProductName)) {
return SQLDialect.POSTGRES;
}
throw new IllegalArgumentException("Unknown DB dialect: " + databaseProductName);
}
示例3: parameters
@Parameters(name = "{0}")
public static Object[] parameters() {
return new Object[] { new Object[] { SQLDialect.DERBY, sqlException("42802") },
new Object[] { SQLDialect.H2, sqlException(42000) },
new Object[] { SQLDialect.HSQLDB, sqlException(-22) },
new Object[] { SQLDialect.MARIADB, sqlException(1054) },
new Object[] { SQLDialect.MYSQL, sqlException(1054) },
new Object[] { SQLDialect.POSTGRES, sqlException("03000") },
new Object[] { SQLDialect.POSTGRES_9_3, sqlException("03000") },
new Object[] { SQLDialect.POSTGRES_9_4, sqlException("03000") },
new Object[] { SQLDialect.POSTGRES_9_5, sqlException("03000") } };
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:JooqExceptionTranslatorTests.java
示例4: SQLDialectFromDBEngine
private static SQLDialect SQLDialectFromDBEngine(final EmbeddedDB.DBEngine dbEngine) {
switch (dbEngine) {
case H2:
return SQLDialect.H2;
case MYSQL:
return SQLDialect.MARIADB;
case POSTGRESQL:
return SQLDialect.POSTGRES;
default:
throw new IllegalArgumentException("Unsupported DB engine: " + dbEngine);
}
}
示例5: getSQLDialect
@Override
protected SQLDialect getSQLDialect()
{
return SQLDialect.H2;
}
示例6: testToyExample
/**
* Test with toy data.
*/
@Test
public void testToyExample() {
String url = "jdbc:h2:mem:test";
try (HikariDataSource ds = new HikariDataSource()) {
ds.setJdbcUrl(url);
SQLPreferenceData.create(ds, SQLDialect.H2, "data");
SQLPreferenceData prefs = new SQLPreferenceData(ds, SQLDialect.H2, "data");
String[][] data = new String[][]{
new String[]{"a", "A", "1"},
new String[]{"a", "B", "2"},
new String[]{"a", "E", "3"},
new String[]{"a", "T", "4"},
new String[]{"a", "Q", "5"},
new String[]{"a", "Y", "1"},
new String[]{"a", "H", "2"},
new String[]{"a", "M", "3"},
new String[]{"a", "D", "4"},
new String[]{"b", "A", "5"},
new String[]{"b", "B", "1"},
new String[]{"b", "C", "2"},
new String[]{"b", "D", "3"},
new String[]{"b", "E", "4"},
new String[]{"c", "A", "5"},
new String[]{"c", "C", "1"},
new String[]{"c", "T", "2"},
new String[]{"c", "Y", "3"},
new String[]{"c", "U", "4"},
new String[]{"c", "I", "5"},
new String[]{"c", "O", "1"},
};
int numPreferences = data.length;
int numUsers = (int) of(data).map(p -> p[0]).distinct().count();
int numItems = (int) of(data).map(p -> p[1]).distinct().count();
for (String[] pref : data) {
if (!prefs.containsUser(pref[0])) {
assertTrue(prefs.addUser(pref[0]));
}
if (!prefs.containsItem(pref[1])) {
assertTrue(prefs.addItem(pref[1]));
}
assertTrue(prefs.addPref(pref[0], pref[1], parseDouble(pref[2]), null));
}
assertTrue(prefs.numPreferences() == numPreferences);
assertTrue(prefs.numUsers() == numUsers);
assertTrue(prefs.numItems() == numItems);
assertTrue(prefs.numItems("a") == 9);
assertTrue(prefs.numItems("b") == 5);
assertTrue(prefs.numItems("c") == 7);
assertTrue(prefs.numUsers("A") == 3);
assertTrue(prefs.numUsers("B") == 2);
assertTrue(prefs.removeUser("a"));
assertTrue(prefs.numPreferences() == numPreferences - 9);
}
}
示例7: JooqModule
public JooqModule() {
this(SQLDialect.H2, new Settings().withRenderSchema(false));
}