~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

  • Committer: Andrew Hutchings
  • Date: 2010-09-24 13:38:21 UTC
  • mto: (1792.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1793.
  • Revision ID: andrew@linuxjedi.co.uk-20100924133821-jzesmb013qy3525m
Fix error handling
Make work with dtr drizzledump test case

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
 
155
155
boost::unordered_set<string> ignore_table;
156
156
 
157
 
static void maybe_exit(int error);
 
157
void maybe_exit(int error);
158
158
static void die(int error, const char* reason, ...);
159
159
static void write_header(char *db_name);
160
160
static int dump_selected_tables(const string &db, const vector<string> &table_names);
170
170
  std::vector<DrizzleDumpDatabase*>::iterator i;
171
171
  for (i= database_store.begin(); i != database_store.end(); ++i)
172
172
  {
173
 
    (*i)->populateTables();
 
173
    if (not (*i)->populateTables())
 
174
      maybe_exit(EX_DRIZZLEERR);
174
175
  }
175
176
}
176
177
 
357
358
}
358
359
 
359
360
 
360
 
static void maybe_exit(int error)
 
361
void maybe_exit(int error)
361
362
{
362
363
  if (!first_error)
363
364
    first_error= error;
432
433
  else
433
434
    database= new DrizzleDumpDatabaseDrizzle(db, db_connection);
434
435
 
435
 
  database->populateTables(table_names);
 
436
  if (not database->populateTables(table_names))
 
437
  {
 
438
    delete database;
 
439
    maybe_exit(EX_DRIZZLEERR);
 
440
  }
436
441
 
437
442
  database_store.push_back(database); 
438
443
 
549
554
  N_("Use REPLACE INTO instead of INSERT INTO."))
550
555
  ("result-file,r", po::value<string>(),
551
556
  N_("Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed)."))
552
 
  ("where,w", po::value<string>(&where)->default_value(""),
553
 
  N_("Dump only selected records; QUOTES mandatory!"))
554
557
  ("destination-type", po::value<string>()->default_value("stdout"),
555
558
  N_("Where to send output to (stdout|database"))
556
559
  ("destination-host", po::value<string>(&opt_destination_host)->default_value("localhost"),