drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzle_plugin::ClientMySQLProtocol Class Reference
Inheritance diagram for drizzle_plugin::ClientMySQLProtocol:
[legend]
Collaboration diagram for drizzle_plugin::ClientMySQLProtocol:
[legend]

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 ()
Public Member Functions inherited from drizzled::plugin::Client
virtual Session * getSession ()
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

ProtocolCounters & counters

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
Protected Attributes inherited from drizzled::plugin::Client
Session * session

Detailed Description

Definition at line 65 of file mysql_protocol.h.

Constructor & Destructor Documentation

◆ ClientMySQLProtocol()

drizzle_plugin::ClientMySQLProtocol::ClientMySQLProtocol ( int fd,
ProtocolCounters & set_counters )

Definition at line 93 of file mysql_protocol.cc.

◆ ~ClientMySQLProtocol()

drizzle_plugin::ClientMySQLProtocol::~ClientMySQLProtocol ( )
virtual

Definition at line 108 of file mysql_protocol.cc.

Member Function Documentation

◆ authenticate()

bool drizzle_plugin::ClientMySQLProtocol::authenticate ( )
virtual

Perform handshake and authorize client if needed.

Implements drizzled::plugin::Client.

Definition at line 143 of file mysql_protocol.cc.

◆ checkConnection()

bool drizzle_plugin::ClientMySQLProtocol::checkConnection ( )
protected

Definition at line 631 of file mysql_protocol.cc.

◆ close()

void drizzle_plugin::ClientMySQLProtocol::close ( )
virtual

Close the client object.

Implements drizzled::plugin::Client.

Definition at line 133 of file mysql_protocol.cc.

◆ flush()

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 124 of file mysql_protocol.cc.

◆ getFileDescriptor()

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 114 of file mysql_protocol.cc.

◆ haveError()

bool drizzle_plugin::ClientMySQLProtocol::haveError ( void )
virtual

Implements drizzled::plugin::Client.

Definition at line 626 of file mysql_protocol.cc.

◆ isConnected()

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 119 of file mysql_protocol.cc.

◆ isInteractive()

bool drizzle_plugin::ClientMySQLProtocol::isInteractive ( ) const
inlinevirtual

Reimplemented from drizzled::plugin::Client.

Definition at line 83 of file mysql_protocol.h.

◆ makeScramble()

void drizzle_plugin::ClientMySQLProtocol::makeScramble ( char * scramble)
protected

Definition at line 880 of file mysql_protocol.cc.

◆ netStoreData()

void drizzle_plugin::ClientMySQLProtocol::netStoreData ( const void * from,
size_t length )
protected

Definition at line 802 of file mysql_protocol.cc.

◆ readCommand()

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

Read command from client.

Implements drizzled::plugin::Client.

Definition at line 178 of file mysql_protocol.cc.

◆ sendEOF()

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 359 of file mysql_protocol.cc.

◆ sendError()

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 373 of file mysql_protocol.cc.

◆ sendFields()

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 436 of file mysql_protocol.cc.

◆ sendOK()

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 292 of file mysql_protocol.cc.

◆ store() [1/8]

void drizzle_plugin::ClientMySQLProtocol::store ( void )
virtual

Implements drizzled::plugin::Client.

Definition at line 579 of file mysql_protocol.cc.

◆ store() [2/8]

void drizzle_plugin::ClientMySQLProtocol::store ( const char * from,
size_t length )
virtual

Implements drizzled::plugin::Client.

Definition at line 616 of file mysql_protocol.cc.

◆ store() [3/8]

void drizzle_plugin::ClientMySQLProtocol::store ( double from,
uint32_t decimals,
drizzled::String * buffer )
virtual

Implements drizzled::plugin::Client.

Definition at line 610 of file mysql_protocol.cc.

◆ store() [4/8]

void drizzle_plugin::ClientMySQLProtocol::store ( drizzled::Field * from)
virtual

Implements drizzled::plugin::Client.

Definition at line 562 of file mysql_protocol.cc.

◆ store() [5/8]

void drizzle_plugin::ClientMySQLProtocol::store ( int32_t from)
virtual

Implements drizzled::plugin::Client.

Definition at line 586 of file mysql_protocol.cc.

◆ store() [6/8]

void drizzle_plugin::ClientMySQLProtocol::store ( int64_t from)
virtual

Implements drizzled::plugin::Client.

Definition at line 598 of file mysql_protocol.cc.

◆ store() [7/8]

void drizzle_plugin::ClientMySQLProtocol::store ( uint32_t from)
virtual

Implements drizzled::plugin::Client.

Definition at line 592 of file mysql_protocol.cc.

◆ store() [8/8]

void drizzle_plugin::ClientMySQLProtocol::store ( uint64_t from)
virtual

Implements drizzled::plugin::Client.

Definition at line 604 of file mysql_protocol.cc.

◆ storeLength()

unsigned char * drizzle_plugin::ClientMySQLProtocol::storeLength ( unsigned char * packet,
uint64_t length )
protected

Definition at line 855 of file mysql_protocol.cc.

◆ wasAborted()

bool drizzle_plugin::ClientMySQLProtocol::wasAborted ( void )
virtual

Implements drizzled::plugin::Client.

Definition at line 621 of file mysql_protocol.cc.

◆ writeEOFPacket()

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 821 of file mysql_protocol.cc.

Member Data Documentation

◆ _is_interactive

bool drizzle_plugin::ClientMySQLProtocol::_is_interactive
protected

Definition at line 71 of file mysql_protocol.h.

◆ client_capabilities

uint32_t drizzle_plugin::ClientMySQLProtocol::client_capabilities
protected

Definition at line 70 of file mysql_protocol.h.

◆ counters

ProtocolCounters& drizzle_plugin::ClientMySQLProtocol::counters

Definition at line 88 of file mysql_protocol.h.

◆ net

NET drizzle_plugin::ClientMySQLProtocol::net
protected

Definition at line 68 of file mysql_protocol.h.

◆ packet

drizzled::String drizzle_plugin::ClientMySQLProtocol::packet
protected

Definition at line 69 of file mysql_protocol.h.


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