~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/Discover_ms.h

Added the PBMS daemon plugin.

(Augen zu und durch!)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
 
2
 *
 
3
 * PrimeBase MS
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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
 
18
 *
 
19
 *  Created by Leslie on 8/27/08.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef __DISCOVER_MS_H__
 
24
#define __DISCOVER_MS_H__
 
25
#include "CSConfig.h"
 
26
 
 
27
#ifdef DRIZZLED
 
28
#include <drizzled/server_includes.h>
 
29
#include <drizzled/table.h>
 
30
#include <drizzled/message/table.pb.h>
 
31
#include <drizzled/table_proto.h>
 
32
#endif
 
33
 
 
34
#define UTF8_CHARSET    my_charset_utf8_general_ci
 
35
 
 
36
/*
 
37
 * ---------------------------------------------------------------
 
38
 * TABLE DISCOVERY HANDLER
 
39
 */
 
40
 
 
41
typedef struct dt_field_info
 
42
        {
 
43
        /** 
 
44
        This is used as column name. 
 
45
        */
 
46
        const char* field_name;
 
47
        /**
 
48
        For string-type columns, this is the maximum number of
 
49
        characters. For numeric data this can be NULL.
 
50
        */
 
51
        uint field_length;
 
52
 
 
53
        /**
 
54
        For decimal  columns, this is the maximum number of
 
55
        digits after the decimal. For other data this can be NULL.
 
56
        */
 
57
        char* field_decimal_length;
 
58
        /**
 
59
        This denotes data type for the column. For the most part, there seems to
 
60
        be one entry in the enum for each SQL data type, although there seem to
 
61
        be a number of additional entries in the enum.
 
62
        */
 
63
        enum enum_field_types field_type;
 
64
 
 
65
        /**
 
66
        This is the charater set for non numeric data types including blob data.
 
67
        */
 
68
#ifdef DRIZZLED
 
69
        const CHARSET_INFO *field_charset;
 
70
#else
 
71
        CHARSET_INFO *field_charset;
 
72
#endif
 
73
        uint field_flags;        // Field atributes(maybe_null, signed, unsigned etc.)
 
74
        const char* comment;
 
75
} DT_FIELD_INFO;
 
76
 
 
77
typedef struct dt_key_info
 
78
{
 
79
        const char*     key_name;
 
80
        uint            key_type; /* PRI_KEY_FLAG, UNIQUE_KEY_FLAG, MULTIPLE_KEY_FLAG */
 
81
        const char*     key_columns[8]; // The size of this can be set to what ever you need.
 
82
} DT_KEY_INFO;
 
83
 
 
84
static DT_FIELD_INFO t_info[]=
 
85
{
 
86
        {"Blob_data",                   NULL, NULL, MYSQL_TYPE_LONG_BLOB,       &my_charset_bin, NOT_NULL_FLAG, "The data of this BLOB"},
 
87
        {NULL,                                  NULL, NULL, MYSQL_TYPE_STRING,  NULL, 0,                                                                                                                                NULL}
 
88
};
 
89
 
 
90
typedef struct internal_table_info {
 
91
        bool                    is_pbms;
 
92
        const char              *name;
 
93
        DT_FIELD_INFO   *info;
 
94
        DT_KEY_INFO             *keys;
 
95
} INTERRNAL_TABLE_INFO;
 
96
 
 
97
 
 
98
#ifdef DRIZZLED
 
99
int ms_create_proto_table(const char *engine_name, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys, drizzled::message::Table *table);
 
100
#else
 
101
int ms_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys, uchar **frmblob, size_t *frmlen);
 
102
#endif
 
103
 
 
104
#endif
 
105