reverse current middled in Coil to build Twins-photon, norms of U-D surfaces outward to get zero field solid. [2024-08-14],[2024-09-03];
cos(ratio,volume) of speedtime. positive volume object has Mass(time-lines). negative volume object faster than light(teleport). [2023-11-21];
iBoxDB is a fast acid table-style document NoSQL Embedded Database, easily store objects and documents, traditional table with unstructured data, zero configuration, pure JAVA and DotNET engines, no dependencies.
iBoxDB has a well designed interface with great performance and capability for agile development. You can create applications with database services embedded and deploy it on mobiles, desktops, servers, to locally persist your data from anywhere.
Green, low carbon emission!
Dual Core Application Database
For  JAVA, C#, Android, Unity, Xamarin, Mono, Linux, Windows...
Website Mirror https://iboxdb.github.io/
- CRUD and Forward CRUD
- KeyValue and KeyOnly tables
- Unique and non-unique indexes
- Unique and non-unique composite indexes
- SQL like query language
- Transactions support
- Concurrency control, thread safe
- Multiple applications supported
- Memory management
- Programmable replication
- Hot mirror copy
- On disk and in memory databases supported
- Automatically create databases
- Zero configuration, copy and run, purely managed code
- Dynamic columns
- Prototype columns
- Different types with different indexes can be stored in same table
- Persistence + ORM + Cache + Embeddable, ONE STOP solution
- Ason, Array Script Object Notation
- High performance, no dependencies
- Transaction Huggers
- Directly Select
- Update Increment
- Selecting Tracer
- Snapshot-Serializable Isolation
- JAVA6+ Â Â .NET2+
using(var box = auto.Cube())
{
//select, insert, update, delete ...
//replace()=(insert or update)
CommitResult cr = box.Commit();
}
try(Box box = auto.cube()){
...
CommitResult cr = box.commit();
}
as above, box is method's local variable, don't define as global variable. one box for one delivery. AutoBox can be defined globally in single application.
Member m = new Member();
m.Id = box.NewId();
m.Name = "Andy";
m.Password = EncodePassowrd("123");
box["Member"].Insert(m);
Member m = new Member();
m.Id = box.newId();
m.Name = "Kevin";
box.d("Member").insert(m);
//Game : Dictionary<string, object>
game["GameType"] = "ACT";
box["Product"].Insert(game);
//Game extends HashMap<String,Object>
game.put("GameType", "ACT");
box.d("Product").insert(game);
box["Table", 2L].Select<Member>();
//Composite Key
box["Table2", 99, "ABC"].Select<Product>();
box.d("Table", 3L).select(Member.class);
//Composite Key
box.d("Table2", 88, "ABC").select(Product.class);
config.ensureTable(Item.class, "Item", "UID", "Type")
/*
from TABLE where A>? & B<=? order by C limit 0,10
from [table] where [condition]
order by [field1] desc,[field2] limit [0,10]
[Condition:] == != < <= > >= & | ( )
*/
box.Select<Member>("from Member where Name==?", "MyName");
box.select(Member.class, "from Member where Name==?", "MyName");
//query
box.Select("from Member");
//load to memory first, startswith '*'.
//because the OS has read-ahead setting,
//normally don't need to load first.
box.Select("*from Member");
//selecting tracer, startswith '!'
box.Select("!from Member")
config.EnsureIndex<Member>("Member", "Field1","Field2")
config.ensureIndex(Member.class, "Member", isUnique,"Field1","Field2")
box.Select("from Member where Field1 == ? & Field2 == ?",arg1,arg2)
//Id on the Left would faster in many cases
box.Select("from Member where Id == ? & Field == ?",id,arg)
//combining Results would faster than OR,
//depends on the scale of dataset and corresponded Index configure.
//where Id == ? | Id == ? | Id == ?
foreach(var id in [ 1, 2, 3 ])
combiner.Add( box.Select("from Member where Id == ?",id) )
box.Select<Member>("from Member where [Tags]", new IFunction("Value"))
public bool Insert(Member m){
return auto.Insert(nameof(Member), m);
}
//Strongly typed
box.select("from Table where Id > ?" , 1L);
//Weak Object
box.select("from Table where Id > ?" , new Variant("1"));
from o in box.Select<Member>("from Member")
where o.Text.Contains(text) select o;
StreamSupport
.stream(box.select(Member.class,"from Member").spliterator(), true)
.collect(groupingBy(m -> m.group, summarizingLong(m -> m.value)))
//define prototype, Id is Long
Ason prototype = new Ason("Id:", 0L, "Name:", "Guest");
Ason record = prototype.select();
//set Id as String,
record.set("Id", "123");
//will automatically convert to Long as the prototype
System.out.println("Output: " + record.get("Id").getClass());
//Output: class java.lang.Long
auto.GetDatabase().CopyTo(bakAddr, bakRoot, buffer)
//Select records from a samll file directly
//without initializing database
IEnumerable records = DB.Select(fileAddress)
//Three transactions committed together
long huggersBuffer = 1024L * 1024L * 32L;
box1.Commit(huggersBuffer);
box2.Commit(huggersBuffer);
box3.Commit();
BoxData.masterReplicate()
BoxData.slaveReplicate()
try (Box box = auto.cube()) {
// forward Update()
Member m = box.d("Table", 100L).update(Member.class);
m.setName("Name");
m.setAmount(BigDecimal.TEN);
CommitResult cr = box.commit();
}
Transaction Step | Isolation Level |
---|---|
Application Point | Snapshot |
Database Point | Serializable |
using(var box = auto.Cube()){
//Snapshot...
box.Commit( ()=>{
//Serializable...
});
}
 | Apply To | Trigger | Type |
