~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-04-05 23:46:43 UTC
  • Revision ID: brian@gaz-20100405234643-0he3xnj902rc70r8
Fixing tests to work with PBXT.

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 <drizzled/server_includes.h>
21
 
#include CSTDINT_H
 
20
#include "config.h"
 
21
 
22
22
#include <drizzled/function/str/right.h>
23
23
 
 
24
namespace drizzled
 
25
{
 
26
 
24
27
String *Item_func_right::val_str(String *str)
25
28
{
26
29
  assert(fixed == 1);
29
32
  int64_t length= args[1]->val_int();
30
33
 
31
34
  if ((null_value=(args[0]->null_value || args[1]->null_value)))
32
 
    return 0; /* purecov: inspected */
 
35
    return 0;
33
36
 
34
37
  /* if "unsigned_flag" is set, we have a *huge* positive number. */
35
38
  if ((length <= 0) && (!args[1]->unsigned_flag))
36
 
    return &my_empty_string; /* purecov: inspected */
 
39
    return &my_empty_string;
37
40
 
38
41
  if (res->length() <= (uint64_t) length)
39
 
    return res; /* purecov: inspected */
 
42
    return res;
40
43
 
41
44
  uint32_t start=res->numchars();
42
45
  if (start <= (uint) length)
52
55
  left_right_max_length();
53
56
}
54
57
 
 
58
} /* namespace drizzled */