public static ResultMetaData newUpdateResultMetaData(Type[] types) {

    ResultMetaData md = new ResultMetaData(UPDATE_RESULT_METADATA);

    md.columnTypes = new Type[types.length];
    md.columnCount = types.length;
    md.extendedColumnCount = types.length;

    ArrayUtil.copyArray(types, md.columnTypes, types.length);

    return md;
  }
  Result executeSetStatement(Session session) {

    Table table = targetTable;
    int[] colMap = updateColumnMap; // column map
    Expression[] colExpressions = updateExpressions;
    Type[] colTypes = table.getColumnTypes();
    int index = targetRangeVariables[TriggerDef.NEW_ROW].rangePosition;
    Object[] oldData = session.sessionContext.rangeIterators[index].getCurrent();
    Object[] data =
        StatementDML.getUpdatedData(session, table, colMap, colExpressions, colTypes, oldData);

    ArrayUtil.copyArray(data, oldData, data.length);

    return Result.updateOneResult;
  }
Пример #3
0
  public void addSessionVariable(ColumnSchema variable) {

    int index = sessionVariables.size();

    if (!sessionVariables.add(variable.getName().name, variable)) {
      throw Error.error(ErrorCode.X_42504);
    }

    Object[] vars = new Object[sessionVariables.size()];

    ArrayUtil.copyArray(routineVariables, vars, routineVariables.length);

    routineVariables = vars;
    routineVariables[index] = variable.getDefaultValue(session);
  }