~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merged vcol stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2010 PrimeBase Technologies GmbH
2
 
 * All rights reserved.
3
 
 * 
4
 
 * Redistribution and use in source and binary forms, with or without 
5
 
 * modification, are permitted provided that the following conditions are met:
6
 
 * 
7
 
 *     * Redistributions of source code must retain the above copyright notice, 
8
 
 *              this list of conditions and the following disclaimer.
9
 
 *     * Redistributions in binary form must reproduce the above copyright notice, 
10
 
 *              this list of conditions and the following disclaimer in the documentation 
11
 
 *              and/or other materials provided with the distribution.
12
 
 *     * Neither the name of the "PrimeBase Technologies GmbH" nor the names of its 
13
 
 *              contributors may be used to endorse or promote products derived from this 
14
 
 *              software without specific prior written permission.
15
 
 * 
16
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
17
 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
18
 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
19
 
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
20
 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
21
 
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
22
 
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
23
 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
24
 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
25
 
 * POSSIBILITY OF SUCH DAMAGE. 
26
 
 *  
27
 
 *
28
 
 * PrimeBase Media Stream for MySQL/Drizzle
29
 
 *
30
 
 * Barry Leslie
31
 
 *
32
 
 * 2009-07-16
33
 
 *
34
 
 * H&G2JCtL
35
 
 *
36
 
 * PBMS interface used to enable engines for use with the PBMS daemon.
37
 
 *
38
 
 * For an example on how to build this into an engine have a look at the PBXT engine
39
 
 * in file ha_pbxt.cc. Search for 'PBMS_ENABLED'.
40
 
 *
41
 
 */
42
 
 
43
 
 
44
 
#ifndef __PBMS_ENABLED_H__
45
 
#define __PBMS_ENABLED_H__
46
 
 
47
 
#include "pbms.h"
48
 
 
49
 
#ifdef DRIZZLED
50
 
#include <drizzled/common.h>
51
 
#define TABLE Table
52
 
#define uchar unsigned char
53
 
#else
54
 
#include <mysql_priv.h>
55
 
#endif
56
 
 
57
 
class Field;
58
 
typedef bool (*IsPBMSFilterFunc)(Field *field);
59
 
 
60
 
/*
61
 
 * pbms_initialize() should be called from the engines plugIn's 'init()' function.
62
 
 * The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
63
 
 *
64
 
 * The isServer flag indicates if this entire server is being enabled. This is only
65
 
 * true if this is being built into the server's handler code above the engine level
66
 
 * calls. 
67
 
 */
68
 
extern bool pbms_initialize(const char *engine_name, bool isServer, bool isTransactional, PBMSResultPtr result, IsPBMSFilterFunc is_pbms_blob);
69
 
 
70
 
/*
71
 
 * pbms_finalize() should be called from the engines plugIn's 'deinit()' function.
72
 
 */
73
 
extern void pbms_finalize(const char *engine_name);
74
 
 
75
 
/*
76
 
 * pbms_write_row_blobs() should be called from the engine's 'write_row' function.
77
 
 * It can alter the row data so it must be called before any other function using the row data.
78
 
 *
79
 
 * pbms_completed() must be called after calling pbms_write_row_blobs() and just before
80
 
 * returning from write_row() to indicate if the operation completed successfully.
81
 
 */
82
 
extern int pbms_write_row_blobs(const TABLE *table, unsigned char *buf, PBMSResultPtr result);
83
 
 
84
 
/*
85
 
 * pbms_update_row_blobs() should be called from the engine's 'update_row' function.
86
 
 * It can alter the row data so it must be called before any other function using the row data.
87
 
 *
88
 
 * pbms_completed() must be called after calling pbms_write_row_blobs() and just before
89
 
 * returning from write_row() to indicate if the operation completed successfully.
90
 
 */
91
 
extern int pbms_update_row_blobs(const TABLE *table, const unsigned char *old_row, unsigned char *new_row, PBMSResultPtr result);
92
 
 
93
 
/*
94
 
 * pbms_delete_row_blobs() should be called from the engine's 'delete_row' function.
95
 
 *
96
 
 * pbms_completed() must be called after calling pbms_delete_row_blobs() and just before
97
 
 * returning from delete_row() to indicate if the operation completed successfully.
98
 
 */
99
 
extern int pbms_delete_row_blobs(const TABLE *table, const unsigned char *buf, PBMSResultPtr result);
100
 
 
101
 
/*
102
 
 * pbms_rename_table_with_blobs() should be called from the engine's 'rename_table' function.
103
 
 *
104
 
 * NOTE: Renaming tables across databases is not supported.
105
 
 *
106
 
 * pbms_completed() must be called after calling pbms_rename_table_with_blobs() and just before
107
 
 * returning from rename_table() to indicate if the operation completed successfully.
108
 
 */
109
 
extern int pbms_rename_table_with_blobs(const char *old_table_path, const char *new_table_path, PBMSResultPtr result);
110
 
 
111
 
/*
112
 
 * pbms_delete_table_with_blobs() should be called from the engine's 'delete_table' function.
113
 
 *
114
 
 * NOTE: Currently pbms_delete_table_with_blobs() cannot be undone so it should only
115
 
 * be called after the host engine has performed successfully drop it's table.
116
 
 *
117
 
 * pbms_completed() must be called after calling pbms_delete_table_with_blobs() and just before
118
 
 * returning from delete_table() to indicate if the operation completed successfully.
119
 
 */
120
 
extern int pbms_delete_table_with_blobs(const char *table_path, PBMSResultPtr result);
121
 
 
122
 
/*
123
 
 * pbms_completed() must be called to indicate success or failure of a an operation after having
124
 
 * called  pbms_write_row_blobs(), pbms_delete_row_blobs(), pbms_rename_table_with_blobs(), or
125
 
 * pbms_delete_table_with_blobs().
126
 
 *
127
 
 * pbms_completed() has the effect of committing or rolling back the changes made if the session
128
 
 * is in 'autocommit' mode.
129
 
 */
130
 
extern void pbms_completed(const TABLE *table, bool ok);
131
 
 
132
 
#endif