260
bool DrizzleDumpTableDrizzle::populateFkeys()
262
drizzle_result_st *result;
265
DrizzleDumpForeignKey *fkey;
268
std::cerr << _("-- Retrieving foreign keys for ") << tableName << "..." << std::endl;
270
query= "SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS, MATCH_OPTION, DELETE_RULE, UPDATE_RULE FROM DATA_DICTIONARY.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='";
271
query.append(database->databaseName);
272
query.append("' AND CONSTRAINT_TABLE='");
273
query.append(tableName);
276
result= dcon->query(query);
281
while ((row= drizzle_row_next(result)))
283
fkey= new DrizzleDumpForeignKey(row[0], dcon);
284
fkey->parentColumns= row[1];
285
fkey->childTable= row[2];
286
fkey->childColumns= row[3];
287
if (strcmp(row[4], "NONE") != 0)
288
fkey->matchOption= row[4];
290
fkey->matchOption= "";
292
if (strcmp(row[5], "UNDEFINED") != 0)
293
fkey->deleteRule= row[5];
295
fkey->deleteRule= "";
297
if (strcmp(row[6], "UNDEFINED") != 0)
298
fkey->updateRule= row[6];
300
fkey->updateRule= "";
302
fkeys.push_back(fkey);
304
dcon->freeResult(result);
259
308
DrizzleDumpData* DrizzleDumpTableDrizzle::getData(void)