/** * @param del DELETE statement. * @return {@code true} if given statement filters by single non expression key. */ public static FastUpdate getFastDeleteArgs(GridSqlDelete del) { IgnitePair<GridSqlElement> filter = findKeyValueEqualityCondition(del.where()); if (filter == null) return null; return FastUpdate.create(filter.getKey(), filter.getValue(), null); }
/** * @param update UPDATE statement. * @return {@code null} if given statement directly updates {@code _val} column with a literal or param value * and filters by single non expression key (and, optionally, by single non expression value). */ public static FastUpdate getFastUpdateArgs(GridSqlUpdate update) { IgnitePair<GridSqlElement> filter = findKeyValueEqualityCondition(update.where()); if (filter == null) return null; if (update.cols().size() != 1) return null; Table tbl = update.cols().get(0).column().getTable(); if (!(tbl instanceof GridH2Table)) return null; GridH2RowDescriptor desc = ((GridH2Table)tbl).rowDescriptor(); if (!desc.isValueColumn(update.cols().get(0).column().getColumnId())) return null; GridSqlElement set = update.set().get(update.cols().get(0).columnName()); if (!(set instanceof GridSqlConst || set instanceof GridSqlParameter)) return null; return FastUpdate.create(filter.getKey(), filter.getValue(), set); }
/** * @param del DELETE statement. * @return {@code true} if given statement filters by single non expression key. */ public static FastUpdate getFastDeleteArgs(GridSqlDelete del) { IgnitePair<GridSqlElement> filter = findKeyValueEqualityCondition(del.where()); if (filter == null) return null; return FastUpdate.create(filter.getKey(), filter.getValue(), null); }
/** * @param update UPDATE statement. * @return {@code null} if given statement directly updates {@code _val} column with a literal or param value * and filters by single non expression key (and, optionally, by single non expression value). */ public static FastUpdate getFastUpdateArgs(GridSqlUpdate update) { IgnitePair<GridSqlElement> filter = findKeyValueEqualityCondition(update.where()); if (filter == null) return null; if (update.cols().size() != 1) return null; Table tbl = update.cols().get(0).column().getTable(); if (!(tbl instanceof GridH2Table)) return null; GridH2RowDescriptor desc = ((GridH2Table)tbl).rowDescriptor(); if (!desc.isValueColumn(update.cols().get(0).column().getColumnId())) return null; GridSqlElement set = update.set().get(update.cols().get(0).columnName()); if (!(set instanceof GridSqlConst || set instanceof GridSqlParameter)) return null; return FastUpdate.create(filter.getKey(), filter.getValue(), set); }