~2591kuldeep/libdrizzle/libdrizzle-binlogapi

« back to all changes in this revision

Viewing changes to libdrizzle/binlogevent/xid_event.cc

  • Committer: kuldeep
  • Date: 2013-09-19 22:27:25 UTC
  • Revision ID: kuldeep@kuldeep-laptop-20130919222725-xsb4tlxp0tp3mm2t
Adding Tested code on local environment, now we can access the new api functions within library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
 * Copyright (C) 2013 Drizzle Developer Group
3
 
 * Copyright (C) 2013 Kuldeep Porwal
4
 
 * All rights reserved.
5
 
 *
6
 
 * Use and distribution licensed under the BSD license.  See
7
 
 * the COPYING file in the parent directory for full text.
8
 
 *
9
 
 * summary: parse xid event
10
 
 *
11
 
 */
12
 
#include<iostream>
13
 
#include <libdrizzle-5.1/libdrizzle.h>
14
 
#include <stdio.h>
15
 
#include <stdlib.h>
16
 
#include <errno.h>
17
 
#include <inttypes.h>
18
 
#include<string.h>
19
 
 
20
 
#include"xid_event.h"
21
 
 
22
 
 
23
 
#ifndef HELPER
24
 
#define HELPER
25
 
 
26
 
#include"helper.h"
27
 
 
28
 
#endif
29
 
 
30
 
using namespace std;
31
 
using namespace binlogevent;
32
 
 
33
 
 
34
 
 
35
 
void XidEvent::initWithData(const unsigned char* data)
36
 
{
37
 
 
38
 
        int start_pos = header.setHeader(data);
39
 
        if(start_pos==-1)
40
 
                return;
41
 
        uint64_t tmp;
42
 
 
43
 
        tmp=getByte8(start_pos,data);
44
 
        if(tmp==UINT_MAX)
45
 
                return;
46
 
        setXid((uint64_t)tmp);
47
 
}
48
 
 
49
 
// getters
50
 
 
51
 
uint32_t XidEvent::getTimestamp()
52
 
{
53
 
        return  header.timestamp;
54
 
}
55
 
enum_event_type XidEvent::getType()
56
 
{
57
 
        return (enum_event_type)header.type; 
58
 
}
59
 
uint32_t XidEvent::getServerId()
60
 
{
61
 
        return header.server_id;
62
 
}
63
 
uint32_t XidEvent::getLogPos()
64
 
{
65
 
        return header.log_pos;
66
 
}
67
 
uint16_t XidEvent::getFlagH()
68
 
{
69
 
        return header.flag; 
70
 
}
71
 
uint64_t XidEvent::getXid()
72
 
{
73
 
        return Xid;
74
 
}
75
 
 
76
 
//setters
77
 
 
78
 
void XidEvent::setXid(uint64_t value)
79
 
{
80
 
        Xid = value;
81
 
}