Skip to content
Bruce Yang CL edited this page Jan 23, 2021 · 3 revisions

Getting Started

    DB db = new DB();
    db.ensureTable(Record.class, "table", "id");
    AutoBox auto = db.open();
    //insert
    auto.insert("table", new Record(1L, "Andy"));
    //select
    Record o1 = auto.get(Record.class, "table", 1L);
    //update
    o1.name = "Kelly";
    auto.update("Table", o1);

Supported Types

    boolean 
    Boolean
    byte 
    Byte
    char 
    Character
    short 
    Short
    int 
    Integer
    long 
    Long
    float
    Float
    double
    Double
    UUID
    Date
    //dynamic length @BoxLength(len)
    BigDecimal
    BigInteger
    String

    //Non-Indexable
    byte[]
    HashMap<String,Object>
    Object[]

JSP WebApplication

    import iboxdb.localserver.*;
    import iboxdb.localserver.io.*;
    import java.io.File; 
    @WebListener()
    public class StartListener implements ServletContextListener {
        @Override
        public void contextInitialized(ServletContextEvent sce) {
          String path = sce.getServletContext().getRealPath("/") + "DB" + File.separatorChar;
          BoxFileStreamConfig.RootPath = path;
          File f = new File(BoxFileStreamConfig.RootPath );
          if (!f.exists()) {
             f.mkdir();
          }
          System.out.println("DBPath=" + f.getPath());
        }
    }

Query

from [table] where [condition] order by [field1] desc,[field2] limit [0,10]

[Condition:] == != < <= > >= & | ( )

[IFunction:] =[F1,F2,F3]

     //query
     box.select( Member.class, "from Member");
     //query load to memory first, start with '*'
     box.select( Member.class, "*from Member");   
     //selecting tracer, start with '!'
     box.select( Member.class, "!from Member");  

Clone this wiki locally