~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to drizzled/message/binlog_reader.cc

  • Committer: Jay Pipes
  • Date: 2009-08-03 14:23:22 UTC
  • mfrom: (1039.2.68 staging)
  • mto: This revision was merged to the branch mainline in revision 1078.
  • Revision ID: jpipes@serialcoder-20090803142322-1g67h7su9mocg9ig
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
#include <sys/stat.h>
15
15
 
16
 
using namespace google::protobuf;
17
 
using namespace google::protobuf::io;
 
16
using namespace std;
 
17
using namespace google;
18
18
 
19
19
static void print_usage_and_exit(char *prog) {
20
 
  using std::cerr;
21
20
  const char *name= strrchr(prog, '/');
22
21
 
23
22
  if (name)
26
25
    name= "binlog_reader";
27
26
  cerr << "Usage: " << name << " <options>\n"
28
27
       << "    --input name   Read queries from file <name> (default: 'log.bin')\n"
29
 
       << std::flush;
 
28
       << flush;
30
29
  exit(1);
31
30
}
32
31
 
34
33
int
35
34
main(int argc, char *argv[])
36
35
{
37
 
  using std::ios;
38
36
 
39
37
  static struct option options[] = {
40
38
    { "input",     1 /* has_arg */, NULL, 0 },
61
59
 
62
60
  filebuf fb;
63
61
 
64
 
  fb.open(file_name, std::ios::in);
 
62
  fb.open(file_name, ios::in);
65
63
  istream is(&fb);
66
64
 
67
 
  ZeroCopyInputStream* raw_input = new IstreamInputStream(&is);
68
 
  CodedInputStream *coded_input = new CodedInputStream(raw_input);
 
65
  protobuf::io::ZeroCopyInputStream* raw_input=
 
66
    new protobuf::io::IstreamInputStream(&is);
 
67
  protobuf::io::CodedInputStream *coded_input=
 
68
    new protobuf::io::CodedInputStream(raw_input);
69
69
 
70
70
  BinaryLog::Event event;
71
71
  while (event.read(coded_input))