Display the end record in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception.
357832
public void printEndRecordData(Rec record, PrintWriter out, int iPrintOptions)
    {
        this.getScreenFieldView().printEndRecordData(record, out, iPrintOptions);
    }
1317527
public static void print(ResultSet rs, PrintStream out) throws SQLException {
    ResultSetMetaData meta = rs.getMetaData();
    int columns = meta.getColumnCount();
    for (int i = 0; i < columns; i++) {
      if (i > 0) {
        out.print(",");
      }
      out.print("\"");
      out.print(meta.getColumnName(i + 1));
      out.print("\"");
    }
    out.println();

    while (rs.next()) {
      for (int i = 0; i < columns; i++) {
        if (i > 0) {
          out.print(",");
        }
        String value = rs.getString(i + 1);
        if (value != null) {
          out.print("\"");
          out.print(value.replaceAll("\"", "\"\""));
          out.print("\"");
        } else {
          out.print("NULL");
        }
      }
      out.println();
    }
  }
1289811
public boolean hasNextThrow() throws SQLException {
		if (closed) {
			return false;
		}
		if (alreadyMoved) {
			// we do this so multiple hasNext() calls can be made, result would be true or closed is true
			return true;
		}
		boolean result;
		if (first) {
			first = false;
			result = results.first();
		} else {
			result = results.next();
		}
		if (!result) {
			IOUtils.closeThrowSqlException(this, "iterator");
		}
		alreadyMoved = true;
		return result;
	}
970381
public boolean execute(Sql sql) throws SQLException {
		
		long start =  System.currentTimeMillis();
		
		if (sql.validate() == false) {
			return false;
		}
		
		boolean result = false;
		
		PreparedStatement stmt = null;
		try {
			stmt = this.createStatment(conn, sql);
			stmt.execute();
			
			result = true;
		} catch (SQLException e) {
			throw e;
		} finally {
			try {
				if (stmt != null && stmt.isClosed() == false) {
					stmt.close();
				}
			} catch (SQLException e) {
				logger.error(e.getMessage(), e);
			}
		}
		
		logger.debug(String.format("Execute %s used %d ms", sql.getSql(), System.currentTimeMillis() - start));

		return result;
	}
455383
public boolean write(DataOutputStream daOut, boolean bFixedLength)
    {
        try   {
            java.util.Date daData = (java.util.Date)this.getData();
            long lData;
            if (daData == null)
                lData = Long.MIN_VALUE + 1;
            else
                lData = daData.getTime();
            daOut.writeLong(lData);
            return true;
        } catch (IOException ex)    {
            ex.printStackTrace();
            return false;
        }
    }
932118
@Override
	public void write(DataOutputView out) throws IOException {
		out.writeInt(length);
		out.writeInt(position);

		out.write(data, 0, position);
	}
