~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.cc

  • Committer: patrick crews
  • Date: 2010-10-07 19:35:15 UTC
  • mto: (1819.2.4 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1825.
  • Revision ID: gleebix@gmail.com-20101007193515-jr6y1uz710lzte1o
Initial work on lp bug#656423 - remove use of 'mysql' from test-run tool.  Removed / substituted mtr->dtr mysql->drizzle.  Removed perl errors, but server won't start due to boost error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
18
18
 */
19
19
 
20
20
#include "config.h"
21
 
 
22
21
#include <cstdio>
 
22
#include "drizzled/plugin/client.h"
23
23
 
24
 
#include <drizzled/plugin/client.h>
25
 
#include <drizzled/type/time.h>
 
24
using namespace std;
26
25
 
27
26
namespace drizzled
28
27
{
29
28
 
30
 
bool plugin::Client::store(const type::Time *from)
 
29
bool plugin::Client::store(const DRIZZLE_TIME *from)
31
30
{
32
31
  const size_t buff_len= 40;
33
32
  char buff[buff_len];
36
35
 
37
36
  switch (from->time_type)
38
37
  {
39
 
  case type::DRIZZLE_TIMESTAMP_DATETIME:
 
38
  case DRIZZLE_TIMESTAMP_DATETIME:
40
39
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d %02d:%02d:%02d",
41
40
                    (int) from->year,
42
41
                    (int) from->month,
48
47
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
49
48
    break;
50
49
 
51
 
  case type::DRIZZLE_TIMESTAMP_DATE:
 
50
  case DRIZZLE_TIMESTAMP_DATE:
52
51
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d",
53
52
                    (int) from->year,
54
53
                    (int) from->month,
55
54
                    (int) from->day);
56
55
    break;
57
56
 
58
 
  case type::DRIZZLE_TIMESTAMP_TIME:
 
57
  case DRIZZLE_TIMESTAMP_TIME:
59
58
    day= (from->year || from->month) ? 0 : from->day;
60
59
    length= snprintf(buff, (buff_len-length), "%s%02ld:%02d:%02d",
61
60
                    from->neg ? "-" : "",
66
65
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
67
66
    break;
68
67
 
69
 
  case type::DRIZZLE_TIMESTAMP_NONE:
70
 
  case type::DRIZZLE_TIMESTAMP_ERROR:
 
68
  case DRIZZLE_TIMESTAMP_NONE:
 
69
  case DRIZZLE_TIMESTAMP_ERROR:
71
70
  default:
72
71
    assert(0);
73
72
    return false;
80
79
{
81
80
  if (from == NULL)
82
81
    return store();
83
 
 
84
82
  return store(from, strlen(from));
85
83
}
86
84