Logo Search packages:      
Sourcecode: mysql-connector-java version File versions  Download package

byte [] com::mysql::jdbc::ServerPreparedStatement::getBytes ( int  parameterIndex  )  throws SQLException [inline, package]

See also:
com.mysql.jdbc.PreparedStatement::getBytes(int)

Definition at line 874 of file ServerPreparedStatement.java.

References com::mysql::jdbc::Buffer::clear(), com::mysql::jdbc::StatementImpl::connection, getBinding(), com::mysql::jdbc::Buffer::getByteBuffer(), com::mysql::jdbc::ConnectionImpl::getIO(), com::mysql::jdbc::Buffer::getPosition(), and storeBinding().

Referenced by storeBinding().

                                                              {
            BindValue bindValue = getBinding(parameterIndex, false);

            if (bindValue.isNull) {
                  return null;
            } else if (bindValue.isLongData) {
                  throw new NotImplemented();
            } else {
                  if (this.outByteBuffer == null) {
                        this.outByteBuffer = new Buffer(this.connection
                                    .getNetBufferLength());
                  }

                  this.outByteBuffer.clear();

                  int originalPosition = this.outByteBuffer.getPosition();

                  storeBinding(this.outByteBuffer, bindValue, this.connection.getIO());

                  int newPosition = this.outByteBuffer.getPosition();

                  int length = newPosition - originalPosition;

                  byte[] valueAsBytes = new byte[length];

                  System.arraycopy(this.outByteBuffer.getByteBuffer(),
                              originalPosition, valueAsBytes, 0, length);

                  return valueAsBytes;
            }
      }


Generated by  Doxygen 1.6.0   Back to index