iBoxDB是一款高性能的NOSql数据库,其具备类SQL的一些特性,但的确是个NOSql数据库。高性能、无依赖、线程安 全、先天支持 Java 、.NET、Android、Mono、Unity3D、Xamarin、Nashorn、Linux、Windows Phone等平台、支持索引、事务、主键、零配置,内嵌或独立Server,用类SQL语局查询、支持Linq。官方有跟MongoDB的性能对比,基本 是高于MongoDB的。
官方网站:http://www.iboxdb.com/
下面我们就摘取官方网站的一些例子,方便大家进一步认识:
using(var box = db.Cube()) { //select, insert, update, delete ... var result = box.Commit(); }
常见对象的插入: box.Bind("Member").Insert( new Member() { ID=box.NewId(Member.IncTableID, 1) , LoginName = "Andy", Password = Member.EncodePassowrd("123"), Tags = new string[]{ "Nice" , "Strong" } } );
game["GameType"] = "ACT"; box.Bind("Product").Insert(game);
game.put("GameType", "ACT"); box.bind("Table").insert(game);
box.Bind("Table", 2L).Select<AClass>(); //Composite Key box.Bind("Table2", 99, "ABC").Select<BClass>();
box.bind("Table", ID).select(Member.class); //Composite Key box.bind("Table2",8, "MyID").select(Product.class);
//from TABLE where A>? & B<=? order by C limit 0,10 box.Select<Member>("from Member where LoginName==?", "MyName");
//from [table] where [condition] // order by [field1] desc,[field2] limit [0,10] //[Condition:] == != < <= > >= & | ( ) //[IFunction:] =[F1,F2,F3] box.select(Member.class, "from Member where Name==?", "MyName");
box.Select<Member>("from Member where [Tags]", new QueryArray("Value"));可以配合linq来使用
from o in box.Select<Class>("from Class") where o.Text.Contains(text) select o;
.NET | |
---|---|
bool char byte sbyte short ushort int uint long ulong float double decimal DateTime Guid bool? char? byte? sbyte? short? ushort? int? uint? long? ulong? float? double? decimal? DateTime? Guid? string //non-indexable Dictionary<string, object> MemoryStream bool[] char[] byte[] sbyte[] short[] ushort[] int[] uint[] long[] ulong[] float[] double[] decimal[] DateTime[] Guid[] |
在32bit系统上 PK MongoDB:
Results: threadCount=100000 , batchCount=10 MongoDB(Default) Database Transaction Test: None Insert:1000000 AVG:10521 objects/s iBoxDB(File Mode) Database Transaction Test: Succeeded Insert:1000000 AVG:17981 objects/s Update:1000000 AVG:12397 objects/s Delete:1000000 AVG:22869 objects/s iBoxDB(MemoryMappedFile Mode) Database Transaction Test: Succeeded Insert:1000000 AVG:38458 objects/s Update:1000000 AVG:20200 objects/s Delete:1000000 AVG:33342 objects/s iBoxDB(InMemory Mode) Database Transaction Test: Succeeded Insert:1000000 AVG:39132 objects/s Update:1000000 AVG:20226 objects/s Delete:1000000 AVG:33658 objects/siBoxDB.NET 在64bit System
MongoDB(Default) Database Transaction Test: None Insert:1,000,000 AVG: 32,702 objects/s iBoxDB(File Mode) Database Transaction Test: Succeeded Insert:1,000,000 AVG:33,368 objects/s Update:1,000,000 AVG:16,939 objects/s Delete:1,000,000 AVG:22,504 objects/s iBoxDB(MemoryMappedFile Mode) Database Transaction Test: Succeeded Insert:1,000,000 AVG:42,236 objects/s Update:1,000,000 AVG:17,765 objects/s Delete:1,000,000 AVG:23,147 objects/s iBoxDB(InMemory Mode) Database Transaction Test: Succeeded Insert:1,000,000 AVG:47,382 objects/s Update:1,000,000 AVG:26,806 objects/s Delete:1,000,000 AVG:35,092 objects/s实现主从同步:
好了,先整理到这儿吧,感兴趣的朋友,可以去参照官网,动手试试。