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:
5
* Definitions required for Query Cache plugin
7
* Copyright (C) 2008 Mark Atwood
4
* Copyright (C) 2008 Sun Microsystems, Toru Maesaka
5
* Copyright (C) 2010 Djellel Eddine Difallah
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
23
#ifndef DRIZZLED_PLUGIN_QCACHE_H
24
#define DRIZZLED_PLUGIN_QCACHE_H
26
typedef struct qcache_st
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.
35
bool (*qcache_func1)(Session *session, void *parm1, void *parm2);
36
bool (*qcache_func2)(Session *session, void *parm3, void *parm4);
39
#endif /* DRIZZLED_PLUGIN_QCACHE_H */
21
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
22
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
24
#include "drizzled/plugin.h"
25
#include "drizzled/plugin/plugin.h"
26
#include <drizzled/sql_list.h>
37
This is the API that a qcache plugin must implement.
40
class QueryCache : public Plugin
45
QueryCache(const QueryCache &);
46
QueryCache& operator=(const QueryCache &);
50
explicit QueryCache(std::string name_arg)
51
: Plugin(name_arg, "QueryCache")
54
virtual ~QueryCache() {}
56
/* these are the Query Cache interface functions */
58
/* Lookup the cache and transmit the data back to the client */
59
virtual bool doIsCached(Session* session)= 0;
60
/* Lookup the cache and transmit the data back to the client */
61
virtual bool doSendCachedResultset(Session *session)= 0;
62
/* Send the current Resultset to the cache */
63
virtual bool doSetResultset(Session *session)= 0;
64
/* initiate a new Resultset (header) */
65
virtual bool doPrepareResultset(Session *session)= 0;
66
/* push a record to the current Resultset */
67
virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
69
static bool addPlugin(QueryCache *handler);
70
static void removePlugin(QueryCache *handler);
72
/* These are the functions called by the rest of the Drizzle server */
73
static bool isCached(Session *session);
74
static bool sendCachedResultset(Session *session);
75
static bool prepareResultset(Session *session);
76
static bool setResultset(Session *session);
77
static bool insertRecord(Session *session, List<Item> &item);
80
} /* namespace plugin */
81
} /* namespace drizzled */
83
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */