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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
* PBMS Meta Data utilities.
28
#ifndef __METADATA_MS_H__
29
#define __METADATA_MS_H__
32
#include <drizzled/internal/m_string.h>
33
#include <drizzled/charset_info.h>
48
MetaData(): data(NULL), eod(NULL), position(NULL){}
49
MetaData(char *meta_data, size_t meta_data_size): data(meta_data), eod(meta_data + meta_data_size), position(meta_data){}
51
char *getBuffer() { return data;}
53
void use_data(char *meta_data, size_t meta_data_size)
57
eod = data + meta_data_size;
65
char *findNext(char **value)
67
char *name = position;
71
position += strlen(position) +1;
76
position += strlen(position) +1;
81
char *findName(const char *name)
83
char *metadata = data;
85
while (metadata < eod && my_strcasecmp(&my_charset_utf8_general_ci, metadata, name)) {
86
metadata += strlen(metadata) +1;
87
metadata += strlen(metadata) +1;
91
return metadata + strlen(metadata) +1;
96
char *findNamePosition(const char *name)
98
char *metadata = data;
100
while (metadata < eod && my_strcasecmp(&my_charset_utf8_general_ci, metadata, name)) {
101
metadata += strlen(metadata) +1;
102
metadata += strlen(metadata) +1;
111
#ifdef HAVE_ALIAS_SUPPORT
112
char *findAlias() {return findName(MS_ALIAS_TAG);}
115
static uint32_t recSize(const char *rec)
117
uint32_t len = strlen(rec) + 1;
120
return (len + strlen(rec) + 1);
124
#endif //__METADATA_MS_H__