public Db_rdr Select(Mem_stmt stmt) { String[] select = null; Criteria where = null; Db_qry__select_in_tbl qry = Db_qry__select_in_tbl.as_(stmt.Qry()); if (qry == null) { Db_qry__select_cmd qry2 = (Db_qry__select_cmd) stmt.Qry(); select = To_str_ary(qry2.Cols().Flds); where = qry2.Where_itm().Root; } else { select = qry.Select_flds(); where = qry.Where(); } Mem_stmt_args_.Fill(stmt.Stmt_args(), where); Select_rows_where(where_rows, stmt, where); return new Mem_rdr(select, (Mem_row[]) where_rows.To_ary_and_clear(Mem_row.class)); }
public int Delete(Mem_stmt stmt) { Db_qry_delete qry = (Db_qry_delete) stmt.Qry(); Mem_stmt_args_.Fill(stmt.Stmt_args(), qry.Where()); Select_rows_where(where_rows, stmt, qry.Where()); int where_rows_len = where_rows.Count(); for (int i = 0; i < where_rows_len; ++i) { Mem_row itm = (Mem_row) where_rows.Get_at(i); rows.Del(itm); } return where_rows_len; }
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; }