You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
package UnitTest;
|
|
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class TestOpenGauss {
|
|
public static void main(String[] args) {
|
|
//读取库
|
|
DruidPlugin druid = new DruidPlugin("jdbc:postgresql://10.10.14.62:5432/dsideal_db", "test",
|
|
"Test@123", "org.postgresql.Driver");
|
|
druid.start();
|
|
|
|
ActiveRecordPlugin arp = new ActiveRecordPlugin(druid);
|
|
arp.setDialect(new PostgreSqlDialect());
|
|
arp.start();
|
|
|
|
String sql = "truncate table t1";
|
|
Db.update(sql);
|
|
|
|
List<Record> aList = new ArrayList<>();
|
|
for (int i = 1; i <= 1000; i++) {
|
|
Record record = new Record();
|
|
record.set("id", i);
|
|
record.set("name", "黄海" + i);
|
|
aList.add(record);
|
|
}
|
|
Db.batchSave("t1", aList, 100);
|
|
|
|
sql = "select * from t1";
|
|
List<Record> list = Db.find(sql);
|
|
System.out.println(list);
|
|
}
|
|
}
|
|
|