~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to sql/protocol.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
 
1
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
15
*/
15
16
 
16
17
/**
17
18
  @file
534
535
bool Protocol::flush()
535
536
{
536
537
#ifndef EMBEDDED_LIBRARY
537
 
  return net_flush(&thd->net);
 
538
  bool error;
 
539
  thd->main_da.can_overwrite_status= TRUE;
 
540
  error= net_flush(&thd->net);
 
541
  thd->main_da.can_overwrite_status= FALSE;
 
542
  return error;
538
543
#else
539
544
  return 0;
540
545
#endif
574
579
  if (flags & SEND_NUM_ROWS)
575
580
  {                             // Packet with number of elements
576
581
    uchar *pos= net_store_length(buff, list->elements);
577
 
    (void) my_net_write(&thd->net, buff, (size_t) (pos-buff));
 
582
    if (my_net_write(&thd->net, buff, (size_t) (pos-buff)))
 
583
      DBUG_RETURN(1);
578
584
  }
579
585
 
580
586
#ifndef DBUG_OFF
698
704
    if (flags & SEND_DEFAULTS)
699
705
      item->send(&prot, &tmp);                  // Send default value
700
706
    if (prot.write())
701
 
      break;                                    /* purecov: inspected */
 
707
      DBUG_RETURN(1);
702
708
#ifndef DBUG_OFF
703
709
    field_types[count++]= field.type;
704
710
#endif
711
717
      to show that there is no cursor.
712
718
      Send no warning information, as it will be sent at statement end.
713
719
    */
714
 
    write_eof_packet(thd, &thd->net, thd->server_status, thd->total_warn_count);
 
720
    if (write_eof_packet(thd, &thd->net, thd->server_status,
 
721
                         thd->total_warn_count))
 
722
      DBUG_RETURN(1);
715
723
  }
716
724
  DBUG_RETURN(prepare_for_send(list));
717
725
 
849
857
{
850
858
  CHARSET_INFO *tocs= this->thd->variables.character_set_results;
851
859
#ifndef DBUG_OFF
852
 
  DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %s", field_pos,
853
 
                      field_count, (length == 0? "" : from)));
 
860
  DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %.*s", field_pos,
 
861
                      field_count, (int) length, (length == 0 ? "" : from)));
854
862
  DBUG_ASSERT(field_pos < field_count);
855
863
  DBUG_ASSERT(field_types == 0 ||
856
864
              field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
1003
1011
#endif
1004
1012
  char buff[40];
1005
1013
  uint length;
1006
 
  length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
1007
 
                           (int) tm->year,
1008
 
                           (int) tm->month,
1009
 
                           (int) tm->day,
1010
 
                           (int) tm->hour,
1011
 
                           (int) tm->minute,
1012
 
                           (int) tm->second));
 
1014
  length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
 
1015
                  (int) tm->year, (int) tm->month,
 
1016
                  (int) tm->day, (int) tm->hour,
 
1017
                  (int) tm->minute, (int) tm->second);
1013
1018
  if (tm->second_part)
1014
 
    length+= my_sprintf(buff+length,(buff+length, ".%06d",
1015
 
                                     (int)tm->second_part));
 
1019
    length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
1016
1020
  return net_store_data((uchar*) buff, length);
1017
1021
}
1018
1022
 
1046
1050
  char buff[40];
1047
1051
  uint length;
1048
1052
  uint day= (tm->year || tm->month) ? 0 : tm->day;
1049
 
  length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d",
1050
 
                           tm->neg ? "-" : "",
1051
 
                           (long) day*24L+(long) tm->hour,
1052
 
                           (int) tm->minute,
1053
 
                           (int) tm->second));
 
1053
  length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "",
 
1054
                  (long) day*24L+(long) tm->hour, (int) tm->minute,
 
1055
                  (int) tm->second);
1054
1056
  if (tm->second_part)
1055
 
    length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
 
1057
    length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
1056
1058
  return net_store_data((uchar*) buff, length);
1057
1059
}
1058
1060