~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/serialize/replication_event_writer.cc

  • Committer: Monty Taylor
  • Date: 2009-01-30 04:39:04 UTC
  • mto: (779.7.3 devel)
  • mto: This revision was merged to the branch mainline in revision 823.
  • Revision ID: mordred@inaugust.com-20090130043904-gphdonl7m6zdz06v
Cleaned up warnings up through innodb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#include <uuid/uuid.h>
9
9
 
10
10
#include <drizzled/serialize/replication_event.pb.h>
 
11
 
11
12
using namespace std;
 
13
using namespace drizzle;
12
14
 
13
15
static uint64_t query_id= 0;
14
16
char transaction_id[37];
17
19
  Example script for reader a Drizzle master replication list.
18
20
*/
19
21
 
20
 
void write_ddl(drizzle::Event *record, const char *sql)
 
22
void write_ddl(::drizzle::Event *record, const char *sql)
21
23
{
22
24
  uuid_t uu;
23
25
 
24
26
  uuid_generate_time(uu);
25
27
  uuid_unparse(uu, transaction_id);
26
28
 
27
 
  using namespace drizzle;
28
29
  record->set_type(Event::DDL);
29
30
  record->set_autocommit(true);
30
31
  record->set_server_id("localhost");
34
35
  record->set_sql(sql);
35
36
}
36
37
 
37
 
void write_insert(drizzle::Event *record, const char *trx)
 
38
void write_insert(::drizzle::Event *record, const char *trx)
38
39
{
39
 
  using namespace drizzle;
40
40
  Event::Value *value;
41
41
 
42
42
  record->set_type(Event::INSERT);
60
60
  value->add_value("2");
61
61
}
62
62
 
63
 
void write_delete(drizzle::Event *record, const char *trx)
 
63
void write_delete(::drizzle::Event *record, const char *trx)
64
64
{
65
 
  using namespace drizzle;
66
65
  Event::Value *value;
67
66
 
68
67
  record->set_type(Event::DELETE);
83
82
  value->add_value("2");
84
83
}
85
84
 
86
 
void write_update(drizzle::Event *record, const char *trx)
 
85
void write_update(::drizzle::Event *record, const char *trx)
87
86
{
88
 
  using namespace drizzle;
89
87
  Event::Value *value;
90
88
 
91
89
  record->set_type(Event::UPDATE);
112
110
  value->add_value("6");
113
111
}
114
112
 
115
 
void write_to_disk(int file, drizzle::EventList *list)
 
113
void write_to_disk(int file, ::drizzle::EventList *list)
116
114
{
117
115
  std::string buffer;
118
 
  uint64_t length;
 
116
  size_t length;
119
117
  size_t written;
120
118
 
121
119
  list->SerializePartialToString(&buffer);
155
153
   exit(0);
156
154
  }
157
155
 
158
 
  drizzle::EventList list;
 
156
  EventList list;
159
157
 
160
158
  /* Write first set of records */
161
159
  write_ddl(list.add_event(), "CREATE TABLE A (a int) ENGINE=innodb");