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.
29
#ifndef __METADATA_MS_H__
30
#define __METADATA_MS_H__
33
#include <drizzled/internal/m_string.h>
34
#include <drizzled/charset.h>
49
MetaData(): data(NULL), eod(NULL), position(NULL){}
50
MetaData(char *meta_data, size_t meta_data_size): data(meta_data), eod(meta_data + meta_data_size), position(meta_data){}
52
char *getBuffer() { return data;}
54
void use_data(char *meta_data, size_t meta_data_size)
58
eod = data + meta_data_size;
66
char *findNext(char **value)
68
char *name = position;
72
position += strlen(position) +1;
77
position += strlen(position) +1;
82
char *findName(const char *name)
84
char *metadata = data;
86
while (metadata < eod && my_charset_utf8_general_ci.strcasecmp(metadata, name)) {
87
metadata += strlen(metadata) +1;
88
metadata += strlen(metadata) +1;
92
return metadata + strlen(metadata) +1;
97
char *findNamePosition(const char *name)
99
char *metadata = data;
101
while (metadata < eod && my_charset_utf8_general_ci.strcasecmp(metadata, name)) {
102
metadata += strlen(metadata) +1;
103
metadata += strlen(metadata) +1;
112
#ifdef HAVE_ALIAS_SUPPORT
113
char *findAlias() {return findName(MS_ALIAS_TAG);}
116
static uint32_t recSize(const char *rec)
118
uint32_t len = strlen(rec) + 1;
121
return (len + strlen(rec) + 1);
125
#endif //__METADATA_MS_H__