Skip to content

Latest commit

 

History

History
92 lines (61 loc) · 1.84 KB

README.md

File metadata and controls

92 lines (61 loc) · 1.84 KB

AeroLink-source

AeroLink - Freight Management System is an Enterprise Information System built to be a project study of using Agile Methodology in developing Enterprise Information Systems

Synapse DB Operations Framework

  • Select
   
   Model m = new Model();
  
   List list = m.get();
   
   //Get certain columns
   //list = m.get("column", "column", "column");
   
   for(Object obj : list) {
     HashMap row = (HashMap) obj;
     
     //getting the value thru accessing the column name in the hashmap
     //row.get("column_name").toString();
     
   }
   
   //Or you could do this
   m.get().stream().forEach(obj -> {
      HashMap row = (HashMap) obj;
      
      //getting the value thru accessing the column name in the hashmap
      //row.get("column_name").toString();
   });
   
   //get Certain columns
   m.get("columns", "columns").stream().forEach(obj -> {
      HashMap row = (HashMap) obj;
      
      //getting the value thru accessing the column name in the hashmap
      //row.get("column_name").toString();
   });
 
  • Insert
  Model m = new Model();
  
  //Basic Insert
  m.insert(new Object[][]{
    {"column_name0", "value0"},
    {"column_name1", "value1"},
    {"column_name2", "value2"},
  });
  
  //Return autogenerated ID
  int id = m.insert(new Object[][]{
    {"column_name0", "value0"},
    {"column_name1", "value1"},
    {"column_name2", "value2"},
  }, true);
  
  • Update
   Model m = new Model();
   
   m.update(new Object[][]{
       {"column_name0", "value0"},
       {"column_name1", "value1"},
       {"column_name2", "value2"},
    }).where(new Object[][]{
       {"column_name0", "=", "value0"}
    }).executeUpdate();
   
  • Delete
   Model m = new Model();
   
   m.delete().where(new Object[][]{
       {"column_name0", "=", "value0"}
    }).executeUpdate();