1
/* Copyright (c) 2009 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include <sys/types.h>
32
#include <drizzled/server_includes.h>
33
#include <drizzled/field/blob.h>
37
//#include "mysql_priv.h"
39
#include "CSStrUtil.h"
45
#include "Repository_ms.h"
46
#include "Database_ms.h"
47
#include "Compactor_ms.h"
48
#include "OpenTable_ms.h"
50
#include "Discover_ms.h"
51
#include "Transaction_ms.h"
52
#include "SysTab_variable.h"
53
#include "backup_ms.h"
56
#include "SysTab_enabled.h"
59
DT_FIELD_INFO pbms_enabled_info[]=
61
{"Name", 32, NULL, MYSQL_TYPE_VARCHAR, &UTF8_CHARSET, NOT_NULL_FLAG, "PBMS enabled engine name"},
62
{"IsServer", 3, NULL, MYSQL_TYPE_VARCHAR, &UTF8_CHARSET, NOT_NULL_FLAG, "Enabled at server level."},
63
{"Transactional", 5, NULL, MYSQL_TYPE_VARCHAR, &UTF8_CHARSET, NOT_NULL_FLAG, "Does the engine support transactions."},
64
{"API-Version", NULL, NULL, MYSQL_TYPE_LONG, NULL, NOT_NULL_FLAG, "The PBMS enabled api version used."},
65
{NULL,NULL, NULL, MYSQL_TYPE_STRING,NULL, 0, NULL}
68
DT_KEY_INFO pbms_enabled_keys[]=
70
{"pbms_enabled_pk", PRI_KEY_FLAG, {"Name", NULL}},
76
* -------------------------------------------------------------------------
79
//-----------------------
80
MSEnabledTable::MSEnabledTable(MSSystemTableShare *share, TABLE *table):
81
MSOpenSystemTable(share, table),
86
//-----------------------
87
MSEnabledTable::~MSEnabledTable()
91
//-----------------------
92
void MSEnabledTable::seqScanInit()
96
//-----------------------
97
bool MSEnabledTable::seqScanNext(char *buf)
99
TABLE *table = mySQLTable;
102
MY_BITMAP *save_write_set;
104
const PBMSEngineRec *eng;
108
eng = MSEngine::getEngineInfoAt(iEnabledIndex++);
112
save_write_set = table->write_set;
113
table->write_set = NULL;
115
memset(buf, 0xFF, table->s->null_bytes);
116
for (Field **field=table->field ; *field ; field++) {
118
save = curr_field->ptr;
119
#if MYSQL_VERSION_ID < 50114
120
curr_field->ptr = (byte *) buf + curr_field->offset();
122
curr_field->ptr = (byte *) buf + curr_field->offset(curr_field->table->record[0]);
125
switch (curr_field->field_name[0]) {
127
ASSERT(strcmp(curr_field->field_name, "Name") == 0);
128
curr_field->store(eng->ms_engine_name, strlen(eng->ms_engine_name), &UTF8_CHARSET);
129
ms_my_set_notnull_in_record(curr_field, buf);
133
ASSERT(strcmp(curr_field->field_name, "IsServer") == 0);
134
if (eng->ms_internal)
139
curr_field->store(yesno, strlen(yesno), &UTF8_CHARSET);
140
ms_my_set_notnull_in_record(curr_field, buf);
144
ASSERT(strcmp(curr_field->field_name, "Transactional") == 0);
145
if (eng->ms_internal || eng->ms_version < 2 )
147
else if (eng->ms_has_transactions)
152
curr_field->store(yesno, strlen(yesno), &UTF8_CHARSET);
153
ms_my_set_notnull_in_record(curr_field, buf);
157
ASSERT(strcmp(curr_field->field_name, "API-Version") == 0);
158
curr_field->store(eng->ms_version, true);
162
curr_field->ptr = save;
165
table->write_set = save_write_set;
169
//-----------------------
170
void MSEnabledTable::seqScanPos(uint8_t *pos)
172
int32_t index = iEnabledIndex -1;
174
index = 0; // This is probably an error condition.
176
mi_int4store(pos, index);
179
//-----------------------
180
void MSEnabledTable::seqScanRead(uint8_t *pos, char *buf)
182
iEnabledIndex = mi_uint4korr(pos);