~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzletest.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
#define MTEST_VERSION "3.3"
40
40
 
41
 
#include <config.h>
42
 
#include "client_priv.h"
 
41
#include "config.h"
43
42
 
44
43
#include <queue>
45
44
#include <map>
46
45
#include <string>
47
 
#include <vector>
48
46
 
49
47
#include <pcrecpp.h>
50
48
 
 
49
#include "client_priv.h"
51
50
#include <mysys/hash.h>
52
51
#include <stdarg.h>
53
52
 
228
227
  Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
229
228
  Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_SORTED_RESULT,
230
229
  Q_START_TIMER, Q_END_TIMER,
231
 
  Q_CHARACTER_SET,
 
230
  Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
232
231
  Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
233
232
  Q_IF,
234
233
  Q_DISABLE_PARSING, Q_ENABLE_PARSING,
534
533
      str->append(quote_str, quote_len);
535
534
      cur_pos= next_pos + 1;
536
535
    }
537
 
    str->append(cur_pos);
 
536
    str->append(cur_pos, next_pos - cur_pos);
538
537
    append= va_arg(dirty_text, char *);
539
538
  }
540
539
  va_end(dirty_text);
1157
1156
  string ds_cmdline;
1158
1157
 
1159
1158
 
1160
 
  append_os_quoted(&ds_cmdline, tool_path, NULL);
 
1159
  append_os_quoted(&ds_cmdline, tool_path);
1161
1160
  ds_cmdline.append(" ");
1162
1161
 
1163
1162
  va_start(args, result);
1375
1374
  char temp_file_path[FN_REFLEN];
1376
1375
 
1377
1376
  if ((fd= create_temp_file(temp_file_path, NULL,
1378
 
                            "tmp", O_CREAT | O_RDWR,
 
1377
                            "tmp", O_CREAT | O_SHARE | O_RDWR,
1379
1378
                            MYF(MY_WME))) < 0)
1380
1379
    die("Failed to create temporary file for ds");
1381
1380
 
1455
1454
    ds->erase(); /* Don't create a .log file */
1456
1455
 
1457
1456
    show_diff(NULL, result_file_name, reject_file);
1458
 
    die("%s",mess);
 
1457
    die(mess);
1459
1458
    break;
1460
1459
  }
1461
1460
  default: /* impossible */
2042
2041
  if (cur_file == file_stack_end)
2043
2042
    die("Source directives are nesting too deep");
2044
2043
  cur_file++;
2045
 
  if (!(cur_file->file = my_fopen(buff, O_RDONLY, MYF(0))))
 
2044
  if (!(cur_file->file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
2046
2045
  {
2047
2046
    cur_file--;
2048
2047
    die("Could not open '%s' for reading", buff);
2898
2897
 
2899
2898
  /* Create temporary file name */
2900
2899
  if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"),
2901
 
                            "tmp", O_CREAT | O_RDWR,
 
2900
                            "tmp", O_CREAT | O_SHARE | O_RDWR,
2902
2901
                            MYF(MY_WME))) < 0)
2903
2902
    die("Failed to create temporary file for perl command");
2904
2903
  my_close(fd, MYF(0));
4534
4533
    embedded_server_arg_count=1;
4535
4534
    embedded_server_args[0]= (char*) "";    /* Progname */
4536
4535
  }
4537
 
  if (!(file=my_fopen(buff, O_RDONLY, MYF(MY_WME))))
 
4536
  if (!(file=my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
4538
4537
    die("Failed to open file '%s'", buff);
4539
4538
 
4540
4539
  while (embedded_server_arg_count < MAX_EMBEDDED_SERVER_ARGS &&
4577
4576
    fn_format(buff, argument, "", "", MY_UNPACK_FILENAME);
4578
4577
    assert(cur_file == file_stack && cur_file->file == 0);
4579
4578
    if (!(cur_file->file=
4580
 
          my_fopen(buff, O_RDONLY, MYF(0))))
 
4579
          my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
4581
4580
      die("Could not open '%s' for reading: errno = %d", buff, errno);
4582
4581
    cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
4583
4582
    cur_file->lineno= 1;
6358
6357
 
6359
6358
 
6360
6359
/*
 
6360
  auxiluary macro used by reg_replace
 
6361
  makes sure the result buffer has sufficient length
 
6362
*/
 
6363
#define SECURE_REG_BUF   if (buf_len < need_buf_len)                    \
 
6364
  {                                                                     \
 
6365
    int off= res_p - buf;                                               \
 
6366
    buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE));        \
 
6367
    res_p= buf + off;                                                   \
 
6368
    buf_len= need_buf_len;                                              \
 
6369
  }                                                                     \
 
6370
                                                                        \
 
6371
/*
6361
6372
  Performs a regex substitution
6362
6373
 
6363
6374
  IN:
6390
6401
    return 1;
6391
6402
  }
6392
6403
  strcpy(new_buf, new_str);
6393
 
  *buf_p= new_buf;
 
6404
  buf_p= &new_buf;
6394
6405
 
6395
6406
  return 0;
6396
6407
}
7090
7101
 
7091
7102
void append_sorted(string* ds, string *ds_input)
7092
7103
{
7093
 
  priority_queue<string, vector<string>, greater<string> > lines;
 
7104
  priority_queue<string> lines;
7094
7105
 
7095
7106
  if (ds_input->empty())
7096
7107
    return;  /* No input */
7101
7112
  if (eol_pos == string::npos)
7102
7113
    return; // We should have at least one header here
7103
7114
 
7104
 
  ds->append(ds_input->substr(0, eol_pos+1));
 
7115
  ds->append(ds_input->substr(0, eol_pos));
7105
7116
 
7106
7117
  unsigned long start_pos= eol_pos+1;
7107
7118
 
7110
7121
 
7111
7122
    eol_pos= ds_input->find_first_of('\n', start_pos);
7112
7123
    /* Find end of line */
7113
 
    lines.push(ds_input->substr(start_pos, eol_pos-start_pos+1));
 
7124
    lines.push(ds_input->substr(start_pos, eol_pos-start_pos));
7114
7125
    start_pos= eol_pos+1;
7115
7126
 
7116
7127
  } while ( eol_pos != string::npos);