~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-03-06 03:33:24 UTC
  • mfrom: (916.1.2 merge)
  • Revision ID: mordred@inaugust.com-20090306033324-dcedf80g9qzywbvu
Merged Brian's merge... re-rotate the tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/str/pad.h>
23
23
#include <drizzled/error.h>
24
24
#include <drizzled/function/str/alloc_buffer.h>
25
25
#include <drizzled/session.h>
26
26
 
27
 
namespace drizzled
28
 
{
29
 
 
30
27
void Item_func_rpad::fix_length_and_dec()
31
28
{
32
29
  // Handle character set for args[0] and args[2].
91
88
  pad_char_length= rpad->numchars();
92
89
 
93
90
  byte_count= count * collation.collation->mbmaxlen;
94
 
  if ((uint64_t) byte_count > session.variables.max_allowed_packet)
 
91
  if ((uint64_t) byte_count > current_session->variables.max_allowed_packet)
95
92
  {
96
 
    push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
93
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
97
94
                        ER_WARN_ALLOWED_PACKET_OVERFLOWED,
98
95
                        ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
99
 
                        func_name(), session.variables.max_allowed_packet);
 
96
                        func_name(), current_session->variables.max_allowed_packet);
100
97
    goto err;
101
98
  }
102
99
  if (args[2]->null_value || !pad_char_length)
196
193
  pad_char_length= pad->numchars();
197
194
  byte_count= count * collation.collation->mbmaxlen;
198
195
 
199
 
  if ((uint64_t) byte_count > session.variables.max_allowed_packet)
 
196
  if ((uint64_t) byte_count > current_session->variables.max_allowed_packet)
200
197
  {
201
 
    push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
198
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
202
199
                        ER_WARN_ALLOWED_PACKET_OVERFLOWED,
203
200
                        ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
204
 
                        func_name(), session.variables.max_allowed_packet);
 
201
                        func_name(), current_session->variables.max_allowed_packet);
205
202
    goto err;
206
203
  }
207
204
 
229
226
  return 0;
230
227
}
231
228
 
232
 
} /* namespace drizzled */