mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#912 - Refactor - move platform specfic code into subpackages
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.avaje;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) throws SQLException {
|
||||
|
||||
|
||||
EbeanServer ms = Ebean.getServer("ms");
|
||||
DataSource dataSource = ms.getPluginApi().getDataSource();
|
||||
|
||||
Connection connection = dataSource.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement("select next VALUE for j2_seq");
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
if (resultSet.next()) {
|
||||
Object val = resultSet.getObject(1);
|
||||
System.out.println(""+val);
|
||||
}
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.TenantDataSourceProvider;
|
||||
import com.avaje.ebean.config.TenantMode;
|
||||
import com.avaje.ebean.config.TenantSchemaProvider;
|
||||
import com.avaje.ebean.config.dbplatform.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.DbTypeConfig;
|
||||
import com.avaje.ebean.config.Platform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -22,4 +23,4 @@ public class H2PlatformTest {
|
||||
assertThat(ddl.convert("bit", false)).isEqualTo("bit");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.mysql.MySqlHistorySupport;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.DbTypeConfig;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.DbTypeConfig;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresHistorySupport;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.avaje.ebean.config.dbplatform;
|
||||
|
||||
import com.avaje.ebean.config.DbTypeConfig;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.platform.PlatformDdl;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.avaje.ebean.dbmigration.ddlgeneration;
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.ebean.dbmigration.migration.ChangeSet;
|
||||
import com.avaje.ebean.dbmigration.model.CurrentModel;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
@@ -142,4 +142,4 @@ public class BaseDdlHandlerTest extends BaseTestCase {
|
||||
assertThat(write.dropAll().getBuffer()).isEqualTo(rollbackLast);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,8 +2,8 @@ package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.OraclePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.DdlWrite;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.Helper;
|
||||
import com.avaje.ebean.dbmigration.migration.AddTableComment;
|
||||
@@ -146,4 +146,4 @@ public class BaseTableDdlTest {
|
||||
|
||||
return createTable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.DdlWrite;
|
||||
import com.avaje.ebean.dbmigration.model.CurrentModel;
|
||||
import com.avaje.ebean.dbmigration.model.MConfiguration;
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.SqlServerPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.OraclePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.sqlserver.SqlServerPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.ebean.dbmigration.migration.AlterColumn;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.SqlServerPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.OraclePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.sqlserver.SqlServerPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.DbPlatformTypeMapping;
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.ebean.dbmigration.ddlgeneration.platform.util.PlatformTypeConverter;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -94,4 +94,4 @@ public class PlatformTypeConverterTest {
|
||||
assertThat(converter.convert("json")).isEqualTo("clob");
|
||||
assertThat(converter.convert("jsonb")).isEqualTo("clob");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.avaje.ebean.server.type;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.H2Platform;
|
||||
import com.avaje.ebean.config.dbplatform.h2.H2Platform;
|
||||
import com.avaje.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import com.avaje.ebeaninternal.server.type.DefaultTypeManager;
|
||||
import com.avaje.ebeaninternal.server.type.RsetDataReader;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.type;
|
||||
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.avaje.ebean.EbeanServerFactory;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.ebean.SqlRow;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.PostgresPlatform;
|
||||
import com.avaje.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
import com.avaje.tests.model.basic.TOne;
|
||||
import com.avaje.tests.model.basic.TSDetail;
|
||||
import com.avaje.tests.model.basic.TSMaster;
|
||||
|
||||
@@ -247,6 +247,6 @@ public class TestQueryFindPagedList extends BaseTestCase {
|
||||
|
||||
assertEquals(2, loggedSql.size());
|
||||
assertThat(loggedSql.get(0)).contains("select count(*) from o_order b where b.id > 0");
|
||||
assertThat(trimSql(loggedSql.get(1), 3)).contains("select b.id, b.status, b.order_date");
|
||||
assertThat(trimSql(loggedSql.get(1), 3)).contains(" b.id, b.status, b.order_date");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,5 +89,6 @@ public class TestQueryRowCountWithMany extends BaseTestCase {
|
||||
Assert.assertEquals(1, sqlLogged.size());
|
||||
Assert.assertTrue(trimSql(sqlLogged.get(0), 1).contains("select count(*) from ( select distinct t0.id from o_order t0 join o_order_detail u1 on u1.order_id = t0.id where u1.product_id = ? )"));
|
||||
|
||||
query.findList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user