Drizzled Public API Documentation

drizzle_plugin::ClientMySQLProtocol Class Reference
Inheritance diagram for drizzle_plugin::ClientMySQLProtocol:
drizzled::plugin::Client

Public Member Functions

 ClientMySQLProtocol (int fd, ProtocolCounters &)
bool isInteractive () const
virtual int getFileDescriptor ()
virtual bool isConnected ()
virtual bool flush ()
virtual void close ()
virtual bool authenticate ()
virtual bool readCommand (char **packet, uint32_t &packet_length)
virtual void sendOK ()
virtual void sendEOF ()
virtual void sendError (const drizzled::error_t sql_errno, const char *err)
virtual void sendFields (drizzled::List< drizzled::Item > &)
virtual void store (drizzled::Field *)
virtual void store ()
virtual void store (int32_t from)
virtual void store (uint32_t from)
virtual void store (int64_t from)
virtual void store (uint64_t from)
virtual void store (double from, uint32_t decimals, drizzled::String *buffer)
virtual void store (const char *, size_t)
virtual bool haveError ()
virtual bool wasAborted ()
virtual SessiongetSession ()
virtual void setSession (Session *session_arg)
virtual bool isConsole () const
virtual
catalog::Instance::shared_ptr 
catalog ()
virtual void store (const type::Time *from)
virtual void store (const char *from)
virtual void store (str_ref from)

Public Attributes

ProtocolCounterscounters

Protected Member Functions

bool checkConnection ()
void netStoreData (const void *, size_t)
void writeEOFPacket (uint32_t server_status, uint32_t total_warn_count)
unsigned char * storeLength (unsigned char *packet, uint64_t length)
void makeScramble (char *scramble)

Protected Attributes

NET net
drizzled::String packet
uint32_t client_capabilities
bool _is_interactive
Sessionsession

Detailed Description

Definition at line 65 of file mysql_protocol.h.

Member Function Documentation

bool drizzle_plugin::ClientMySQLProtocol::authenticate ( )
virtual

Perform handshake and authorize client if needed.

Implements drizzled::plugin::Client.

Definition at line 142 of file mysql_protocol.cc.

References sendError(), and sendOK().

void drizzle_plugin::ClientMySQLProtocol::close ( )
virtual

Close the client object.

Implements drizzled::plugin::Client.

Definition at line 132 of file mysql_protocol.cc.

bool drizzle_plugin::ClientMySQLProtocol::flush ( )
virtual

Flush all data that has been buffered with store() methods.

Return values
Booleanindicating success or failure.

Implements drizzled::plugin::Client.

Definition at line 123 of file mysql_protocol.cc.

Referenced by sendFields().

int drizzle_plugin::ClientMySQLProtocol::getFileDescriptor ( )
virtual

Get file descriptor associated with client object.

Return values
Filedescriptor that is attached, -1 if none.

Implements drizzled::plugin::Client.

Definition at line 113 of file mysql_protocol.cc.

virtual Session* drizzled::plugin::Client::getSession ( )
inlinevirtualinherited

Get attached session from the client object.

Return values
Sessionobject that is attached, NULL if none.

Definition at line 50 of file client.h.

bool drizzle_plugin::ClientMySQLProtocol::isConnected ( )
virtual

Check to see if the client is currently connected.

Return values
Booleanvalue representing connected state.

Implements drizzled::plugin::Client.

Definition at line 118 of file mysql_protocol.cc.

bool drizzle_plugin::ClientMySQLProtocol::readCommand ( char **  packet,
uint32_t &  packet_length 
)
virtual

Read command from client.

Implements drizzled::plugin::Client.

Definition at line 177 of file mysql_protocol.cc.

References drizzled::Diagnostics_area::DA_ERROR, sendError(), sendOK(), and drizzled::Session::variables.

void drizzle_plugin::ClientMySQLProtocol::sendEOF ( void  )
virtual

Send eof (= end of result set) to the client.

The eof packet has the following structure:

  • 254 (DRIZZLE_PROTOCOL_NO_MORE_DATA) : Marker (1 byte)
  • warning_count : Stored in 2 bytes; New in 4.1 client
  • status_flag : Stored in 2 bytes; For flags like SERVER_MORE_RESULTS_EXISTS.

Note that the warning count will not be sent if 'no_flush' is set as we don't want to report the warning count until all data is sent to the client.

Implements drizzled::plugin::Client.

Definition at line 358 of file mysql_protocol.cc.

References drizzled::Diagnostics_area::can_overwrite_status, and writeEOFPacket().

void drizzle_plugin::ClientMySQLProtocol::sendError ( const drizzled::error_t  sql_errno,
const char *  err 
)
virtual

Send a error string to client.

For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's critical that every error that can be intercepted is issued in one place only, my_message_sql.

Implements drizzled::plugin::Client.

Definition at line 372 of file mysql_protocol.cc.

References drizzled::Diagnostics_area::can_overwrite_status.

Referenced by authenticate(), and readCommand().

void drizzle_plugin::ClientMySQLProtocol::sendFields ( drizzled::List< drizzled::Item > &  list)
virtual

Send name and type of result to client.

Sum fields has table name empty and field_name.

Parameters
SessionThread data object
listList of items to send to client
flagBit mask with the following functions:
  • 1 send number of rows
  • 2 send default values
  • 4 don't write eof packet
Return values
0ok
1Error (Note that in this case the error is not sent to the client)

Implements drizzled::plugin::Client.

Definition at line 435 of file mysql_protocol.cc.

References flush(), and writeEOFPacket().

void drizzle_plugin::ClientMySQLProtocol::sendOK ( void  )
virtual

Return ok to the client.

The ok packet has the following structure:

  • 0 : Marker (1 byte)
  • affected_rows : Stored in 1-9 bytes
  • id : Stored in 1-9 bytes
  • server_status : Copy of session->server_status; Can be used by client to check if we are inside an transaction. New in 4.0 client
  • warning_count : Stored in 2 bytes; New in 4.1 client
  • message : Stored as packed length (1-9 bytes) + message. Is not stored if no message.
Parameters
sessionThread handler
affected_rowsNumber of rows changed by statement
idAuto_increment id for first row (if used)
messageMessage to send to the client (Used by mysql_status)

Implements drizzled::plugin::Client.

Definition at line 291 of file mysql_protocol.cc.

References drizzled::Diagnostics_area::can_overwrite_status, and drizzled::Diagnostics_area::DA_OK.

Referenced by authenticate(), and readCommand().

virtual void drizzled::plugin::Client::setSession ( Session session_arg)
inlinevirtualinherited

Attach session to the client object.

Parameters
[in]session_argSession object to attach, or NULL to clear.

Definition at line 59 of file client.h.

void drizzle_plugin::ClientMySQLProtocol::writeEOFPacket ( uint32_t  server_status,
uint32_t  total_warn_count 
)
protected

Format EOF packet according to the current client and write it to the network output buffer.

Definition at line 820 of file mysql_protocol.cc.

References drizzled::Session::is_fatal_error.

Referenced by sendEOF(), and sendFields().


The documentation for this class was generated from the following files: