~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal_interval.cc

  • Committer: Monty Taylor
  • Date: 2010-01-02 05:11:55 UTC
  • mto: (1259.3.1 build)
  • mto: This revision was merged to the branch mainline in revision 1262.
  • Revision ID: mordred@inaugust.com-20100102051155-akdm8w5rr6xwzayu
pandora-build - proper detection of memcached.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "drizzled/temporal_interval.h"
27
27
#include "drizzled/time_functions.h"
28
28
 
29
 
namespace drizzled
30
 
{
31
 
 
32
 
bool TemporalInterval::initFromItem(Item *args,
33
 
                                    interval_type int_type,
34
 
                                    String *str_value)
 
29
bool drizzled::TemporalInterval::initFromItem(Item *args, interval_type int_type, String *str_value)
35
30
{
36
31
  uint64_t array[MAX_STRING_ELEMENTS];
37
32
  int64_t value= 0;
186
181
  return false;
187
182
}
188
183
 
189
 
bool TemporalInterval::addDate(DRIZZLE_TIME *ltime, interval_type int_type)
 
184
bool drizzled::TemporalInterval::addDate(DRIZZLE_TIME *ltime, interval_type int_type)
190
185
{
191
186
  long period, sign;
192
187
 
293
288
  return 1;
294
289
}
295
290
 
296
 
bool TemporalInterval::getIntervalFromString(const char *str,
297
 
                                             uint32_t length,
298
 
                                             const CHARSET_INFO * const cs,
299
 
                                             uint32_t count, uint64_t *values,
300
 
                                             bool transform_msec)
 
291
bool drizzled::TemporalInterval::getIntervalFromString(const char *str,uint32_t length, const CHARSET_INFO * const cs,
 
292
    uint32_t count, uint64_t *values,
 
293
    bool transform_msec)
301
294
{
302
295
  const char *end= str+length;
303
296
  uint32_t x;
311
304
    const char *start= str;
312
305
    for (value= 0 ; str != end && my_isdigit(cs,*str) ; str++)
313
306
      value= value * 10L + (int64_t) (*str - '0');
314
 
    if (transform_msec && (x == count - 1 || str == end)) // microseconds always last
 
307
    if (transform_msec && x == count - 1) // microseconds always last
315
308
    {
316
309
      long msec_length= 6 - (str - start);
317
310
      if (msec_length > 0)
323
316
    if (str == end && x != count-1)
324
317
    {
325
318
      x++;
326
 
      /* Change values[0...x-1] -> values[count-x...count-1] */
327
 
      internal::bmove_upp((unsigned char*) (values+count),
328
 
                          (unsigned char*) (values+x),
329
 
                          sizeof(*values)*x);
 
319
      /* Change values[0...x-1] -> values[0...count-1] */
 
320
      bmove_upp((unsigned char*) (values+count), (unsigned char*) (values+x),
 
321
          sizeof(*values)*x);
330
322
      memset(values, 0, sizeof(*values)*(count-x));
331
323
      break;
332
324
    }
333
325
  }
334
326
  return (str != end);
335
327
}
336
 
 
337
 
} /* namespace drizzled */