~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

update to latest from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
                opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
84
84
                opt_complete_insert= 0, opt_drop_database= 0,
85
85
                opt_replace_into= 0,
86
 
                opt_routines=0, opt_tz_utc=1,
 
86
                opt_routines=0,
87
87
                opt_slave_apply= 0, 
88
88
                opt_include_master_host_port= 0,
89
89
                opt_events= 0,
379
379
  {"routines", 'R', "Dump stored routines (functions and procedures).",
380
380
     (char**) &opt_routines, (char**) &opt_routines, 0, GET_BOOL,
381
381
     NO_ARG, 0, 0, 0, 0, 0, 0},
382
 
  {"set-charset", OPT_SET_CHARSET,
383
 
   "Add 'SET NAMES default_character_set' to the output.",
384
 
   (char**) &opt_set_charset, (char**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
385
 
   0, 0, 0, 0, 0},
386
382
  {"set-variable", 'O',
387
383
   "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
388
384
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
414
410
   (char**) &path, (char**) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
415
411
  {"tables", OPT_TABLES, "Overrides option --databases (-B).",
416
412
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
417
 
  {"tz-utc", OPT_TZ_UTC,
418
 
    "SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
419
 
    (char**) &opt_tz_utc, (char**) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
420
413
#ifndef DONT_ALLOW_USER_CHANGE
421
414
  {"user", 'u', "User for login if not current user.",
422
415
   (char**) &current_user, (char**) &current_user, 0, GET_STR, REQUIRED_ARG,
560
553
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
561
554
"\n/*!40101 SET NAMES %s */;\n",default_charset);
562
555
 
563
 
    if (opt_tz_utc)
564
 
    {
565
 
      fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
566
 
      fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n");
567
 
    }
568
 
 
569
556
    if (!path)
570
557
    {
571
558
      fprintf(md_result_file,"\
587
574
  }
588
575
  else if (!opt_compact)
589
576
  {
590
 
    if (opt_tz_utc)
591
 
      fprintf(sql_file,"/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n");
592
 
 
593
577
    if (!path)
594
578
    {
595
579
      fprintf(md_result_file,"\
597
581
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
598
582
    }
599
583
    if (opt_set_charset)
600
 
      fprintf(sql_file,
601
 
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
602
 
    fprintf(sql_file,
603
 
            "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n");
604
 
    fputs("\n", sql_file);
 
584
      fprintf(sql_file, "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
605
585
    if (opt_comments)
606
586
    {
607
587
      if (opt_dump_date)
1055
1035
 
1056
1036
static int connect_to_db(char *host, char *user,char *passwd)
1057
1037
{
1058
 
  char buff[20+FN_REFLEN];
1059
 
 
1060
 
 
1061
1038
  verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
1062
1039
  drizzle_create(&drizzle_connection);
1063
1040
  if (opt_compress)
1069
1046
    DB_error(&drizzle_connection, "when trying to connect");
1070
1047
    return(1);
1071
1048
  }
1072
 
  if (drizzle_get_server_version(&drizzle_connection) < 40100)
1073
 
  {
1074
 
    /* Don't dump SET NAMES with a pre-4.1 server (bug#7997).  */
1075
 
    opt_set_charset= 0;
1076
1049
 
1077
 
    /* Don't switch charsets for 4.1 and earlier.  (bug#34192). */
1078
 
    server_supports_switching_charsets= false;
1079
 
  } 
1080
 
  /*
1081
 
    set time_zone to UTC to allow dumping date types between servers with
1082
 
    different time zone settings
1083
 
  */
1084
 
  if (opt_tz_utc)
1085
 
  {
1086
 
    snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
1087
 
    if (drizzle_query_with_error_report(drizzle, 0, buff))
1088
 
      return(1);
1089
 
  }
1090
1050
  return(0);
1091
1051
} /* connect_to_db */
1092
1052