当前位置:网站首页>Harmonyos accessing database instances (3) -- use ORM bee to test how good harmonyos is

Harmonyos accessing database instances (3) -- use ORM bee to test how good harmonyos is

2022-06-24 23:25:00 abckingaa

About environmental construction ,Bee Basic use of , I won't go into it here .

Yes , You can see the previous article .

HarmonyOS Accessing database instances (ORM The way , The same code , Can be applied to Android and HarmonyOS )

HarmonyOS Accessing database instances (2)--ORM Bee piece ( Let developers just focus on the business )

One 、 design sketch

%E9%A6%96%E9%A1%B5.png

              home page

Two 、 use ORM  Bee operation 1 10000 pieces of data to test the performance

Briefly explain Suid, SuidRich.

Suid It contains simple select,update,insert,delete Interface method of operation .

SuidRich There are more diverse methods , Like complex queries , Batch insert , Aggregate query, etc .

2.1 Batch insert 1w data

	public int testBatchInsert10000Div2() {
		Tb_inaccount a;// The naming is not standard , Suddenly learn .  Just to test more scenes 
		String addr="aaa";
		List<Tb_inaccount> list=new ArrayList<>();
		for (int i = 1; i <= 10000; i++) {
			a=new Tb_inaccount();
			a.setid(i);
			a.setMark(addr+i);
			a.setMoney(0.618);
			list.add(a);
		}
		return suidRich.insert(list,5000); 
	}

2.2 Inquire about 1w Data

	public void testQuery10000() {
//		return suidRich.select(new Tb_inaccount(), 0, 10000);
		for (int i = 0; i < 10; i++) { // branch 10 Batch check 
			suidRich.select(new Tb_inaccount(), i*10000, 1000);
		}
	}

2.3 Will insert 1w The data has been deleted

	public int testDelete10000() {
		return suidRich.delete(new Tb_inaccount());
	}

3、 ... and 、 Run and view the results

1、 Start simulator

2、 Click on [ Performance testing ] Button

%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%953-%E7%82%B9%E5%A4%9A%E6%AC%A1%E4%B9%8B%E5%90%8E.png

                      Performance rendering

This performance is not bad . I saw , You will know HarmonyOS How many cows are there !!

Compare with other platforms or tools , You can see the gap . 

%E6%80%A7%E8%83%BD%E5%AF%B9%E6%AF%94%E6%95%B0%E6%8D%AE.png

Source code address ( Open source is not easy , Remember to point star Oh ^_^):

HarmonyOS-ORM-Bee-Demo: HarmonyOS ORM Bee Demo; In Android and HarmonyOS environment can use the same ORM code with Bee.icon-default.png?t=M5H6https://gitee.com/aiteasoft/HarmonyOS-ORM-Bee-Demo

ORM Bee  Simple and easy to use , The file is small , Good performance ; Support at the same time  Android and Harmony, And support JDBC ( Can be found in JavaWeb And so on ).

stay  Harmony and Android Two environments  , It can be used The same set of Bee Code access DB, Improve code reuse , Save manpower and materials .

Bee, The new era of the Internet Java ORM Tools , faster 、 It's simpler 、 More automatic , Fast development speed , Run fast , More intelligent !

Bee  website :
https://github.com/automvc/bee
Bee stay gitee  The website of :
bee: Bee, The new era of the Internet Java ORM frame , faster 、 It's simpler 、 More automatic , Fast development speed , Run fast , More intelligent !
bee-ext:
https://github.com/automvc/bee-ext

原网站

版权声明
本文为[abckingaa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241814215502.html