~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin_qcache.h

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/*
 
2
 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
3
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
5
 
 *  Copyright (C) 2010 Djellel Eddine Difallah
 
4
 
 
5
 *  Definitions required for Query Cache plugin
 
6
 
 
7
 *  Copyright (C) 2008 Mark Atwood, Toru Maesaka
6
8
 *
7
9
 *  This program is free software; you can redistribute it and/or modify
8
10
 *  it under the terms of the GNU General Public License as published by
18
20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
21
 */
20
22
 
21
 
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
22
 
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
23
 
 
24
 
#include "drizzled/plugin.h"
25
 
#include "drizzled/plugin/plugin.h"
26
 
#include <drizzled/sql_list.h>
27
 
 
28
 
#include "drizzled/visibility.h"
29
 
 
30
 
namespace drizzled
31
 
{
32
 
class Session;
33
 
class select_result;
34
 
 
35
 
namespace plugin
36
 
{
 
23
#ifndef DRIZZLED_PLUGIN_QCACHE_H
 
24
#define DRIZZLED_PLUGIN_QCACHE_H
37
25
 
38
26
/* 
39
27
  This is the API that a qcache plugin must implement.
 
28
  it should implement each of these function pointers.
 
29
  if a function pointer is NULL (not loaded), that's ok.
 
30
 
 
31
  Return:
 
32
    false = success
 
33
    true  = failure
40
34
*/
41
 
 
42
 
class DRIZZLED_API QueryCache : public Plugin
 
35
typedef struct qcache_st
43
36
{
44
 
private:  
45
 
  
46
 
  QueryCache();
47
 
  QueryCache(const QueryCache &);
48
 
  QueryCache& operator=(const QueryCache &);
49
 
 
50
 
public:  
51
 
 
52
 
  explicit QueryCache(std::string name_arg)
53
 
    : Plugin(name_arg, "QueryCache")
54
 
  {}
55
 
 
56
 
  virtual ~QueryCache() {}
57
 
 
58
 
  /* these are the Query Cache interface functions */
59
 
 
60
 
  /* Lookup the cache and transmit the data back to the client */
61
 
  virtual bool doIsCached(Session* session)= 0;  
62
 
  /* Lookup the cache and transmit the data back to the client */
63
 
  virtual bool doSendCachedResultset(Session *session)= 0;
64
 
  /* Send the current Resultset to the cache */
65
 
  virtual bool doSetResultset(Session *session)= 0;
66
 
  /* initiate a new Resultset (header) */
67
 
  virtual bool doPrepareResultset(Session *session)= 0;
68
 
  /* push a record to the current Resultset */
69
 
  virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
70
 
 
71
 
  static bool addPlugin(QueryCache *handler);
72
 
  static void removePlugin(QueryCache *handler);
73
 
 
74
 
  /* These are the functions called by the rest of the Drizzle server */
75
 
  static bool isCached(Session *session);
76
 
  static bool sendCachedResultset(Session *session);
77
 
  static bool prepareResultset(Session *session);
78
 
  static bool setResultset(Session *session);
79
 
  static bool insertRecord(Session *session, List<Item> &item);
80
 
};
81
 
 
82
 
} /* namespace plugin */
83
 
} /* namespace drizzled */
84
 
 
85
 
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */
 
37
  /* Lookup the cache and transmit the data back to the client */
 
38
  bool (*qcache_try_fetch_and_send)(Session *session, bool transactional);
 
39
 
 
40
  bool (*qcache_set)(Session *session, bool transactional);
 
41
  bool (*qcache_invalidate_table)(Session *session, bool transactional);
 
42
  bool (*qcache_invalidate_db)(Session *session, const char *db_name,
 
43
                               bool transactional);
 
44
  bool (*qcache_flush)(Session *session);
 
45
} qcache_t;
 
46
 
 
47
#endif /* DRIZZLED_PLUGIN_QCACHE_H */