private boolean addFields() { // int middle = props.getMiddlePct(); int margin = Const.MARGIN; if (wlFields == null) { wlFields = new Label(shell, SWT.LEFT); wlFields.setText(message); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.right = new FormAttachment(100, 0); fdlFields.top = new FormAttachment(0, margin); wlFields.setLayoutData(fdlFields); } else { wFields.dispose(); } if (dynamic && rowMeta == null) { rowMeta = new RowMeta(); rowMeta.addValueMeta(new ValueMeta("<waiting for rows>", ValueMetaInterface.TYPE_STRING)); waitingForRows = true; } if (!dynamic) { // Mmm, if we don't get any rows in the buffer: show a dialog box. if (buffer == null || buffer.size() == 0) { ShowMessageDialog dialog = new ShowMessageDialog( shell, SWT.OK | SWT.ICON_WARNING, BaseMessages.getString(PKG, "PreviewRowsDialog.NoRows.Text"), BaseMessages.getString(PKG, "PreviewRowsDialog.NoRows.Message")); dialog.open(); shell.dispose(); return true; } } // ColumnInfo[] colinf = new ColumnInfo[rowMeta==null ? 0 : rowMeta.size()]; ColumnInfo[] colinf = new ColumnInfo[rowMeta.size()]; for (int i = 0; i < rowMeta.size(); i++) { ValueMetaInterface v = rowMeta.getValueMeta(i); colinf[i] = new ColumnInfo(v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric()); colinf[i].setToolTip(v.toStringMeta()); colinf[i].setValueMeta(v); } wFields = new TableView( variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, 0); fdFields.bottom = new FormAttachment(100, -50); wFields.setLayoutData(fdFields); if (dynamic) { shell.layout(true, true); } return false; }
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (IngresVectorwiseLoaderMeta) smi; data = (IngresVectorwiseLoaderData) sdi; try { Object[] r = getRow(); // Get row from input rowset & set row busy! if (r == null) // no more input to be expected... { setOutputDone(); // only close output after the first row was processed // to prevent error (NPE) on empty rows set if (!first) { closeOutput(); } return false; } if (first) { first = false; // Cache field indexes. // data.keynrs = new int[meta.getFieldStream().length]; for (int i = 0; i < data.keynrs.length; i++) { data.keynrs[i] = getInputRowMeta().indexOfValue(meta.getFieldStream()[i]); } data.bulkRowMeta = getInputRowMeta().clone(); if (meta.isUseStandardConversion()) { for (int i = 0; i < data.bulkRowMeta.size(); i++) { ValueMetaInterface valueMeta = data.bulkRowMeta.getValueMeta(i); if (valueMeta.isStorageNormal()) { if (valueMeta.isDate()) { valueMeta.setConversionMask("yyyy-MM-dd HH:mm:ss"); } else if (valueMeta.isNumeric()) { valueMeta.setDecimalSymbol("."); valueMeta.setGroupingSymbol(""); } } } } // execute the client statement... // execute(meta); // Allocate a buffer // data.fileChannel = data.fifoOpener.getFileChannel(); data.byteBuffer = ByteBuffer.allocate(data.bufferSize); } // check if SQL process is still running before processing row if (!checkSqlProcessRunning(data.sqlProcess)) { throw new Exception("Ingres SQL process has stopped"); } writeRowToBulk(data.bulkRowMeta, r); putRow(getInputRowMeta(), r); incrementLinesOutput(); if (checkFeedback(getLinesOutput())) logBasic( BaseMessages.getString(PKG, "IngresVectorwiseLoader.Log.LineNumber") + getLinesOutput()); //$NON-NLS-1$ return true; } catch (Exception e) { logError( BaseMessages.getString(PKG, "IngresVectorwiseLoader.Log.ErrorInStep"), e); // $NON-NLS-1$ setErrors(1); stopAll(); setOutputDone(); // signal end to receiver(s) return false; } }