~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/locate.cc

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/locate.h>
23
23
 
24
 
namespace drizzled
25
 
{
26
 
 
27
24
void Item_func_locate::fix_length_and_dec()
28
25
{
29
26
  max_length= MY_INT32_NUM_DECIMAL_DIGITS;
38
35
  if (!a || !b)
39
36
  {
40
37
    null_value=1;
41
 
    return 0;
 
38
    return 0; /* purecov: inspected */
42
39
  }
43
40
  null_value=0;
44
41
  /* must be int64_t to avoid truncation */
50
47
  {
51
48
    start0= start= args[2]->val_int() - 1;
52
49
 
53
 
    if ((start < 0) || (start > static_cast<int64_t>(a->length())))
 
50
    if ((start < 0) || (start > a->length()))
54
51
      return 0;
55
52
 
56
53
    /* start is now sufficiently valid to pass to charpos function */
86
83
  str->append(')');
87
84
}
88
85
 
89
 
} /* namespace drizzled */