~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/bin_string.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-24 21:23:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2449.
  • Revision ID: olafvdspek@gmail.com-20111024212354-j32gbc2sbsw0985q
Use str_ref

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"
 
20
#include <config.h>
21
21
#include <drizzled/item/bin_string.h>
22
22
 
23
 
namespace drizzled
24
 
{
 
23
namespace drizzled {
25
24
 
26
25
/*
27
26
  bin item.
29
28
  In number context this is a int64_t value.
30
29
*/
31
30
 
32
 
Item_bin_string::Item_bin_string(const char *str, uint32_t str_length)
 
31
Item_bin_string::Item_bin_string(str_ref arg)
33
32
{
34
 
  const char *end= str + str_length - 1;
 
33
  const char *str= arg.data();
 
34
  const char *end= str + arg.size() - 1;
35
35
  unsigned char bits= 0;
36
36
  uint32_t power= 1;
37
37
 
38
 
  max_length= (str_length + 7) >> 3;
 
38
  max_length= (arg.size() + 7) >> 3;
39
39
  char *ptr= (char*) memory::sql_alloc(max_length + 1);
40
 
  if (!ptr)
41
 
    return;
42
40
  str_value.set(ptr, max_length, &my_charset_bin);
43
41
  ptr+= max_length - 1;
44
42
  ptr[1]= 0;                     // Set end null for string
59
57
  fixed= 1;
60
58
}
61
59
 
62
 
 
63
60
} /* namespace drizzled */