~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
                opt_complete_insert= 0, opt_drop_database= 0,
84
84
                opt_replace_into= 0,
85
85
                opt_routines=0,
86
 
                opt_slave_apply= 0, 
 
86
                opt_slave_apply= 0,
87
87
                opt_include_master_host_port= 0,
88
88
                opt_events= 0,
89
89
                opt_alltspcs=0, opt_notspcs= 0;
296
296
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
297
297
  {"include-master-host-port", OPT_DRIZZLEDUMP_INCLUDE_MASTER_HOST_PORT,
298
298
   "Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE MASTER TO..' in dump produced with --dump-slave.",
299
 
   (char**) &opt_include_master_host_port, 
300
 
   (char**) &opt_include_master_host_port, 
 
299
   (char**) &opt_include_master_host_port,
 
300
   (char**) &opt_include_master_host_port,
301
301
   0, GET_BOOL, NO_ARG,
302
302
   0, 0, 0, 0, 0, 0},
303
303
  {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
522
522
  {
523
523
    fputs("<?xml version=\"1.0\"?>\n", sql_file);
524
524
    /*
525
 
      Schema reference.  Allows use of xsi:nil for NULL values and 
 
525
      Schema reference.  Allows use of xsi:nil for NULL values and
526
526
      xsi:type to define an element's data type.
527
527
    */
528
528
    fputs("<drizzledump ", sql_file);
864
864
    error_num   - process return value
865
865
    fmt_reason  - a format string for use by vsnprintf.
866
866
    ...         - variable arguments for above fmt_reason string
867
 
  
 
867
 
868
868
  DESCRIPTION
869
869
    This call prints out the formatted error message to stderr and then
870
870
    terminates the process.
893
893
    error_num   - process return value
894
894
    fmt_reason  - a format string for use by vsnprintf.
895
895
    ...         - variable arguments for above fmt_reason string
896
 
  
 
896
 
897
897
  DESCRIPTION
898
898
    This call prints out the formatted error message to stderr and then
899
899
    terminates the process, unless the --force command line option is used.
900
 
    
 
900
 
901
901
    This call should be used for non-fatal errors (such as database
902
902
    errors) that the code may still be able to continue to the next unit
903
903
    of work.
904
 
    
 
904
 
905
905
*/
906
906
static void maybe_die(int error_num, const char* fmt_reason, ...)
907
907
{
1210
1210
  Print xml tag. Optionally add attribute(s).
1211
1211
 
1212
1212
  SYNOPSIS
1213
 
    print_xml_tag(xml_file, sbeg, send, tag_name, first_attribute_name, 
 
1213
    print_xml_tag(xml_file, sbeg, send, tag_name, first_attribute_name,
1214
1214
                    ..., attribute_name_n, attribute_value_n, NULL)
1215
1215
    xml_file              - output file
1216
1216
    sbeg                  - line beginning
1225
1225
    Print XML tag with any number of attribute="value" pairs to the xml_file.
1226
1226
 
1227
1227
    Format is:
1228
 
      sbeg<tag_name first_attribute_name="first_attribute_value" ... 
 
1228
      sbeg<tag_name first_attribute_name="first_attribute_value" ...
1229
1229
      attribute_name_n="attribute_value_n">send
1230
1230
  NOTE
1231
1231
    Additional arguments must be present in attribute/value pairs.
1235
1235
*/
1236
1236
 
1237
1237
static void print_xml_tag(FILE * xml_file, const char* sbeg,
1238
 
                          const char* line_end, 
1239
 
                          const char* tag_name, 
 
1238
                          const char* line_end,
 
1239
                          const char* tag_name,
1240
1240
                          const char* first_attribute_name, ...)
1241
1241
{
1242
1242
  va_list arg_list;
1244
1244
 
1245
1245
  fputs(sbeg, xml_file);
1246
1246
  fputc('<', xml_file);
1247
 
  fputs(tag_name, xml_file);  
 
1247
  fputs(tag_name, xml_file);
1248
1248
 
1249
1249
  va_start(arg_list, first_attribute_name);
1250
1250
  attribute_name= first_attribute_name;
1254
1254
    assert(attribute_value != NULL);
1255
1255
 
1256
1256
    fputc(' ', xml_file);
1257
 
    fputs(attribute_name, xml_file);    
 
1257
    fputs(attribute_name, xml_file);
1258
1258
    fputc('\"', xml_file);
1259
 
    
 
1259
 
1260
1260
    print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
1261
1261
    fputc('\"', xml_file);
1262
1262
 
1559
1559
            fprintf(sql_file, ",\n  %s %s",
1560
1560
                    quote_name(row[0], name_buff, 0), row[1]);
1561
1561
          }
1562
 
          fprintf(sql_file, "\n) */;\n"); 
 
1562
          fprintf(sql_file, "\n) */;\n");
1563
1563
          check_io(sql_file);
1564
1564
        }
1565
1565
 
1657
1657
      if (!opt_xml)
1658
1658
        fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
1659
1659
      else
1660
 
        print_xml_tag(sql_file, "\t", "\n", "table_structure", "name=", table, 
 
1660
        print_xml_tag(sql_file, "\t", "\n", "table_structure", "name=", table,
1661
1661
                NULL);
1662
1662
      check_io(sql_file);
1663
1663
    }
1878
1878
  }
1879
1879
 
1880
1880
  str.append(option);
1881
 
  
 
1881
 
1882
1882
  if (strncmp(option_value, "0x", sizeof("0x")-1) == 0)
1883
1883
  {
1884
1884
    /* It's a hex constant, don't escape */
1901
1901
 
1902
1902
static void field_escape(string &in, const char *from)
1903
1903
{
1904
 
  uint end_backslashes= 0; 
 
1904
  uint end_backslashes= 0;
1905
1905
 
1906
1906
  in.append("'");
1907
1907
 
2028
2028
      Convert the path to native os format
2029
2029
      and resolve to the full filepath.
2030
2030
    */
2031
 
    convert_dirname(tmp_path,path,NULL);    
 
2031
    convert_dirname(tmp_path,path,NULL);
2032
2032
    my_load_path(tmp_path, tmp_path, NULL);
2033
2033
    fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
2034
2034
 
2046
2046
 
2047
2047
    if (fields_terminated || enclosed || opt_enclosed || escaped)
2048
2048
      query_string.append( " FIELDS");
2049
 
    
 
2049
 
2050
2050
    add_load_option(query_string, " TERMINATED BY ", fields_terminated);
2051
2051
    add_load_option(query_string, " ENCLOSED BY ", enclosed);
2052
2052
    add_load_option(query_string, " OPTIONALLY ENCLOSED BY ", opt_enclosed);
2082
2082
              result_table);
2083
2083
      check_io(md_result_file);
2084
2084
    }
2085
 
    
 
2085
 
2086
2086
    query_string.append( "SELECT * FROM ");
2087
2087
    query_string.append( result_table);
2088
2088
 
2093
2093
        fprintf(md_result_file, "-- WHERE:  %s\n", where);
2094
2094
        check_io(md_result_file);
2095
2095
      }
2096
 
      
 
2096
 
2097
2097
      query_string.append( " WHERE ");
2098
2098
      query_string.append( where);
2099
2099
    }
2282
2282
                }
2283
2283
                else
2284
2284
                {
2285
 
                  print_xml_tag(md_result_file, "\t\t", "", "field", "name=", 
 
2285
                  print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
2286
2286
                                field->name, NULL);
2287
2287
                  print_quoted_xml(md_result_file, row[i], length);
2288
2288
                }