~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.cc

  • Committer: Brian Aker
  • Date: 2011-02-12 06:56:00 UTC
  • mto: This revision was merged to the branch mainline in revision 2161.
  • Revision ID: brian@tangent.org-20110212065600-m6c68fybw51rflhj
Further strip out includes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include "config.h"
 
21
 
21
22
#include <cstdio>
22
 
#include "drizzled/plugin/client.h"
 
23
 
 
24
#include <drizzled/plugin/client.h>
 
25
#include <drizzled/type/time.h>
23
26
 
24
27
namespace drizzled
25
28
{
26
29
 
27
 
bool plugin::Client::store(const DRIZZLE_TIME *from)
 
30
bool plugin::Client::store(const type::Time *from)
28
31
{
29
32
  const size_t buff_len= 40;
30
33
  char buff[buff_len];
33
36
 
34
37
  switch (from->time_type)
35
38
  {
36
 
  case DRIZZLE_TIMESTAMP_DATETIME:
 
39
  case type::DRIZZLE_TIMESTAMP_DATETIME:
37
40
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d %02d:%02d:%02d",
38
41
                    (int) from->year,
39
42
                    (int) from->month,
45
48
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
46
49
    break;
47
50
 
48
 
  case DRIZZLE_TIMESTAMP_DATE:
 
51
  case type::DRIZZLE_TIMESTAMP_DATE:
49
52
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d",
50
53
                    (int) from->year,
51
54
                    (int) from->month,
52
55
                    (int) from->day);
53
56
    break;
54
57
 
55
 
  case DRIZZLE_TIMESTAMP_TIME:
 
58
  case type::DRIZZLE_TIMESTAMP_TIME:
56
59
    day= (from->year || from->month) ? 0 : from->day;
57
60
    length= snprintf(buff, (buff_len-length), "%s%02ld:%02d:%02d",
58
61
                    from->neg ? "-" : "",
63
66
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
64
67
    break;
65
68
 
66
 
  case DRIZZLE_TIMESTAMP_NONE:
67
 
  case DRIZZLE_TIMESTAMP_ERROR:
 
69
  case type::DRIZZLE_TIMESTAMP_NONE:
 
70
  case type::DRIZZLE_TIMESTAMP_ERROR:
68
71
  default:
69
72
    assert(0);
70
73
    return false;
77
80
{
78
81
  if (from == NULL)
79
82
    return store();
 
83
 
80
84
  return store(from, strlen(from));
81
85
}
82
86