~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.h

  • Committer: lbieber at stabletransit
  • Date: 2010-10-15 22:03:32 UTC
  • mfrom: (1856.1.5 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101015220332-yzt1trfuff2gxkwv
Merge Andrew - Bug #654269: drizzledump doesn't handle foriegn keys 
Merge Andrew - Bug #659103: drizzledump could grab the wrong indexes
Merge Barry - Fixed memory leak in event observer plugin.
Merge Lee - Fix test output for haildb test, instead of No database selected, the message is now No schema selected

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
class DrizzleDumpDatabase;
34
34
class DrizzleDumpData;
35
35
 
 
36
class DrizzleDumpForeignKey
 
37
{
 
38
  public:
 
39
    DrizzleDumpConnection *dcon;
 
40
    std::string constraintName;
 
41
 
 
42
    DrizzleDumpForeignKey(std::string name, DrizzleDumpConnection* connection) :
 
43
      dcon(connection),
 
44
      constraintName(name)
 
45
    { }
 
46
 
 
47
    virtual ~DrizzleDumpForeignKey() { }
 
48
 
 
49
    std::string parentColumns;
 
50
    std::string childColumns;
 
51
    std::string childTable;
 
52
    std::string matchOption;
 
53
    std::string deleteRule;
 
54
    std::string updateRule;
 
55
 
 
56
    friend std::ostream& operator <<(std::ostream &os, const DrizzleDumpForeignKey &obj);
 
57
};
 
58
 
36
59
class DrizzleDumpIndex
37
60
{
38
61
  public:
107
130
 
108
131
    virtual bool populateFields() { return false; }
109
132
    virtual bool populateIndexes() { return false; }
 
133
    virtual bool populateFkeys() { return false; }
110
134
    virtual DrizzleDumpData* getData() { return NULL; }
111
135
    std::vector<DrizzleDumpField*> fields;
112
136
    std::vector<DrizzleDumpIndex*> indexes;
 
137
    std::vector<DrizzleDumpForeignKey*> fkeys;
113
138
 
114
139
    friend std::ostream& operator <<(std::ostream &os, const DrizzleDumpTable &obj);
115
140
    std::string tableName;
226
251
 
227
252
    void writeString(std::string &str)
228
253
    {
229
 
      connection->queryNoResult(str);
 
254
      if (not connection->queryNoResult(str))
 
255
        throw 1;
230
256
    }
231
257
 
232
258
    void setConnection(DrizzleDumpConnection *conn) { connection= conn; }
255
281
 
256
282
    int sync()
257
283
    {
258
 
        size_t len = size_t(pptr() - pbase());
259
 
        std::string temp(pbase(), len);
260
 
 
261
 
        /* Drop newlines */
262
 
        temp.erase(std::remove(temp.begin(), temp.end(), '\n'), temp.end());
263
 
 
264
 
        if (temp.compare(0, 2, "--") == 0)
265
 
        {
266
 
          /* Drop comments */
267
 
          setp(pbase(), epptr());
268
 
        }
269
 
        if (temp.find(";") != std::string::npos)
270
 
        {
271
 
            writeString(temp);
272
 
            setp(pbase(), epptr());
273
 
        }
274
 
        return 0;
 
284
      size_t len = size_t(pptr() - pbase());
 
285
      std::string temp(pbase(), len);
 
286
 
 
287
      /* Drop newlines */
 
288
      temp.erase(std::remove(temp.begin(), temp.end(), '\n'), temp.end());
 
289
 
 
290
      if (temp.compare(0, 2, "--") == 0)
 
291
      {
 
292
        /* Drop comments */
 
293
        setp(pbase(), epptr());
 
294
      }
 
295
      if (temp.find(";") != std::string::npos)
 
296
      {
 
297
        writeString(temp);
 
298
        setp(pbase(), epptr());
 
299
      }
 
300
      return 0;
275
301
    }
276
302
};
277
303