~vkolesnikov/pbxt/pbxt-preload-test-bug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* Copyright (c) 2009 PrimeBase Technologies GmbH, Germany
 *
 * PrimeBase Media Stream for MySQL
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Barry Leslie
 *
 * 2009-07-16
 *
 * H&G2JCtL
 *
 * PBMS interface used to enable engines for use with the PBMS daemon.
 *
 * For an example on how to build this into an engine have a look at the PBXT engine
 * in file ha_pbxt.cc. Search for 'PBMS_ENABLED'.
 *
 */


#ifndef __PBMS_ENABLED_H__
#define __PBMS_ENABLED_H__

#include "pbms.h"

#ifdef DRIZZLED
#include <drizzled/common.h>
#define TABLE Table
#define uchar unsigned char
#else
#include <mysql_priv.h>
#endif

class Field;
typedef bool (*IsPBMSFilterFunc)(Field *field);

/*
 * pbms_initialize() should be called from the engines plugIn's 'init()' function.
 * The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
 *
 * The isServer flag indicates if this entire server is being enabled. This is only
 * true if this is being built into the server's handler code above the engine level
 * calls. 
 */
extern bool pbms_initialize(const char *engine_name, bool isServer, bool isTransactional, PBMSResultPtr result, IsPBMSFilterFunc is_pbms_blob);

/*
 * pbms_finalize() should be called from the engines plugIn's 'deinit()' function.
 */
extern void pbms_finalize(const char *engine_name);

/*
 * pbms_write_row_blobs() should be called from the engine's 'write_row' function.
 * It can alter the row data so it must be called before any other function using the row data.
 *
 * pbms_completed() must be called after calling pbms_write_row_blobs() and just before
 * returning from write_row() to indicate if the operation completed successfully.
 */
extern int pbms_write_row_blobs(const TABLE *table, unsigned char *buf, PBMSResultPtr result);

/*
 * pbms_update_row_blobs() should be called from the engine's 'update_row' function.
 * It can alter the row data so it must be called before any other function using the row data.
 *
 * pbms_completed() must be called after calling pbms_write_row_blobs() and just before
 * returning from write_row() to indicate if the operation completed successfully.
 */
extern int pbms_update_row_blobs(const TABLE *table, const unsigned char *old_row, unsigned char *new_row, PBMSResultPtr result);

/*
 * pbms_delete_row_blobs() should be called from the engine's 'delete_row' function.
 *
 * pbms_completed() must be called after calling pbms_delete_row_blobs() and just before
 * returning from delete_row() to indicate if the operation completed successfully.
 */
extern int pbms_delete_row_blobs(const TABLE *table, const unsigned char *buf, PBMSResultPtr result);

/*
 * pbms_rename_table_with_blobs() should be called from the engine's 'rename_table' function.
 *
 * NOTE: Renaming tables across databases is not supported.
 *
 * pbms_completed() must be called after calling pbms_rename_table_with_blobs() and just before
 * returning from rename_table() to indicate if the operation completed successfully.
 */
extern int pbms_rename_table_with_blobs(const char *old_table_path, const char *new_table_path, PBMSResultPtr result);

/*
 * pbms_delete_table_with_blobs() should be called from the engine's 'delete_table' function.
 *
 * NOTE: Currently pbms_delete_table_with_blobs() cannot be undone so it should only
 * be called after the host engine has performed successfully drop it's table.
 *
 * pbms_completed() must be called after calling pbms_delete_table_with_blobs() and just before
 * returning from delete_table() to indicate if the operation completed successfully.
 */
extern int pbms_delete_table_with_blobs(const char *table_path, PBMSResultPtr result);

/*
 * pbms_completed() must be called to indicate success or failure of a an operation after having
 * called  pbms_write_row_blobs(), pbms_delete_row_blobs(), pbms_rename_table_with_blobs(), or
 * pbms_delete_table_with_blobs().
 *
 * pbms_completed() has the effect of committing or rolling back the changes made if the session
 * is in 'autocommit' mode.
 */
extern void pbms_completed(const TABLE *table, bool ok);

#endif