@Override public Row deepCopy() { return new Row(this); }
private void updateParameters(Row params, PreparedStatement pstmt, EmbedConnection conn) throws SQLException { final int numParams = params != null ? params.size() : 0; for (int paramIndex = 1; paramIndex <= numParams; paramIndex++) { final int index = paramIndex - 1; GFXDType paramType = params.getSQLType(index); Object paramVal; switch (paramType) { case BOOLEAN: if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.BOOLEAN); pstmt.setBoolean(paramIndex, params.getBoolean(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.TINYINT); pstmt.setByte(paramIndex, params.getByte(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.SMALLINT); pstmt.setShort(paramIndex, params.getShort(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.INTEGER); pstmt.setInt(paramIndex, params.getInt(index)); if (params.isNull(index)) {
boolean boolValue = rs.getBoolean(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setBoolean(index, boolValue); byte byteValue = rs.getByte(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setByte(index, byteValue); short shortValue = rs.getShort(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setShort(index, shortValue); int intValue = rs.getInt(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setInt(index, intValue); long longValue = rs.getLong(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setLong(index, longValue);
private final void initRowUpdate(String operation) throws SQLException { checkUpdatable(operation); if (this.changedColumns == null) { this.changedColumns = new BitSet(this.currentRow.size()); } if (this.changedRow == null) { this.changedRow = new Row(this.currentRow); setCurrentRow(this.changedRow); } else if (this.currentRow != this.changedRow) { setCurrentRow(this.changedRow); } }
/** * {@inheritDoc} */ @Override public final void setNull(int parameterIndex, int sqlType) throws SQLException { checkValidParameterIndex(parameterIndex); // ignore sqlType this.paramsList.setNull(parameterIndex - 1); }
@Override public String getSchema() throws SQLException { super.lock(); try { checkClosedConnection(); RowSet rs = this.clientService .executeQuery("VALUES CURRENT SCHEMA", null); List<Row> rows = rs.getRows(); if (rows != null && rows.size() > 0) { return (String)rows.get(0).getObject(0); } else { return null; } } catch (GFXDException gfxde) { throw ThriftExceptionUtil.newSQLException(gfxde); } finally { super.unlock(); } }
/** * {@inheritDoc} */ @Override public final void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { checkValidParameterIndex(parameterIndex); // ignore sqlType and typeName this.paramsList.setNull(parameterIndex - 1); }
/** * {@inheritDoc} */ @Override public void moveToInsertRow() throws SQLException { checkClosed(); checkUpdatable("moveToInsertRow"); if (this.changedColumns == null) { this.changedColumns = new BitSet(this.currentRow.size()); } if (this.insertRow == null) { this.insertRow = new Row(this.rowSet.metadata); } setCurrentRow(this.insertRow); }
boolean boolValue = rs.getBoolean(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setBoolean(index, boolValue); byte byteValue = rs.getByte(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setByte(index, byteValue); short shortValue = rs.getShort(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setShort(index, shortValue); int intValue = rs.getInt(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setInt(index, intValue); long longValue = rs.getLong(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setLong(index, longValue);
private void updateParameters(Row params, PreparedStatement pstmt, EmbedConnection conn) throws SQLException { final int numParams = params != null ? params.size() : 0; for (int paramIndex = 1; paramIndex <= numParams; paramIndex++) { final int index = paramIndex - 1; GFXDType paramType = params.getSQLType(index); Object paramVal; switch (paramType) { case BOOLEAN: if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.BOOLEAN); pstmt.setBoolean(paramIndex, params.getBoolean(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.TINYINT); pstmt.setByte(paramIndex, params.getByte(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.SMALLINT); pstmt.setShort(paramIndex, params.getShort(index)); if (params.isNull(index)) { pstmt.setNull(paramIndex, Types.INTEGER); pstmt.setInt(paramIndex, params.getInt(index)); if (params.isNull(index)) {
/** * {@inheritDoc} */ @Override public void addBatch() throws SQLException { checkClosed(); if (this.parameterMetaData != null && this.parameterMetaData.size() > 0) { if (this.paramsBatch == null) { this.paramsBatch = new ArrayList<Row>(); } this.paramsBatch.add(this.paramsList); this.paramsList = new Row(this.parameterMetaData); } }
/** * {@inheritDoc} */ @Override public final void updateNull(int columnIndex) throws SQLException { final Row currentRow = checkValidColumn(columnIndex); initRowUpdate("updateNull"); final int index = columnIndex - 1; currentRow.setNull(index); this.changedColumns.set(index); }
boolean boolValue = rs.getBoolean(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setBoolean(index, boolValue); byte byteValue = rs.getByte(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setByte(index, byteValue); short shortValue = rs.getShort(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setShort(index, shortValue); int intValue = rs.getInt(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setInt(index, intValue); long longValue = rs.getLong(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setLong(index, longValue);
/** * {@inheritDoc} */ @Override public void cancelRowUpdates() throws SQLException { checkClosed(); checkUpdatable("cancelRowUpdates"); if (this.changedColumns != null) { this.changedColumns.clear(); this.changedRow = new Row(this.currentRow); } }
/** * {@inheritDoc} */ @Override public final void updateDate(int columnIndex, Date x) throws SQLException { final Row currentRow = checkValidColumn(columnIndex); initRowUpdate("updateDate"); if (x != null) { ColumnValueConverter cvc = Converters.getConverter( getSQLType(columnIndex), "Date"); cvc.setDate(currentRow, columnIndex, x); } else { currentRow.setNull(columnIndex - 1); } this.changedColumns.set(columnIndex - 1); }
boolean boolValue = rs.getBoolean(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setBoolean(index, boolValue); byte byteValue = rs.getByte(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setByte(index, byteValue); short shortValue = rs.getShort(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setShort(index, shortValue); int intValue = rs.getInt(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setInt(index, intValue); long longValue = rs.getLong(columnIndex); if (rs.wasNull()) { result.setNull(index); result.setLong(index, longValue);