~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/pbms/src/ha_pbms.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 *
19
 
 * Original author: Paul McCullagh
20
 
 * Continued development: Barry Leslie
21
 
 *
22
 
 * 2007-05-20
23
 
 *
24
 
 * H&G2JCtL
25
 
 *
26
 
 * Table handler.
27
 
 *
28
 
 */
29
 
#pragma once
30
 
#ifndef __HA_PBMS_H__
31
 
#define __HA_PBMS_H__
32
 
 
33
 
#include "defs_ms.h"
34
 
#include "engine_ms.h"
35
 
 
36
 
#ifdef USE_PRAGMA_INTERFACE
37
 
#pragma interface                       /* gcc class implementation */
38
 
#endif
39
 
 
40
 
#if MYSQL_VERSION_ID >= 50120
41
 
#define byte uchar
42
 
#endif
43
 
 
44
 
#ifdef DRIZZLED
45
 
#include <drizzled/cursor.h>
46
 
#include <drizzled/thr_lock.h>
47
 
 
48
 
class PBMSStorageEngine;
49
 
#define handlerton PBMSStorageEngine
50
 
#define handler Cursor
51
 
 
52
 
using namespace drizzled;
53
 
 
54
 
#else
55
 
extern handlerton               *pbms_hton;
56
 
#endif
57
 
 
58
 
class MSOpenSystemTable;
59
 
 
60
 
class ha_pbms: public handler
61
 
{
62
 
        THR_LOCK_DATA           ha_lock;                        ///< MySQL lock
63
 
        MSOpenSystemTable       *ha_open_tab;
64
 
        int                                     ha_error;
65
 
        PBMSResultRec           ha_result;
66
 
        //MS_SHARE                      *ha_share;              ///< Shared lock info
67
 
 
68
 
public:
69
 
#ifdef DRIZZLED
70
 
        ha_pbms(handlerton *hton, Table& table_arg);
71
 
#else
72
 
        ha_pbms(handlerton *hton, TABLE_SHARE *table_arg);
73
 
#endif
74
 
        ~ha_pbms() { }
75
 
 
76
 
        const char *table_type() const { return "PBMS"; }
77
 
 
78
 
        const char *index_type(uint inx) { UNUSED(inx); return "NONE"; }
79
 
 
80
 
#ifndef DRIZZLED
81
 
        const char **bas_ext() const;
82
 
 
83
 
        MX_TABLE_TYPES_T table_flags() const;
84
 
#endif
85
 
 
86
 
        MX_ULONG_T index_flags(uint inx, uint part , bool all_parts ) const 
87
 
        { 
88
 
                UNUSED(inx); 
89
 
                UNUSED(part); 
90
 
                UNUSED(all_parts); 
91
 
                return (HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_KEYREAD_ONLY); 
92
 
        }
93
 
        uint    max_supported_keys()                    const { return 512; }
94
 
        uint    max_supported_key_length()    const { return 1024; }
95
 
        uint    max_supported_key_part_length() const { return 1024; }
96
 
 
97
 
        int open(const char *name, int mode, uint test_if_locked);
98
 
        void drop_table(const char *name) {UNUSED(name);}
99
 
 
100
 
        int close(void);
101
 
#ifdef DRIZZLED
102
 
        int             doInsertRecord(byte * buf);
103
 
        int             doUpdateRecord(const byte * old_data, byte * new_data);
104
 
        int             doDeleteRecord(const byte * buf);
105
 
 
106
 
#else
107
 
        int write_row(unsigned char * buf);
108
 
        int update_row(const unsigned char * old_data, unsigned char * new_data);
109
 
        int delete_row(const unsigned char * buf);
110
 
#endif
111
 
 
112
 
        /* Sequential scan functions: */
113
 
#ifdef DRIZZLED
114
 
        int     doStartTableScan(bool scan);
115
 
#else
116
 
        int rnd_init(bool scan);
117
 
#endif
118
 
        int rnd_next(byte *buf);
119
 
        int rnd_pos(byte * buf, byte *pos);
120
 
        void position(const byte *record);
121
 
        int info(uint);
122
 
 
123
 
#ifdef PBMS_HAS_KEYS
124
 
        /* Index access functions: */
125
 
        int             index_init(uint idx, bool sorted);
126
 
        int             index_end();
127
 
        int             index_read(byte * buf, const byte * key,
128
 
                                                                 uint key_len, enum ha_rkey_function find_flag);
129
 
        int             index_read_idx(byte * buf, uint idx, const byte * key,
130
 
                                                                                 uint key_len, enum ha_rkey_function find_flag);
131
 
        int             index_next(byte * buf);
132
 
        int             index_prev(byte * buf);
133
 
        int             index_first(byte * buf);
134
 
        int             index_last(byte * buf);
135
 
        int             index_read_last(byte * buf, const byte * key, uint key_len);
136
 
#endif
137
 
        
138
 
        int             external_lock(THD *thd, int lock_type);
139
 
#ifndef DRIZZLED
140
 
        int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
141
 
#endif
142
 
  void get_auto_increment(uint64_t, uint64_t,
143
 
                          uint64_t,
144
 
                          uint64_t *,
145
 
                          uint64_t *)
146
 
  {}
147
 
 
148
 
        THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type);
149
 
 
150
 
        bool get_error_message(int error, String *buf);
151
 
 
152
 
};
153
 
 
154
 
#endif
155