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

void com::mysql::jdbc::ServerPreparedStatement::serverLongData ( int  parameterIndex,
BindValue  longData 
) throws SQLException [inline, private]

Sends stream-type data parameters to the server.

  Long data handling:

  • Server gets the long data in pieces with command type 'COM_LONG_DATA'.
  • The packet recieved will have the format as: [COM_LONG_DATA: 1][STMT_ID:4][parameter_number:2][type:2][data]
  • Checks if the type is specified by client, and if yes reads the type, and stores the data in that format.
  • It's up to the client to check for read data ended. The server doesn't care; and also server doesn't notify to the client that it got the data or not; if there is any error; then during execute; the error will be returned


parameterIndex DOCUMENT ME!
SQLException if an error occurs.

Definition at line 1423 of file ServerPreparedStatement.java.

References com::mysql::jdbc::Buffer::clear(), com::mysql::jdbc::StatementImpl::connection, com::mysql::jdbc::ConnectionImpl::getIO(), com::mysql::jdbc::ConnectionImpl::getMutex(), com::mysql::jdbc::MysqlIO::getSharedSendPacket(), com::mysql::jdbc::MysqlIO::sendCommand(), serverStatementId, com::mysql::jdbc::Buffer::writeByte(), com::mysql::jdbc::Buffer::writeBytesNoNull(), com::mysql::jdbc::Buffer::writeInt(), and com::mysql::jdbc::Buffer::writeLong().

Referenced by serverExecute().

            synchronized (this.connection.getMutex()) {
                  MysqlIO mysql = this.connection.getIO();

                  Buffer packet = mysql.getSharedSendPacket();

                  Object value = longData.value;

                  if (value instanceof byte[]) {
                        packet.writeByte((byte) MysqlDefs.COM_LONG_DATA);

                        packet.writeBytesNoNull((byte[]) longData.value);

                        mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
                  } else if (value instanceof InputStream) {
                        storeStream(mysql, parameterIndex, packet, (InputStream) value);
                  } else if (value instanceof java.sql.Blob) {
                        storeStream(mysql, parameterIndex, packet,
                                    ((java.sql.Blob) value).getBinaryStream());
                  } else if (value instanceof Reader) {
                        storeReader(mysql, parameterIndex, packet, (Reader) value);
                  } else {
                        throw SQLError.createSQLException(Messages
                                    .getString("ServerPreparedStatement.18") //$NON-NLS-1$
                                    + value.getClass().getName() + "'", //$NON-NLS-1$

Generated by  Doxygen 1.6.0   Back to index