~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.cc

  • Committer: Andrew Hutchings
  • Date: 2010-12-15 18:59:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2006.
  • Revision ID: andrew@linuxjedi.co.uk-20101215185955-q12lkja8hdnpjqg7
Make the test look for drizzleadmin failure instead of success as this test is not possible to fix for success on our FreeBSD 8.0 box

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>
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