Beispiel #1
0
 public int Insert(Mem_stmt stmt) {
   Mem_row itm = new Mem_row();
   Dbmeta_fld_mgr flds = meta.Flds();
   int len = flds.Len();
   for (int i = 0; i < len; ++i) {
     Dbmeta_fld_itm fld = flds.Get_at(i);
     String fld_name = fld.Name();
     Object val = fld.Autonum() ? Autonum_calc(fld_name) : stmt.Args_get_by(fld_name);
     if (val == null) continue; // NOTE: allow Bulk_insert from test to skip filds
     itm.Set_by(fld_name, val);
   }
   rows.Add(itm);
   return 1;
 }
Beispiel #2
0
 public int Update(Mem_stmt stmt) {
   Db_qry_update qry = (Db_qry_update) stmt.Qry();
   Criteria where_crt = qry.Where();
   if (where_crt == null) where_crt = Criteria_.All;
   Mem_stmt_args_.Fill(stmt.Stmt_args(), where_crt);
   Select_rows_where(where_rows, stmt, where_crt);
   int where_rows_len = where_rows.Count();
   String[] update_cols = qry.Cols_for_update();
   int update_cols_len = update_cols.length;
   for (int i = 0; i < where_rows_len; ++i) {
     Mem_row itm = (Mem_row) where_rows.Get_at(i);
     for (int j = 0; j < update_cols_len; ++j) itm.Set_by(update_cols[j], stmt.Args_get_at(j));
   }
   return where_rows_len;
 }