@Override public int[] getUpdateCounts() throws DataNotAvailableException, TranslatorException { if (this.visitor.getMethod().equals("DELETE")) { //$NON-NLS-1$ //DELETE return (this.response != null)?new int[]{1}:new int[]{0}; } else if(this.visitor.getMethod().equals("PUT")) { //$NON-NLS-1$ // UPDATE; // conflicting implementation found where some sent 200 with content; other with 204 no-content return (this.response != null)?new int[]{1}:new int[]{0}; } else if (this.visitor.getMethod().equals("POST")) { //$NON-NLS-1$ //INSERT if (this.response != null && this.response.hasRow()) { if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) { addAutoGeneretedKeys(); } return new int[]{1}; } } return new int[] {0}; }
@Override public int[] getUpdateCounts() throws DataNotAvailableException, TranslatorException { if (this.visitor.getOperationType() == OperationType.DELETE) { return new int[]{this.updateCount.get()}; } else if(this.visitor.getOperationType() == OperationType.UPDATE) { return new int[]{this.updateCount.get()}; } else if (this.visitor.getOperationType() == OperationType.INSERT) { if (this.createdEntity != null) { if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) { addAutoGeneretedKeys(this.visitor.getODataQuery().getRootDocument().getTable(), this.createdEntity); } } return new int[]{1}; } return new int[] {0}; }
private void handleInsert() throws TranslatorException { Insert insert = (Insert)command; ExpressionValueSource evs = (ExpressionValueSource)insert.getValueSource(); Row row = nextRow(); Sheet sheet = null; if (row == null) { sheet = workbook.getSheet(this.visitor.getSheetName()); } else { sheet = row.getSheet(); } int last = sheet.getLastRowNum(); Row newRow = sheet.createRow(last+1); List<Integer> cols = this.visitor.getProjectedColumns(); for (int i = 0; i < cols.size(); i++) { int index = cols.get(i); setValue(newRow, index-1, ((Literal)evs.getValues().get(i)).getValue()); } if (executionContext.getCommandContext().isReturnAutoGeneratedKeys()) { GeneratedKeys keys = executionContext.getCommandContext().returnGeneratedKeys(new String[] {ExcelMetadataProcessor.ROW_ID}, new Class<?>[] {TypeFacility.RUNTIME_TYPES.INTEGER}); keys.addKey(Arrays.asList(last+1)); } result++; writeXLSFile(); }
Class<?>[] keyColumnDataTypes = null; String[] keyColumnNames = null; if (command instanceof Insert && context.getCommandContext().isReturnAutoGeneratedKeys() && executionFactory.supportsGeneratedKeys(context, command)) { Insert insert = (Insert)command; NamedTable nt = insert.getTable();
if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) { addAutoGeneretedKeys(executionResults.get(0));