~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-06-05 00:15:57 UTC
  • mfrom: (1589.1.1 drizzle_events)
  • Revision ID: brian@gaz-20100605001557-j1k41ni5k9mis891
Merge in Barry.

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/replace.h>
23
23
#include <drizzled/error.h>
43
43
  uint32_t from_length,to_length;
44
44
  bool alloced=0;
45
45
  const char *ptr,*end,*strend,*search,*search_end;
46
 
  uint32_t l;
 
46
  register uint32_t l;
47
47
  bool binary_cmp;
48
48
 
49
49
  null_value=0;
80
80
    {
81
81
        if (*ptr == *search)
82
82
        {
83
 
          char *i,*j;
 
83
          register char *i,*j;
84
84
          i=(char*) ptr+1; j=(char*) search+1;
85
85
          while (j != search_end)
86
86
            if (*i++ != *j++) goto skip;
87
87
          offset= (int) (ptr-res->ptr());
88
88
          if (res->length()-from_length + to_length >
89
 
              session.variables.max_allowed_packet)
 
89
              current_session->variables.max_allowed_packet)
90
90
          {
91
 
            push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
91
            push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
92
92
                                ER_WARN_ALLOWED_PACKET_OVERFLOWED,
93
93
                                ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
94
94
                                func_name(),
95
 
                                session.variables.max_allowed_packet);
 
95
                                current_session->variables.max_allowed_packet);
96
96
 
97
97
            goto null;
98
98
          }
114
114
    do
115
115
    {
116
116
      if (res->length()-from_length + to_length >
117
 
          session.variables.max_allowed_packet)
 
117
          current_session->variables.max_allowed_packet)
118
118
      {
119
 
        push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
119
        push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
120
120
                            ER_WARN_ALLOWED_PACKET_OVERFLOWED,
121
121
                            ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
122
 
                            session.variables.max_allowed_packet);
 
122
                            current_session->variables.max_allowed_packet);
123
123
        goto null;
124
124
      }
125
125
      if (!alloced)