1367876
public boolean hasNext() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.next();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
1333114
@Override
    public boolean last() throws SQLException {
        checkClosed();
        if (rowCount == 0) {
            return false;
        }
        try {
            if (cursorPosition != Position.middle) {
                cursorPosition = Position.middle;
                table.resetRowPosition();
                table.advanceToRow(0);
            }
            return table.advanceToRow(rowCount - 1);
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
24271
public boolean doSeek(String strSeekSign) throws DBException
    {
        m_objLastModBookmark = null;
        String strKeyArea = this.getRecord().getKeyName();
        if (strKeyArea == null)
            strKeyArea = Constants.PRIMARY_KEY;
        int iOpenMode = this.getRecord().getOpenMode();

        Object objKeyData = null;
        KeyAreaInfo keyArea = this.getRecord().getKeyArea(-1);
        if (keyArea != null)
        {
            if (keyArea.getKeyFields() > 1)
            {
                objKeyData = new Vector<Object>();
                for (int i = 0; i < keyArea.getKeyFields(); i++)
                {
                    ((Vector)objKeyData).add(keyArea.getField(i));
                }
            }
            else
                objKeyData = keyArea.getField(Constants.MAIN_KEY_FIELD).getData();
        }
        else
            objKeyData = this.getRecord().getField(Constants.MAIN_FIELD).getData();
        try   {
            Object objData = m_tableRemote.seek(strSeekSign, iOpenMode, strKeyArea, null, objKeyData);
            if (objData instanceof Vector)
            {
                this.setDataSource(objData);
                return true;    // Success
            }
            else if (objData instanceof Boolean)
                return ((Boolean)objData).booleanValue();
            else
                return false; // Never
        } catch (RemoteException ex) {
            throw new DBException(ex.getMessage());
        }
    }
765691
public void doOpen() throws DBException
    {
        try   {
    // FROM is automatic, since the remote BaseRecord is exactly the same as this one
    // ORDER BY
            KeyArea keyArea = this.getRecord().getKeyArea(-1);  // Current index
            String strKeyArea = null;
            boolean bDirection = DBConstants.ASCENDING;
            if (true)
            {
                strKeyArea = keyArea.getKeyName();
                bDirection = keyArea.getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder();
            }
            m_bDirectionCurrent = bDirection;
    // Open mode
            int iOpenMode = this.getRecord().getOpenMode();
    // SELECT (fields to select)
            String strFields = null;
            if (true) // All selected?
            {
                strFields = this.getRecord().getSQLFields(DBConstants.SQL_SELECT_TYPE, true);
                if (strFields.equals(" *"))
                    strFields = null; // Select all
            }
    // WHERE XYZ >=
            Object objInitialKey = null;
            if (true)
            {
                BaseBuffer buffer = new VectorBuffer(null);
                this.getRecord().handleInitialKey();
                if (keyArea.isModified(DBConstants.START_SELECT_KEY))
                {   // Anything set?
                    keyArea.setupKeyBuffer(buffer, DBConstants.START_SELECT_KEY, false);
                    objInitialKey = buffer.getPhysicalData();
                    buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.START_SELECT_KEY, false))); // Largest modified field.
                }
            }
    // WHERE XYZ <=
            Object objEndKey = null;
            if (true)
            {
                BaseBuffer buffer = new VectorBuffer(null);
                this.getRecord().handleEndKey();
                if (keyArea.isModified(DBConstants.END_SELECT_KEY))
                {   // Anything set?
                    keyArea.setupKeyBuffer(buffer, DBConstants.END_SELECT_KEY, false);
                    objEndKey = buffer.getPhysicalData();
                    buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.END_SELECT_KEY, false))); // Largest modified field.
                }
            }
    // WHERE XYZ
            byte[] byBehaviorData = null;
            boolean bDirty = false;
            if (this.getRecord().getListener() != null)
            {
                ByteArrayOutputStream baOut = new ByteArrayOutputStream();
                ObjectOutputStream daOut = new ObjectOutputStream(baOut);
                FileListener listener = (FileListener)this.getRecord().getListener();
                while (listener != null)
                {
                    if ((listener.getMasterSlaveFlag() & FileListener.RUN_IN_SLAVE) != 0) // Should exist in a SERVER environment
                        if ((listener.getMasterSlaveFlag() & FileListener.DONT_REPLICATE_TO_SLAVE) == 0) // Yes, replicate to the SERVER environment
                            if (listener.isEnabledListener()) // Yes, only replicate enabled listeners.
                    { // There should be a copy of this on the server
                        bDirty = true;
                        daOut.writeUTF(listener.getClass().getName());
                        listener.initRemoteStub(daOut);
                    }
                    listener = (FileListener)listener.getNextListener();
                }
                daOut.flush();
                if (bDirty)
                    byBehaviorData = baOut.toByteArray();
                daOut.close();
                baOut.close();
            }

            this.checkCacheMode(Boolean.TRUE);      // Make sure the cache is set up correctly for this type of query (typically needed)

            synchronized (this.getSyncObject())
            {   // In case this is called from another task
                m_tableRemote.open(strKeyArea, iOpenMode, bDirection, strFields, objInitialKey, objEndKey, byBehaviorData);
            }
        } catch (Exception ex) {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
270784
public boolean printData(PrintWriter out, int iPrintOptions)
    {
        boolean bFieldsFound = false;
        String strFieldName = this.getScreenField().getSFieldParam();
        String strFieldData = this.getScreenField().getSFieldValue(true, false);
        if ((this.getScreenField().getConverter() != null)
            && (!(this.getScreenField().getConverter().getField() instanceof XmlField))
            && (!(this.getScreenField().getConverter().getField() instanceof HtmlField))
            && (!(this.getScreenField().getConverter().getField() instanceof XMLPropertiesField)))
                strFieldData = Utility.encodeXML(strFieldData);
        out.println("    " + Utility.startTag(strFieldName) + strFieldData + Utility.endTag(strFieldName));
        return bFieldsFound;
    }
257085
private boolean decodeBulkStringEndOfLine(ByteBuf in, List<Object> out) throws Exception {
        if (in.readableBytes() < RedisConstants.EOL_LENGTH) {
            return false;
        }
        readEndOfLine(in);
        out.add(FullBulkStringRedisMessage.EMPTY_INSTANCE);
        resetDecoder();
        return true;
    }
820122
@Override
    public void write(DataOutput out) throws IOException {
        if (record != null) record.write(out);
    }
649954
public boolean printData(PrintWriter out, int iPrintOptions)
    {
        String strFieldName = this.getScreenField().getSFieldParam();
        String strButtonDesc = ((SButtonBox)this.getScreenField()).getButtonDesc();
        if ((strButtonDesc == null)
            && (((SButtonBox)this.getScreenField()).getImageButtonName() != null))
        {
            if (this.getScreenField().getParentScreen() instanceof GridScreen)
            { // These are command buttons such as "Form" or "Detail"
                GridScreen gridScreen = (GridScreen)this.getScreenField().getParentScreen();
                Record record = gridScreen.getMainRecord();
                String strBookmark = DBConstants.BLANK;
                try {
                    strBookmark = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
                } catch (DBException ex)    {
                    ex.printStackTrace();
                }
                if (this.isSingleDataImage())
                	strBookmark = this.getScreenField().getConverter().toString();
                
                out.println("    " + Utility.startTag(strFieldName) + strBookmark + Utility.endTag(strFieldName));
                return true;
            }
            else
                return super.printData(out, iPrintOptions);
        }
        else
            return super.printData(out, iPrintOptions);
    }
1349132
public void printDataStartForm(PrintWriter out, int iPrintOptions)
    {
        String strRecordName = "norecord";
        Record record = this.getMainRecord();
        if (record != null)
            strRecordName = record.getTableNames(false);
        if ((iPrintOptions & HtmlConstants.MAIN_HEADING_SCREEN) == HtmlConstants.MAIN_HEADING_SCREEN)
        {
            out.println(Utility.startTag(XMLTags.HEADING));
            out.println(Utility.startTag(XMLTags.FILE));
            out.println(Utility.startTag(strRecordName));
        }
        if ((iPrintOptions & HtmlConstants.MAIN_FOOTING_SCREEN) == HtmlConstants.MAIN_FOOTING_SCREEN)
        {
            out.println(Utility.startTag(XMLTags.FOOTING));
            out.println(Utility.startTag(XMLTags.FILE));
            out.println(Utility.startTag(strRecordName));
        }
        if ((iPrintOptions & HtmlConstants.REPORT_SCREEN) != HtmlConstants.REPORT_SCREEN)
            out.println(Utility.startTag(XMLTags.DATA));    // If not a report
    }
738962
public boolean printData(PrintWriter out, int iHtmlAttributes)
    {
        boolean bFieldsFound = false;
        String strXmlFilename = this.getProperty(DBParams.XML);                // Html page
        if (strXmlFilename == null)
            strXmlFilename = this.getProperty(DBParams.TEMPLATE);
        if (DBConstants.BLANK.equals(strXmlFilename))
            strXmlFilename = DBConstants.DEFAULT_HELP_FILE;
        if (strXmlFilename != null)
        {
            if ((strXmlFilename.indexOf(':') == -1) && (strXmlFilename.charAt(0) != '/'))
            {
            	if (strXmlFilename.indexOf('/') == -1)
            		strXmlFilename = DBConstants.DEFAULT_HELP_FILE.substring(0, DBConstants.DEFAULT_HELP_FILE.lastIndexOf('/') + 1) + strXmlFilename;
                String strLanguage = ((BaseApplication)this.getTask().getApplication()).getLanguage(false);
                if ((strLanguage == null) || (strLanguage.equalsIgnoreCase("en")))
                    strLanguage = Constants.BLANK;
                if (strLanguage.length() > 0)
                    strLanguage += "/";
                strXmlFilename = strLanguage + strXmlFilename;  // DBConstants.kxxx;
            }
            boolean bHTML = false;
            if ((strXmlFilename.endsWith(".html"))
                || (strXmlFilename.endsWith(".htm")))
                    bHTML = true;
            if (bHTML)
                out.println(Utility.startTag(XMLTags.HTML));
            InputStream streamIn = this.getTask().getInputStream(strXmlFilename);
            if (streamIn != null)
            	Utility.transferURLStream(null, null, new InputStreamReader(streamIn), out);
            else
            	out.println("File not found: " + strXmlFilename + "<br/>");
            if (bHTML)
                out.println(Utility.endTag(XMLTags.HTML));
        }
        else
            return super.printData(out, HtmlConstants.HTML_DISPLAY);     // DO print screen
        return bFieldsFound;
    }
1336705
public boolean doSeek(String strSeekSign) throws DBException
    {
        Vector<BaseField> vParamList = new Vector<BaseField>();
        try   {
            if (this.lockOnDBTrxType(null, DBConstants.SELECT_TYPE, false))  // SELECT = seek for now; Should I do the unlock in my code?
                this.unlockIfLocked(this.getRecord(), null);    // Release any locks

            // Submit a query, creating a ResultSet object
            this.setResultSet(null, DBConstants.SQL_SEEK_TYPE);
            String strRecordset = this.getRecord().getSQLSeek(strSeekSign, SQLParams.USE_SELECT_LITERALS, vParamList);
            ResultSet resultSet = this.executeQuery(strRecordset, DBConstants.SQL_SEEK_TYPE, vParamList);
            this.setResultSet(resultSet, DBConstants.SQL_SEEK_TYPE);
            boolean more = resultSet.next();
            if (SHARE_STATEMENTS)
                m_iLastOrder = -1;      // This will force a requery next time if there is an active query
            return more;    // Success if at least one record
        } catch (SQLException ex) {
            throw this.getDatabase().convertError(ex);
        } finally {
            vParamList.removeAllElements();
        }
    }