~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/locate.cc

Reverted 1103

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"
21
 
 
22
 
#include <drizzled/charset_info.h>
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
23
22
#include <drizzled/function/locate.h>
24
 
#include <drizzled/lex_string.h>
25
 
 
26
 
namespace drizzled
27
 
{
28
23
 
29
24
void Item_func_locate::fix_length_and_dec()
30
25
{
40
35
  if (!a || !b)
41
36
  {
42
37
    null_value=1;
43
 
    return 0;
 
38
    return 0; /* purecov: inspected */
44
39
  }
45
40
  null_value=0;
46
41
  /* must be int64_t to avoid truncation */
52
47
  {
53
48
    start0= start= args[2]->val_int() - 1;
54
49
 
55
 
    if ((start < 0) || (start > static_cast<int64_t>(a->length())))
 
50
    if ((start < 0) || (start > a->length()))
56
51
      return 0;
57
52
 
58
53
    /* start is now sufficiently valid to pass to charpos function */
88
83
  str->append(')');
89
84
}
90
85
 
91
 
} /* namespace drizzled */