~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/field/datetime.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
** datetime type
39
39
** In string context: YYYY-MM-DD HH:MM:DD
40
40
** In number context: YYYYMMDDHHMMDD
41
 
** Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte int.
42
41
****************************************************************************/
43
42
 
44
43
int Field_datetime::store(const char *from,
61
60
  temporal.to_int64_t(&int_value);
62
61
 
63
62
#ifdef WORDS_BIGENDIAN
64
 
  if (table && table->s->db_low_byte_first)
 
63
  if (getTable() && getTable()->s->db_low_byte_first)
65
64
  {
66
65
    int8store(ptr, int_value);
67
66
  }
116
115
  temporal.to_int64_t(&int_value);
117
116
 
118
117
#ifdef WORDS_BIGENDIAN
119
 
  if (table && table->s->db_low_byte_first)
 
118
  if (getTable() && getTable()->s->db_low_byte_first)
120
119
  {
121
120
    int8store(ptr, int_value);
122
121
  }
152
151
  temporal.to_int64_t(&int_value);
153
152
 
154
153
#ifdef WORDS_BIGENDIAN
155
 
  if (table && table->s->db_low_byte_first)
 
154
  if (getTable() && getTable()->s->db_low_byte_first)
156
155
  {
157
156
    int8store(ptr, int_value);
158
157
  }
174
173
  ASSERT_COLUMN_MARKED_FOR_READ;
175
174
 
176
175
#ifdef WORDS_BIGENDIAN
177
 
  if (table && table->s->db_low_byte_first)
 
176
  if (getTable() && getTable()->s->db_low_byte_first)
178
177
    j=sint8korr(ptr);
179
178
  else
180
179
#endif
193
192
  ASSERT_COLUMN_MARKED_FOR_READ;
194
193
 
195
194
#ifdef WORDS_BIGENDIAN
196
 
  if (table && table->s->db_low_byte_first)
 
195
  if (getTable() && getTable()->s->db_low_byte_first)
197
196
    tmp=sint8korr(ptr);
198
197
  else
199
198
#endif
207
206
   * not null without a default value.
208
207
   */
209
208
  dt.from_int64_t(tmp, false); /* NOTE: this does *NOT* attempt convertion
210
 
                                        from formats such as 20090101 as
211
 
                                        the stored value has already been
212
 
                                        converted.
213
 
                               */
 
209
                                 from formats such as 20090101 as
 
210
                                 the stored value has already been
 
211
                                 converted.
 
212
                               */
214
213
 
215
214
  int rlen;
216
215
  rlen= dt.to_string((char*)val_buffer->ptr(), DateTime::MAX_STRING_LENGTH);
249
248
{
250
249
  int64_t a,b;
251
250
#ifdef WORDS_BIGENDIAN
252
 
  if (table && table->s->db_low_byte_first)
 
251
  if (getTable() && getTable()->s->db_low_byte_first)
253
252
  {
254
253
    a=sint8korr(a_ptr);
255
254
    b=sint8korr(b_ptr);
267
266
void Field_datetime::sort_string(unsigned char *to,uint32_t )
268
267
{
269
268
#ifdef WORDS_BIGENDIAN
270
 
  if (!table || !table->s->db_low_byte_first)
 
269
  if (!getTable() || !getTable()->s->db_low_byte_first)
271
270
  {
272
271
    to[0] = ptr[0];
273
272
    to[1] = ptr[1];