~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/client.cc

Added the testsuite location finding code to support in-plugin-dir test suites.

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 <cstdio>
 
20
#include "drizzled/server_includes.h"
22
21
#include "drizzled/plugin/client.h"
23
22
 
24
 
namespace drizzled
25
 
{
 
23
using namespace std;
 
24
using namespace drizzled;
26
25
 
27
26
bool plugin::Client::store(const DRIZZLE_TIME *from)
28
27
{
29
 
  const size_t buff_len= 40;
30
 
  char buff[buff_len];
31
 
  uint32_t length= 0;
 
28
  char buff[40];
 
29
  uint32_t length;
32
30
  uint32_t day;
33
31
 
34
32
  switch (from->time_type)
35
33
  {
36
34
  case DRIZZLE_TIMESTAMP_DATETIME:
37
 
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d %02d:%02d:%02d",
 
35
    length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
38
36
                    (int) from->year,
39
37
                    (int) from->month,
40
38
                    (int) from->day,
42
40
                    (int) from->minute,
43
41
                    (int) from->second);
44
42
    if (from->second_part)
45
 
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
 
43
      length+= sprintf(buff+length, ".%06d", (int)from->second_part);
46
44
    break;
47
45
 
48
46
  case DRIZZLE_TIMESTAMP_DATE:
49
 
    length= snprintf(buff, (buff_len-length), "%04d-%02d-%02d",
 
47
    length= sprintf(buff, "%04d-%02d-%02d",
50
48
                    (int) from->year,
51
49
                    (int) from->month,
52
50
                    (int) from->day);
54
52
 
55
53
  case DRIZZLE_TIMESTAMP_TIME:
56
54
    day= (from->year || from->month) ? 0 : from->day;
57
 
    length= snprintf(buff, (buff_len-length), "%s%02ld:%02d:%02d",
 
55
    length= sprintf(buff, "%s%02ld:%02d:%02d",
58
56
                    from->neg ? "-" : "",
59
57
                    (long) day*24L+(long) from->hour,
60
58
                    (int) from->minute,
61
59
                    (int) from->second);
62
60
    if (from->second_part)
63
 
      length+= snprintf(buff+length, (buff_len-length), ".%06d", (int)from->second_part);
 
61
      length+= sprintf(buff+length, ".%06d", (int)from->second_part);
64
62
    break;
65
63
 
66
64
  case DRIZZLE_TIMESTAMP_NONE:
79
77
    return store();
80
78
  return store(from, strlen(from));
81
79
}
82
 
 
83
 
 
84
 
} /* namespace drizzled */