~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/substr_functions/substr_functions.cc

  • Committer: lbieber at stabletransit
  • Date: 2010-10-14 15:43:11 UTC
  • mfrom: (1848.1.4 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101014154311-ojsrl9uz80yvizey
Merge Travis - changing struct to C++ classes
Merge Andrew - fix bug #571579: libdrizzle unexpected hang up when using in extremely slow networking environment
Merge Andrew - fix bug #643772: Large rows cannot be read if packet_size exceeds max buffer size
Merge Andrew - fix bug #660082: libdrizzle missing rev.147
Merge Andrew - fix bug 653234: drizzledump (and other clients?) should print Password: prompt on stderr
Merge Andrew - fix bug #653438: "Enter password" prompt should not print stars, or erase them on enter
Merge Andrew - fix bug 659824: Drizzle client UTF8 processing endless loop

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
 *  Copyright (C) 2010 Stewart Smith
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
20
20
 
21
21
#include "config.h"
22
22
 
 
23
#include <drizzled/plugin/function.h>
23
24
#include <algorithm>
24
25
 
25
 
#include <drizzled/charset_info.h>
26
 
#include <drizzled/function/str/strfunc.h>
27
 
#include <drizzled/plugin/function.h>
28
 
 
29
26
using namespace std;
30
27
using namespace drizzled;
31
28
 
 
29
#include <drizzled/function/str/strfunc.h>
 
30
 
32
31
class SubstrFunction :public Item_str_func
33
32
{
34
33
  String tmp_value;
87
86
      (args[1]->unsigned_flag && ((uint64_t) start > INT32_MAX)))
88
87
    return &my_empty_string;
89
88
 
90
 
  start= ((start < 0) ?
91
 
          static_cast<int64_t>(res->numchars() + start)
92
 
          : start - 1);
 
89
  start= ((start < 0) ? res->numchars() + start : start - 1);
93
90
  start= res->charpos((int) start);
94
91
  if ((start < 0) || ((uint) start + 1 > res->length()))
95
92
    return &my_empty_string;
279
276
  "SUBSTR and SUBSTR",
280
277
  PLUGIN_LICENSE_GPL,
281
278
  initialize, /* Plugin Init */
282
 
  NULL,   /* depends */
 
279
  NULL,   /* system variables */
283
280
  NULL    /* config options */
284
281
}
285
282
DRIZZLE_DECLARE_PLUGIN_END;