~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.cc

  • Committer: Lee Bieber
  • Date: 2010-12-23 23:11:00 UTC
  • mfrom: (2024.1.1 clean)
  • Revision ID: kalebral@gmail.com-20101223231100-0rqirgz7ugkl10yp
Merge Brian - session list cleanup

Show diffs side-by-side

added added

removed removed

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