~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/substr_functions/substr_functions.cc

  • Committer: lbieber
  • Date: 2010-10-01 12:16:18 UTC
  • mfrom: (1802.1.1 fix-bug-651256)
  • Revision ID: lbieber@orisndriz08-20101001121618-uqcboygpjwbiglem
Merge Vijay - fix bug 651256 - Remove --help-extended

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;