~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal_interval.cc

pandora-build v0.71. Added check for avahi.

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"
21
 
#include "drizzled/internal/m_string.h"
22
 
#include "drizzled/error.h"
23
 
#include "drizzled/session.h"
24
 
#include "config.h"
25
 
#include "drizzled/function/time/date.h"
26
 
#include "drizzled/temporal_interval.h"
27
 
#include "drizzled/time_functions.h"
28
 
 
29
 
namespace drizzled
30
 
{
31
 
 
32
 
bool TemporalInterval::initFromItem(Item *args,
33
 
                                    interval_type int_type,
34
 
                                    String *str_value)
 
20
#include <drizzled/global.h>
 
21
#include <drizzled/error.h>
 
22
#include <drizzled/session.h>
 
23
#include <drizzled/server_includes.h>
 
24
#include <drizzled/function/time/date.h>
 
25
#include <drizzled/temporal_interval.h>
 
26
 
 
27
bool drizzled::TemporalInterval::initFromItem(Item *args, interval_type int_type, String *str_value)
35
28
{
36
29
  uint64_t array[MAX_STRING_ELEMENTS];
37
30
  int64_t value= 0;
186
179
  return false;
187
180
}
188
181
 
189
 
bool TemporalInterval::addDate(DRIZZLE_TIME *ltime, interval_type int_type)
 
182
bool drizzled::TemporalInterval::addDate(DRIZZLE_TIME *ltime, interval_type int_type)
190
183
{
191
184
  long period, sign;
192
185
 
293
286
  return 1;
294
287
}
295
288
 
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)
 
289
bool drizzled::TemporalInterval::getIntervalFromString(const char *str,uint32_t length, const CHARSET_INFO * const cs,
 
290
    uint32_t count, uint64_t *values,
 
291
    bool transform_msec)
301
292
{
302
293
  const char *end= str+length;
303
294
  uint32_t x;
311
302
    const char *start= str;
312
303
    for (value= 0 ; str != end && my_isdigit(cs,*str) ; str++)
313
304
      value= value * 10L + (int64_t) (*str - '0');
314
 
    if (transform_msec && (x == count - 1 || str == end)) // microseconds always last
 
305
    if (transform_msec && x == count - 1) // microseconds always last
315
306
    {
316
307
      long msec_length= 6 - (str - start);
317
308
      if (msec_length > 0)
323
314
    if (str == end && x != count-1)
324
315
    {
325
316
      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);
 
317
      /* Change values[0...x-1] -> values[0...count-1] */
 
318
      bmove_upp((unsigned char*) (values+count), (unsigned char*) (values+x),
 
319
          sizeof(*values)*x);
330
320
      memset(values, 0, sizeof(*values)*(count-x));
331
321
      break;
332
322
    }
333
323
  }
334
324
  return (str != end);
335
325
}
336
 
 
337
 
} /* namespace drizzled */