~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/str/pad.cc

  • Committer: Monty Taylor
  • Date: 2010-06-20 19:25:46 UTC
  • mto: (1626.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1633.
  • Revision ID: mordred@inaugust.com-20100620192546-vb496u81mnxepu9u
Replaced terrible casting with strdup+free.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
 
22
22
#include <drizzled/function/str/pad.h>
23
23
#include <drizzled/error.h>
91
91
  pad_char_length= rpad->numchars();
92
92
 
93
93
  byte_count= count * collation.collation->mbmaxlen;
94
 
  if ((uint64_t) byte_count > session.variables.max_allowed_packet)
 
94
  if ((uint64_t) byte_count > current_session->variables.max_allowed_packet)
95
95
  {
96
 
    push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
96
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
97
97
                        ER_WARN_ALLOWED_PACKET_OVERFLOWED,
98
98
                        ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
99
 
                        func_name(), session.variables.max_allowed_packet);
 
99
                        func_name(), current_session->variables.max_allowed_packet);
100
100
    goto err;
101
101
  }
102
102
  if (args[2]->null_value || !pad_char_length)
196
196
  pad_char_length= pad->numchars();
197
197
  byte_count= count * collation.collation->mbmaxlen;
198
198
 
199
 
  if ((uint64_t) byte_count > session.variables.max_allowed_packet)
 
199
  if ((uint64_t) byte_count > current_session->variables.max_allowed_packet)
200
200
  {
201
 
    push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
201
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
202
202
                        ER_WARN_ALLOWED_PACKET_OVERFLOWED,
203
203
                        ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
204
 
                        func_name(), session.variables.max_allowed_packet);
 
204
                        func_name(), current_session->variables.max_allowed_packet);
205
205
    goto err;
206
206
  }
207
207