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
23
#include <drizzled/plugin.h>
24
#include <drizzled/plugin/plugin.h>
25
#include <drizzled/sql_list.h>
26
#include <drizzled/visibility.h>
32
This is the API that a qcache plugin must implement.
35
class DRIZZLED_API QueryCache : public Plugin
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 */
38
explicit QueryCache(const std::string& name)
39
: Plugin(name, "QueryCache")
42
/* these are the Query Cache interface functions */
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;
55
static bool addPlugin(QueryCache*);
56
static void removePlugin(QueryCache*);
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>&);
66
} /* namespace plugin */
67
} /* namespace drizzled */