~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Jay Pipes
  • Date: 2009-03-17 06:08:42 UTC
  • mto: This revision was merged to the branch mainline in revision 941.
  • Revision ID: jpipes@serialcoder-20090317060842-lvxno992pxr91kqc
Forgot to add diagnostics_area.cc. thx krow. :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
    {                                   // start counting from the beginning
179
179
      for (offset=0; ; offset+= delimiter_length)
180
180
      {
181
 
        if ((int) (offset= res->strstr(*delimiter, offset)) < 0)
182
 
          return res;                   // Didn't find, return org string
183
 
        if (!--count)
184
 
        {
185
 
          tmp_value.set(*res,0,offset);
186
 
          break;
187
 
        }
 
181
        if ((int) (offset= res->strstr(*delimiter, offset)) < 0)
 
182
          return res;                   // Didn't find, return org string
 
183
        if (!--count)
 
184
        {
 
185
          tmp_value.set(*res,0,offset);
 
186
          break;
 
187
        }
188
188
      }
189
189
    }
190
190
    else
199
199
          address space less than where the found substring is located
200
200
          in res
201
201
        */
202
 
        if ((int) (offset= res->strrstr(*delimiter, offset)) < 0)
203
 
          return res;                   // Didn't find, return org string
 
202
        if ((int) (offset= res->strrstr(*delimiter, offset)) < 0)
 
203
          return res;                   // Didn't find, return org string
204
204
        /*
205
205
          At this point, we've searched for the substring
206
206
          the number of times as supplied by the index value
207
207
        */
208
 
        if (!++count)
209
 
        {
210
 
          offset+= delimiter_length;
211
 
          tmp_value.set(*res,offset,res->length()- offset);
212
 
          break;
213
 
        }
 
208
        if (!++count)
 
209
        {
 
210
          offset+= delimiter_length;
 
211
          tmp_value.set(*res,offset,res->length()- offset);
 
212
          break;
 
213
        }
214
214
      }
215
215
    }
216
216
  }