~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/query_cache.h

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

Show diffs side-by-side

added added

removed removed

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