1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
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
19
* Created by Leslie on 8/27/08.
23
#ifndef __DISCOVER_MS_H__
24
#define __DISCOVER_MS_H__
28
#include <drizzled/server_includes.h>
29
#include <drizzled/table.h>
30
#include <drizzled/message/table.pb.h>
31
#include <drizzled/table_proto.h>
34
#define UTF8_CHARSET my_charset_utf8_general_ci
37
* ---------------------------------------------------------------
38
* TABLE DISCOVERY HANDLER
41
typedef struct dt_field_info
44
This is used as column name.
46
const char* field_name;
48
For string-type columns, this is the maximum number of
49
characters. For numeric data this can be NULL.
54
For decimal columns, this is the maximum number of
55
digits after the decimal. For other data this can be NULL.
57
char* field_decimal_length;
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.
63
enum enum_field_types field_type;
66
This is the charater set for non numeric data types including blob data.
69
const CHARSET_INFO *field_charset;
71
CHARSET_INFO *field_charset;
73
uint field_flags; // Field atributes(maybe_null, signed, unsigned etc.)
77
typedef struct dt_key_info
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.
84
static DT_FIELD_INFO t_info[]=
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}
90
typedef struct internal_table_info {
95
} INTERRNAL_TABLE_INFO;
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);
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);