~drizzle-trunk/drizzle/development

1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2010 Andrew Hutchings
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
2371.1.1 by Brian Aker
Fedora fix/use fwd header for iostream.
20
#pragma once
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
21
22
#include "drizzledump_data.h"
23
24
class DrizzleDumpDatabaseMySQL;
25
class DrizzleDumpDataMySQL;
26
27
class DrizzleDumpIndexMySQL : public DrizzleDumpIndex
28
{
29
  public:
1751.4.20 by Andrew Hutchings
Add database connection class and the start of a database output ostream
30
    DrizzleDumpIndexMySQL(std::string &index, DrizzleDumpConnection *connection)
31
    : DrizzleDumpIndex(index, connection)
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
32
    { }
33
34
    ~DrizzleDumpIndexMySQL()
35
    {
36
      columns.clear();
37
    }
38
39
};
40
41
class DrizzleDumpFieldMySQL : public DrizzleDumpField
42
{
43
  public:
1751.4.20 by Andrew Hutchings
Add database connection class and the start of a database output ostream
44
    DrizzleDumpFieldMySQL(std::string &field, DrizzleDumpConnection *connection)
45
    : DrizzleDumpField(field, connection)
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
46
    { }
47
48
    ~DrizzleDumpFieldMySQL() { }
49
1836.1.1 by Andrew Hutchings
The MySQL date/time schema convert was not run when there was no default value
50
    void dateTimeConvert(void);
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
51
    void setCollate(const char* newCollate);
52
    void setType(const char* raw_type, const char* collation);
53
};
54
55
class DrizzleDumpTableMySQL : public DrizzleDumpTable
56
{
57
  public:
1751.4.20 by Andrew Hutchings
Add database connection class and the start of a database output ostream
58
    DrizzleDumpTableMySQL(std::string &table, DrizzleDumpConnection *connection)
59
    : DrizzleDumpTable(table, connection)
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
60
    { }
61
62
    ~DrizzleDumpTableMySQL()
63
    {
64
      fields.clear();
65
      indexes.clear();
66
    }
67
68
    bool populateFields();
69
    bool populateIndexes();
1810.6.6 by Andrew Hutchings
Add foriegn key support for MySQL
70
    bool populateFkeys();
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
71
    void setEngine(const char* newEngine);
72
    void setCollate(const char* newCollate);
73
    DrizzleDumpData* getData(void);
74
};
75
76
class DrizzleDumpDatabaseMySQL : public DrizzleDumpDatabase
77
{
78
  public:
1751.4.20 by Andrew Hutchings
Add database connection class and the start of a database output ostream
79
    DrizzleDumpDatabaseMySQL(const std::string &database,
80
      DrizzleDumpConnection *connection)
81
    : DrizzleDumpDatabase(database, connection)
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
82
    { }
83
    ~DrizzleDumpDatabaseMySQL()
84
    {
85
      tables.clear();
86
    }
1751.4.23 by Andrew Hutchings
Fix various bugs
87
    bool populateTables(void);
88
    bool populateTables(const std::vector<std::string> &table_names);
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
89
    void setCollate(const char* newCollate);
90
};
91
92
class DrizzleDumpDataMySQL : public DrizzleDumpData
93
{
94
  public:
1751.4.20 by Andrew Hutchings
Add database connection class and the start of a database output ostream
95
    DrizzleDumpDataMySQL(DrizzleDumpTable *dataTable,
96
      DrizzleDumpConnection *connection);
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
97
    ~DrizzleDumpDataMySQL();
98
99
    /* For 0000-00-00 -> NULL conversion */
100
    std::string convertDate(const char* oldDate) const;
101
    /* For xx:xx:xx -> INT conversion */
102
    long convertTime(const char* oldTime) const;
1802.11.1 by Andrew Hutchings
1. date regex was broken
103
    std::string checkDateTime(const char* item, uint32_t field) const;
1751.4.19 by Andrew Hutchings
Put drizzle and mysql processes in seperate classes/files
104
};