【開源資訊】iBoxDB 2.33

簡介

iBoxDB是一個具有雙引擎(Java 和 C#)的高性能NoSQL數據庫,支持直接在虛擬機上運行而無需獲取機器碼執行權限,內置了非結構化數據存取,ORM,緩存等模塊,不依賴任何第三方功能組件,實現了一站式的應用程序數據處理服務, 可以幫助開發人員使用應用程序開發語言編寫數據庫操作代碼,不受SQL有限語法所侷限,可用遞歸式SQL查詢(ftserver)。同時融合了關係數據庫,對象數據庫,文檔數據庫和嵌入式數據庫的優點,支持 Java C# Android Mono Unity3D Xamarin ASP.NET Core JSP Windows Phone Nashorn Windows Linux OS X。內置了事務管理, 內存管理, 支持動態屬性, 支持索引, 多數據庫熱同步等最先進的數據庫特性,微內核結構,精簡高效,直接複製就能運行在移動設備, 桌面系統及服務器上。

支持平臺

Java .NET Xamarin Mono Unity Android Windows Linux Blazor Wasm

更新內容:

1. 優化緩存預讀,性能提升 -1%到+5%。

2. 調整了設置類 。

3. 方便的動態類型與閉包編程。通過在iBoxDB中引入的一種快速生成動態對象的結構 Ason,代碼例子在後面。

Ason演示例子, 三表連接操作。

<code>package example;

import iBoxDB.LocalServer.*;
import static iBoxDB.LocalServer.Ason.*;
import static iBoxDB.LocalServer.IFunction.*;
import static example.AsonExample.Names.*;
import java.util.Map;

public class AsonExample {

public static void main(String[] mainargs) {
DB.root("../");

var db = new DB(1);

db.getConfig()
.ensureTable(new Ason(Id, 0L), Table1);

db.getConfig()
.ensureTable(new Ason(Id, 0L), Table2)
.ensureIndex(new Ason(JoinTable1, 0L), Table2);

db.getConfig()
.ensureTable(new Ason(Id, 0L), Table3)
.ensureIndex(new Ason(JoinTable2, 0L), Table3);

var auto = db.open();


long id1start;

try (var box = auto.cube()) {
id1start = box.newId(1, 0);
for (int t1 = 0; t1 < 100; t1++) {
long id1 = box.newId(1, 1);
var obj1 = new Ason(Id, id1, Value1, "T1-" + id1);
box.d(Table1).insert(obj1);

for (int t2 = 0; t2 < 3; t2++) {
long id2 = box.newId(2, 1);
var obj2 = new Ason(Id, id2, JoinTable1, id1, Value2, "T2-" + id2);
box.d(Table2).insert(obj2);

for (int t3 = 0; t3 < 2; t3++) {
long id3 = box.newId(3, 1);
var obj3 = new Ason(Id, id3, JoinTable2, id2, Value3, "T3-" + id3);
box.d(Table3).insert(obj3);

}

}
}
CommitResult cr = box.commit();
}

var joinList = new JoinList();
try (var box = auto.cube()) {
box.selectCount("from Table1 where Id >= ? & Id <=? & [*]", id1start, id1start + 5,
func((_a, args1) -> {
var map1 = (Map<string>) args1[0];
var id1 = map1.get(Id);

box.selectCount("from Table2 where JoinTable1 == ? & [*]", id1,
func((_b, args2) -> {
var map2 = (Map<string>) args2[0];
var id2 = map2.get(Id);

box.selectCount("from Table3 where JoinTable2 == ? & [*]", id2,
func((_c, args3) -> {
var map3 = (Map<string>) args3[0];
joinList.newRow(map1).join(map2).join(map3);
return true;
}));

return true;
}));

return true;

})
);
}

for (var row : joinList) {
System.out.println(row.toString());
}
auto.getDatabase().close();
}

public static class Names {

public static String Id = "Id";

public static String JoinTable1 = "JoinTable1";
public static String JoinTable2 = "JoinTable2";

public static String Table1 = "Table1";
public static String Table2 = "Table2";
public static String Table3 = "Table3";

public static String Value1 = "Value1";
public static String Value2 = "Value2";
public static String Value3 = "Value3";
}
}/<string>/<string>/<string>/<code>


分享到:


相關文章: