Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

iBoxDB -Lightweight Embedded Database

Discussion in 'Assets and Asset Store' started by Bruce3D, Dec 13, 2013.

  1. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    344
    @Bruce3D Thank you for your detailed answers!

    Actually the field is just a string. What I'm doing now is:

    Code (CSharp):
    1.  
    2. List<string> tags = new List<string>(new string[] { "tag1", "tag2", "tag3" });
    3.  
    4. List<PhotoData> results = auto.Select<PhotoData>("from PhotoData where DateTaken > ? & DateTaken < ?", fromDate, toDate).Where(o => tags.Contains(o.Tags)).Skip(offset).Take(numItems).ToList();
    5.  
    I'm still a bit unclear about what EnsureIndex does - does it index the field to make searches faster? So does this only need to be done once when the DB is setup?

    Thanks
     
  2. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Some books have an Index at the end, it helps readers find content efficiently.
    if want to find Term faster, create a Term index
    EnsureIndex( ... "Term");
    Select( ".. where Term==?");

    if want to find [Title->Term] faster, create a [Title->Term] index. the order of fields matters.
    EnsureIndex( ... "Title", "Term");
    Select( ".. where Title==? & Term==?");

    small book doesn't have Index, it is not necessary, when data reached 1,000,000. it helps.

    Index accelerates Search, decelerates Update.

    http://www.iboxdb.com/
     
    Last edited: Aug 30, 2017
    iddqd likes this.
  3. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    262
    wow suprised it works on webgl! where it stores data there? and is there any limitations?
     
  4. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
  5. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    579
    Is there a documentation? This library looks promising and just like what i'm looking for, but i find it hard to figure out what certain classes/methods exactly do so i know how to use them.
     
  6. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Hello,
    Four methods, CRUD, Insert(), Select(), Update(), Delete().
    put methods in One Box then Commit();
    Code (CSharp):
    1. using( var box = auto.Cube() ){
    2.   box["Table2"]...
    3.   box["Table3"]...
    4.   var cr = box.Commit();
    5. }
    or use AutoBox (= set autocommit=true).
     
  7. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    579
    ok, thanks, that's a start atleast (some kind of documentation would still help though, XML/pdb/mdb). Another question: new DB(x) - i guess x has to be unique? what does it represent?
     
  8. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    DB.Root( path );
    new DB(x)
    when x is long : x is the ID of the DB;
    when x is byte[] : x is the Memory of the DB;
    when x is Stream: x is the Stream to read the DB, Readonly;
    when x is DB.CacheOnlyArg: like x is byte[0];

    iBoxDB is a custom-built database, it depends what users wanted, not what the DB provides.
    the standardized parts are CURD with a packing box.
     
    Last edited: Nov 4, 2017
  9. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    579
    That was insightful, thanks.
     
  10. Batka

    Batka

    Joined:
    May 23, 2016
    Posts:
    14
    Hi, I really love your database, and I want to include it in my following projects.
    I am confused how to use the StreamingAssets folder as the path.

    In the following example you've posted,

    What type is the 'server' variable?
    I guess it's an instance of DB since it's instantaiting a new DB

    Code (CSharp):
    1. server = new DB (3);
    But then after the if/else, I see

    Code (CSharp):
    1. db = server.Open();
    This confuses me, what is db and what is server?...



    Thank you for your time :)
     
  11. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Hi, it's a long story, in the old days, the concept of Database is Server.
    Code Updated.
    Code (CSharp):
    1. db = new DB (...);
    2. auto = db.Open(...);
     
  12. Batka

    Batka

    Joined:
    May 23, 2016
    Posts:
    14
    Gosh can't believe how powerful it is. Thanks a lot Bruce!
     
    Bruce3D likes this.
  13. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    990
    Looks cool but is there any PlayMaker actions for people can't code?
     
  14. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    52
    I've downloaded this and it looks very nice so far. I have a couple questions.

    • I'm currently evaluating this vs LiteDB and was wondering if you, or anyone else on the thread could chime in on opinions of the two?
    • Second, is the source for iBox available? I do not see it in the download package.

    I don't mind using open source freeware, but without the source, if you get hit by a bus tomorrow (don't do that) that pretty much locks me into this version forever.
     
  15. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Thanks, iBoxDB has a stable Interface, like five years ago, some databases changing every version.
    Using this version forever isn't a bad thing, actually many users don't upgrade to new version. you can use five years ago version, it works fine today.
     
    laurentlavigne likes this.
  16. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,025
    Hi @Bruce3D , I'm currently evaluating nosql solutions for Unity. Your package looks very promising, I need some information though. Maybe I wasn't thorough enough, but I couldn't find out the legality about this project. What kind of license you have in mind? I guess it's free, since you allow us to download, but neither on your website nor in the package you're appointing to any licenses. I'm only allowed royalty-free licenses which can be used as part of paid products, that's why I'm asking. Could you please give some information about it? Optimally inside the package?
     
  17. sorencoder

    sorencoder

    Joined:
    Mar 27, 2017
    Posts:
    57
    @Bruce3D Does iBoxDB have documentation? The website just contains examples.

    another question, is iboxdb backward/forward compatible?
     
    Last edited: Feb 26, 2018
  18. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Hello @SorenCoder,
    "documentation", follow Instinct, iBoxDB has no complex design.
    "backward/forward compatible", no guarantee.
     
  19. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,025
    @Bruce3D thanks for adding License! Appreciate it!
     
  20. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    That's OK, it has been in there for five years.:cool:
     
    sorencoder likes this.
  21. Avietry

    Avietry

    Joined:
    Mar 4, 2015
    Posts:
    21
    This looks promising. I have been struggling with JSON to store user generated data.
     
  22. blotzy

    blotzy

    Joined:
    Oct 4, 2016
    Posts:
    1
    I'm impressed by this project. It performs great and it's really powerful. However, the obfuscated dll makes debugging this library incredibly painful. Perhaps this wouldn't be as much of a problem if the documentation were better.
     
    laurentlavigne and Flavelius like this.
  23. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    579
    If i understand correctly EnsureIndex creates indices (of keys if they match?)
    What i'm doing:

    EnsureTable<MyVector3Class>("Table", "X", "Y");
    EnsureIndex<MyVector3Class>("Table", "X", "Y");

    What i'm expecting: to have a table with keys X and Y that are also indices so they speed up queries.
    What i get: UnexpectedException: DB:TableIndexExisted Vertices@X#Y
    What am i doing wrong?
     
  24. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Hello,
    Key is a type of Index, has a KEY flag. the default index when querying data.
    you can create an index with different order @Y#X
    Code (CSharp):
    1. EnsureIndex(... Y , X )
     
    Flavelius likes this.
  25. DADA_universe

    DADA_universe

    Joined:
    Mar 14, 2015
    Posts:
    18
    Any pointers for using iBoxDB for file storage (reading / uploading of image files, video files, text files, that sort of thing)?
     
  26. Bruce3D

    Bruce3D

    Joined:
    Sep 6, 2013
    Posts:
    54
    Hello,
    use MemoryStream.
    Code (CSharp):
    1. class FileObject{
    2.   long Id;
    3.   string Type;
    4.   MemoryStream Stream;
    5. }
    6.  
    7. class FileInfo{
    8.   long Id;
    9.   string Name;
    10.   string Author;
    11.   DateTime Time;
    12. ....
    13. }
    14.  
    if one of your files' size bigger than 2G, create your own big file system.
    Code (CSharp):
    1. string AllBigFileinOne ="/c/path.bin";
    2. FileStream bigfs=new FileStream(AllBigFileinOne ...);
    3.  
    4. class FileObject{
    5.   long Id;
    6.   long Position;
    7.   long Length;
    8. }
    9.  
    10. FileObject fo;
    11. lock(bigfs){
    12.   fo.Position = bigfs.Position;
    13.   fo.Length=len;
    14.   WriteFile(bigfs...);
    15.   Save(fo);
    16. }
     
    Last edited: Feb 24, 2019
  27. DADA_universe

    DADA_universe

    Joined:
    Mar 14, 2015
    Posts:
    18
    Thanks for this, I appreciate your response, but I still have to figure out how to use this. Wish there was more example code than currently exists, and of course, documentation like many have requested, or maybe a wiki. Thanks for sharing your work all the same, iBoxDB ticks a number of boxes that many other database systems do not manage to achieve in the same combination.
     
    Bruce3D likes this.