1
/* Copyright (c) 2010 PrimeBase Technologies GmbH
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
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.
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.
28
* PrimeBase Media Stream for MySQL/Drizzle
36
* PBMS interface used to enable engines for use with the PBMS daemon.
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'.
44
#ifndef __PBMS_ENABLED_H__
45
#define __PBMS_ENABLED_H__
50
#include <drizzled/common.h>
52
#define uchar unsigned char
54
#include <mysql_priv.h>
58
typedef bool (*IsPBMSFilterFunc)(Field *field);
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.
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
68
extern bool pbms_initialize(const char *engine_name, bool isServer, bool isTransactional, PBMSResultPtr result, IsPBMSFilterFunc is_pbms_blob);
71
* pbms_finalize() should be called from the engines plugIn's 'deinit()' function.
73
extern void pbms_finalize(const char *engine_name);
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.
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.
82
extern int pbms_write_row_blobs(const TABLE *table, unsigned char *buf, PBMSResultPtr result);
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.
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.
91
extern int pbms_update_row_blobs(const TABLE *table, const unsigned char *old_row, unsigned char *new_row, PBMSResultPtr result);
94
* pbms_delete_row_blobs() should be called from the engine's 'delete_row' function.
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.
99
extern int pbms_delete_row_blobs(const TABLE *table, const unsigned char *buf, PBMSResultPtr result);
102
* pbms_rename_table_with_blobs() should be called from the engine's 'rename_table' function.
104
* NOTE: Renaming tables across databases is not supported.
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.
109
extern int pbms_rename_table_with_blobs(const char *old_table_path, const char *new_table_path, PBMSResultPtr result);
112
* pbms_delete_table_with_blobs() should be called from the engine's 'delete_table' function.
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.
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.
120
extern int pbms_delete_table_with_blobs(const char *table_path, PBMSResultPtr result);
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().
127
* pbms_completed() has the effect of committing or rolling back the changes made if the session
128
* is in 'autocommit' mode.
130
extern void pbms_completed(const TABLE *table, bool ok);