Server Administration

  Home arrow Server Administration arrow Server Responses to Client Communicati...
SERVER ADMINISTRATION

Server Responses to Client Communication
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2010-08-18

    Table of Contents:
  • Server Responses to Client Communication
  • Error Packet
  • EOF Packet
  • Result Set Packets

  •  
     

    SEARCH CODEWALKERS

    Server Responses to Client Communication


    (Page 1 of 4 )

    In this conclusion to a three-part article series on client/server communication, you'll learn about error packets, EOF packets, and more. It is excerpted from chapter four of the book Understanding MySQL Internals, written by Sasha Pachev (O'Reilly, 2007; ISBN: 0596009577). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

    Server Responses

    Table 4-8. Format of serverís OK packet (continued) 

     

     

     

    Offset in the body

    Length

    Description

    1 + rows_len

    id_len

    The value of the generated auto-increment ID for the primary key. Set to 0 if not applicable in the context. The value is stored in the field length format of a data field. I will refer to the length of this value as id_len.

    1 + rows_len + id_len

    2

    Server status bit mask, low byte first. For details on different values, see the macros starting with STATUS_in include/mysql_com.h. In the protocol of version 4.0 and earlier, the status field is present only if it is a nonzero value. In the protocol of version 4.1 and later, it is reported unconditionally.

    3 + rows_len + id_len

    2

    Present only in the protocol of version 4.1 and later. Contains the number of warnings the last command has generated. For example, if the command was COM_QUERYwith LOAD DATA INFILE, and some of the fields or lines could not be properly imported, a number of warnings will be generated. The number is stored with the low byte first.

    5 + rows_len + id_lenin

    msg_len

    An optional field for the status message if one is present in the standard data field format with the field length followed by field value, which in this case is a character string. 

     

     

     

    1 +rows_len + id_lenor

     

    version 4.1 and later protocol.

    3 +rows_len + id_lenin

     

     the older protocol, depending on whether the server status bit mask was included.

     

     

     

    To send anOKpacket from inside the server, you must callsend_ok(). In version 4.1 and later, the function is declared in sql/protocol.h, and defined in sql/protocol.cc. In the earlier versions, it is declared in sql/mysql_priv.h and defined in sql/net_pkg.cc.

    More Server Administration Articles
    More By O'Reilly Media

    blog comments powered by Disqus

    SERVER ADMINISTRATION ARTICLES

    - SSH Case Studies: Gateway Hosts
    - SSH Case Studies: More on Pine and SSH
    - SSH Case Studies: Pine and IMAP
    - SSH Case Studies: More on the Passive Mode
    - SSH Case Studies: Network Address Translation
    - SSH Case Studies: The Passive Mode
    - SSH Case Studies: The FTP Protocol
    - SSH Case Studies: Batch Jobs, FTP and SSH
    - SSH Case Studies: Agents and Authentication
    - SSH Case Studies
    - Server Responses to Client Communication
    - Authentication in Client/Server Communication
    - Client/Server Communication
    - Understanding Awk in the UNIX Shell
    - Stream Editor in the UNIX Shell

    Developer Shed Affiliates

     



    © 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap