~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.h

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#define DRIZZLE_MAX_LINE_LENGTH 1024*1024L-1025
24
24
#include "client_priv.h"
25
 
#include "server_detect.h"
26
25
#include <string>
27
26
#include <iostream>
28
27
#include <iomanip>
65
64
 
66
65
    DrizzleDumpIndex(std::string &index, DrizzleDumpConnection* connection) :
67
66
      dcon(connection),
68
 
      indexName(index),
69
 
      isPrimary(false),
70
 
      isUnique(false),
71
 
      isHash(false)
 
67
      indexName(index)
72
68
    { }
73
69
 
74
70
    virtual ~DrizzleDumpIndex() { }
87
83
  public:
88
84
    DrizzleDumpField(std::string &field, DrizzleDumpConnection* connection) :
89
85
      dcon(connection),
90
 
      fieldName(field),
91
 
      isNull(false),
92
 
      isUnsigned(false),
93
 
      isAutoIncrement(false),
94
 
      defaultIsNull(false),
95
 
      convertDateTime(false),
96
 
      rangeCheck(false)
 
86
      fieldName(field)
97
87
    { }
98
88
 
99
89
    virtual ~DrizzleDumpField() { }
111
101
    bool isAutoIncrement;
112
102
    bool defaultIsNull;
113
103
    bool convertDateTime;
114
 
    bool rangeCheck;
115
104
    std::string defaultValue;
116
105
    std::string collation;
117
 
    std::string comment;
118
106
 
119
107
    /* For enum type */
120
108
    std::string enumValues;
132
120
  public:
133
121
    DrizzleDumpTable(std::string &table, DrizzleDumpConnection* connection) :
134
122
      dcon(connection),
135
 
      tableName(table),
136
 
      database(NULL)
 
123
      tableName(table)
137
124
    { }
138
125
 
139
126
    virtual ~DrizzleDumpTable() { }
196
183
    drizzle_result_st *result;
197
184
    DrizzleDumpData(DrizzleDumpTable *dataTable, DrizzleDumpConnection *connection) :
198
185
      dcon(connection),
199
 
      table(dataTable),
200
 
      result(NULL)
 
186
      table(dataTable)
201
187
    { }
202
188
 
203
189
    virtual ~DrizzleDumpData() { }
215
201
    drizzle_con_st connection;
216
202
    std::string hostName;
217
203
    bool drizzleProtocol;
218
 
    ServerDetect::server_type serverType;
219
 
    std::string serverVersion;
 
204
    int serverType;
220
205
 
221
206
  public:
 
207
    enum server_type {
 
208
      SERVER_MYSQL_FOUND,
 
209
      SERVER_DRIZZLE_FOUND,
 
210
      SERVER_UNKNOWN_FOUND
 
211
    };
222
212
    DrizzleDumpConnection(std::string &host, uint16_t port,
223
213
      std::string &username, std::string &password, bool drizzle_protocol);
224
214
    ~DrizzleDumpConnection();
239
229
 
240
230
    void freeResult(drizzle_result_st* result);
241
231
    bool setDB(std::string databaseName);
242
 
    bool usingDrizzleProtocol(void) const { return drizzleProtocol; }
243
 
    bool getServerType(void) const { return serverType; }
244
 
    std::string getServerVersion(void) const { return serverVersion; }
 
232
    bool usingDrizzleProtocol(void) { return drizzleProtocol; }
 
233
    bool getServerType(void) { return serverType; }
 
234
    const char* getServerVersion(void) { return drizzle_con_server_version(&connection); }
245
235
};
246
236
 
247
237
class DrizzleStringBuf : public std::streambuf
262
252
    void writeString(std::string &str)
263
253
    {
264
254
      if (not connection->queryNoResult(str))
265
 
        throw std::exception();
 
255
        throw 1;
266
256
    }
267
257
 
268
258
    void setConnection(DrizzleDumpConnection *conn) { connection= conn; }