---|---|---|---|
UpdateIncrement | non-primary key | insert/update | long |
AutoIncrement | primary key | insert | number |
 | Value From | Generator Time |
---|---|---|
UpdateIncrement | Database NewId(MaxPos,1) | Serializable Transaction Commit |
AutoIncrement | Table Max(ID)+1 | Data Insert, Differed from Commit order |
 | Thread | Usage |
---|---|---|
Tracer | non-blocked | read/write different records |
Locker | blocked | read/write same record |
BoxFileStreamConfig |
---|
BoxMemoryStreamConfig |
ReadonlyStreamConfig |
CacheStreamConfig |
//different path has hugely different writing speed on VM.
//Create Directory before putting DB inside.
//new File(path).mkdirs();
//Directory.CreateDirectory(path)
IBoxDB.LocalServer.DB.Root("/data/")
Add this Database Path as Exclusion into Scan-System to get higher performance, for example, System Defender.
DB.Root(MapPath("~/App_Data/"))
DB.Root(System.Environment.GetFolderPath(
System.Environment.SpecialFolder.LocalApplicationData/Personal))
DB.Root(Application.persistentDataPath)
DB.root(android.os.Environment.getDataDirectory()
.getAbsolutePath() + "/data/" + packageName + "/")
@WebListener()
public class StartListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
String path = System.getProperty("user.home") + "/data/";
new File(path).mkdirs();
DB.root(path);
}
}
using IBoxDB.LocalServer;
var db = new DB();
db.GetConfig().EnsureTable<Record>("Table", "Id");
AutoBox auto = db.Open();
auto.Insert("Table", new Record { Id = 1L, Name = "Andy" });
var record = auto.Get<Record>("Table", 1L);
record.Name = "Kelly";
auto.Update("Table", record);
auto.Delete("Table", 1L);
import iboxdb.localserver.*;
DB db = new DB();
db.getConfig().ensureTable(Record.class, "Table", "Id");
AutoBox auto = db.open();
auto.insert("Table", new Record(1L, "Andy"));
Record record = auto.get(Record.class, "Table", 1L);
record.Name = "Kelly";
auto.update("Table", record);
auto.delete("Table", 1L);
DatabaseConfig cfg = db.getConfig();
//Cache Memory, set less 1/3 total
cfg.CacheLength = cfg.mb(1024L);
//Mobile Device 64MB
cfg.CacheLength = cfg.mb(64L);
//Read Pool, set **8+** to low Cache machine
cfg.ReadStreamCount = 8;
//Write Pool, set **4-** to low Cache machine
cfg.WriteStreamCount = 1;
auto.getDatabase().getSchemata()
using IBoxDB.LocalServer.Replication;
DB db = new DB();
db.SetBoxRecycler(
(Socket socket, BoxData outBox, bool normalPoweroff) => {
if (socket.Actions > 0) {
foreach (var e in outBox.GetActions()) {
var actionType = e.ActionType;
var key = e.Key;
if (actionType == ActionType.Begin) {
continue;
}
var tableName = e.TableName;
var value = e.Select();
Log (actionType + " '" + tableName + "' at key '" + key
+ "' \r\n" + DB.ToString (value));
}}});
static DB db = new DB(db_id);
//for LockFile Supported Platform only
db.WaitAnotherApp(1000 * 60 * 5);
using (var auto = db.Open()){
...
//auto.Cube(); Insert(), Update()...
}
Method | Column |
---|---|
*.Name | Name |
*.name | name |
Java | Column |
*.Name(val) | Name |
*.setName(val) | Name |
*.name(val) | name |
*.setname(val) | name |
DatabaseConfig cfg;
//Create Table
ensureTable(Record.class, "Table", "Id");
//Create Index with length 32
ensureIndex(Record.class, "Table", "Name(32)");
.NET: Add NETDB/iBoxDB.DLL to Project
Java: Add JavaDB/iboxdb.jar to Project
public static object Register
<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>()
where T : new()
{
return new T();
}
//Trigger DynamicallyAccessedMemberTypes.All
Register<T1>();
EnsureTable<T1>("T1", "Id");
iBoxDB
Insert: 1,000,000 AVG: 47,016 objects/s
Update: 1,000,000 AVG: 25,558 objects/s
Delete: 1,000,000 AVG: 42,714 objects/s
MySQL
Insert: 1,000,000 AVG: 5,514 objects/s
Update: 1,000,000 AVG: 5,109 objects/s
Delete: 1,000,000 AVG: 6,044 objects/s
Self-hosted Search Engine Android
.NET Linq, integrating with SQL ORM -XPO