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'.
45
#ifndef __PBMS_ENABLED_H__
46
#define __PBMS_ENABLED_H__
51
#include <drizzled/common.h>
53
#define uchar unsigned char
55
#include <mysql_priv.h>
59
typedef bool (*IsPBMSFilterFunc)(Field *field);
62
* pbms_initialize() should be called from the engines plugIn's 'init()' function.
63
* The engine_name is the name of your engine, "PBXT" or "InnoDB" for example.
65
* The isServer flag indicates if this entire server is being enabled. This is only
66
* true if this is being built into the server's handler code above the engine level
69
extern bool pbms_initialize(const char *engine_name, bool isServer, bool isTransactional, PBMSResultPtr result, IsPBMSFilterFunc is_pbms_blob);
72
* pbms_finalize() should be called from the engines plugIn's 'deinit()' function.
74
extern void pbms_finalize(const char *engine_name);
77
* pbms_write_row_blobs() should be called from the engine's 'write_row' function.
78
* It can alter the row data so it must be called before any other function using the row data.
80
* pbms_completed() must be called after calling pbms_write_row_blobs() and just before
81
* returning from write_row() to indicate if the operation completed successfully.
83
extern int pbms_write_row_blobs(const TABLE *table, unsigned char *buf, PBMSResultPtr result);
86
* pbms_update_row_blobs() should be called from the engine's 'update_row' function.
87
* It can alter the row data so it must be called before any other function using the row data.
89
* pbms_completed() must be called after calling pbms_write_row_blobs() and just before
90
* returning from write_row() to indicate if the operation completed successfully.
92
extern int pbms_update_row_blobs(const TABLE *table, const unsigned char *old_row, unsigned char *new_row, PBMSResultPtr result);
95
* pbms_delete_row_blobs() should be called from the engine's 'delete_row' function.
97
* pbms_completed() must be called after calling pbms_delete_row_blobs() and just before
98
* returning from delete_row() to indicate if the operation completed successfully.
100
extern int pbms_delete_row_blobs(const TABLE *table, const unsigned char *buf, PBMSResultPtr result);
103
* pbms_rename_table_with_blobs() should be called from the engine's 'rename_table' function.
105
* NOTE: Renaming tables across databases is not supported.
107
* pbms_completed() must be called after calling pbms_rename_table_with_blobs() and just before
108
* returning from rename_table() to indicate if the operation completed successfully.
110
extern int pbms_rename_table_with_blobs(const char *old_table_path, const char *new_table_path, PBMSResultPtr result);
113
* pbms_delete_table_with_blobs() should be called from the engine's 'delete_table' function.
115
* NOTE: Currently pbms_delete_table_with_blobs() cannot be undone so it should only
116
* be called after the host engine has performed successfully drop it's table.
118
* pbms_completed() must be called after calling pbms_delete_table_with_blobs() and just before
119
* returning from delete_table() to indicate if the operation completed successfully.
121
extern int pbms_delete_table_with_blobs(const char *table_path, PBMSResultPtr result);
124
* pbms_completed() must be called to indicate success or failure of a an operation after having
125
* called pbms_write_row_blobs(), pbms_delete_row_blobs(), pbms_rename_table_with_blobs(), or
126
* pbms_delete_table_with_blobs().
128
* pbms_completed() has the effect of committing or rolling back the changes made if the session
129
* is in 'autocommit' mode.
131
extern void pbms_completed(const TABLE *table, bool ok);