24
24
#include <algorithm>
26
26
#include <uuid/uuid.h>
28
#include <drizzled/field/uuid.h>
28
#include "drizzled/field/uuid.h"
30
#include <drizzled/error.h>
31
#include <drizzled/internal/my_sys.h>
32
#include <drizzled/session.h>
33
#include <drizzled/table.h>
30
#include "drizzled/error.h"
31
#include "drizzled/internal/my_sys.h"
32
#include "drizzled/session.h"
33
#include "drizzled/table.h"
34
#include "drizzled/temporal.h"
94
int Uuid::store_decimal(const drizzled::type::Decimal*)
95
int Uuid::store_decimal(const drizzled::my_decimal*)
96
97
ASSERT_COLUMN_MARKED_FOR_WRITE;
97
98
my_error(ER_INVALID_UUID_VALUE, MYF(ME_FATALERROR));
103
104
res.set_ascii(STRING_WITH_LEN("uuid"));
106
double Uuid::val_real() const
107
double Uuid::val_real()
108
109
ASSERT_COLUMN_MARKED_FOR_READ;
109
110
my_error(ER_INVALID_UUID_VALUE, MYF(ME_FATALERROR));
113
int64_t Uuid::val_int() const
114
int64_t Uuid::val_int()
115
116
ASSERT_COLUMN_MARKED_FOR_READ;
116
117
my_error(ER_INVALID_UUID_VALUE, MYF(ME_FATALERROR));
136
String *Uuid::val_str(String *val_buffer, String *) const
137
String *Uuid::val_str(String *val_buffer, String *)
138
139
const CHARSET_INFO * const cs= &my_charset_bin;
139
uint32_t mlength= (type::Uuid::DISPLAY_BUFFER_LENGTH) * cs->mbmaxlen;
140
uint32_t mlength= (uuid_st::DISPLAY_BUFFER_LENGTH) * cs->mbmaxlen;
142
143
val_buffer->alloc(mlength);
143
144
char *buffer=(char*) val_buffer->ptr();
148
149
uu.unparse(buffer);
150
val_buffer->length(type::Uuid::DISPLAY_LENGTH);
151
val_buffer->length(uuid_st::DISPLAY_LENGTH);
152
153
return val_buffer;
155
156
void Uuid::sort_string(unsigned char *to, uint32_t length_arg)
157
assert(length_arg == type::Uuid::LENGTH);
158
assert(length_arg == uuid_st::LENGTH);
158
159
memcpy(to, ptr, length_arg);
161
bool Uuid::get_date(type::Time <ime, uint32_t ) const
162
bool Uuid::get_date(DRIZZLE_TIME *ltime, uint32_t )
167
168
if (uu.isTimeType())
169
171
struct timeval ret_tv;
171
memset(&ret_tv, 0, sizeof(struct timeval));
173
ret_tv.tv_sec= ret_tv.tv_usec= 0;
177
temporal.from_time_t(ret_tv.tv_sec);
179
ltime->time_type= DRIZZLE_TIMESTAMP_DATETIME;
180
ltime->year= temporal.years();
181
ltime->month= temporal.months();
182
ltime->day= temporal.days();
183
ltime->hour= temporal.hours();
184
ltime->minute= temporal.minutes();
185
ltime->second= temporal.seconds();
186
ltime->second_part= temporal.nseconds();
190
memset(ltime, 0, sizeof(DRIZZLE_TIME));
184
bool Uuid::get_time(type::Time <ime) const
195
bool Uuid::get_time(DRIZZLE_TIME *ltime)
186
197
return get_date(ltime, 0);