~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_export.h

* Fixes drizzled's atomics:

- fetch_and_add() was actually add_and_fetch() - fixed to have both methods correct
- compare_and_swap() was incorrect for all traits classes.  Fixed to return a bool
true only when the supplied value is actually swapped
- fixes increment() and decrement() methods and operator+=() in outer atomics class
template to call proper add_and_fetch() methods on traits classes
- Now that above are fixed, removed the hacks in Query_id and TransactionLog to
have query ID and the new transactoin ID start properly at 1.

* Transaction messages sent over replication stream now use
a real transaction ID, managed by drizzled::TransactionServices.  Previously, 
the Query_id was being used, resulting in SELECT statements incrementing the
transaction ID.

* Added a test case to ensure that DDL ops are given a transaction ID and SELECT
ops do not increment the transaction ID.

The transaction ID will be paired with a channel ID to become the global
transaction identifier.  ReplicationServices will manage the pairing of
channel and transaction ID and understand how far a particular subscriber
node has applied.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
#ifndef DRIZZLED_SELECT_EXPORT_H
22
22
#define DRIZZLED_SELECT_EXPORT_H
23
23
 
24
 
#include <drizzled/select_to_file.h>
25
 
 
26
24
/*
27
25
 List of all possible characters of a numeric value text representation.
28
26
*/
31
29
namespace drizzled
32
30
{
33
31
 
34
 
class select_export :
35
 
  public select_to_file
36
 
{
 
32
class select_export :public select_to_file {
37
33
  uint32_t field_term_length;
38
34
  int field_sep_char,escape_char,line_sep_char;
39
35
  int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT
57
53
  bool is_unsafe_field_sep;
58
54
  bool fixed_row_size;
59
55
public:
60
 
  select_export(file_exchange *ex) :
61
 
    select_to_file(ex),
62
 
    field_term_length(0),
63
 
    field_sep_char(0),
64
 
    escape_char(0),
65
 
    line_sep_char(0),
66
 
    field_term_char(0),
67
 
    is_ambiguous_field_sep(0),
68
 
    is_ambiguous_field_term(0),
69
 
    is_unsafe_field_sep(0),
70
 
    fixed_row_size(0)
71
 
  {}
 
56
  select_export(file_exchange *ex) :select_to_file(ex) {}
72
57
  ~select_export();
73
58
  int prepare(List<Item> &list, Select_Lex_Unit *u);
74
59
  bool send_data(List<Item> &items);
75
 
private:
76
 
  inline bool needs_escaping(char character, bool enclosed)
77
 
  {
78
 
    if ((character == escape_char) ||
79
 
        (enclosed ? character == field_sep_char : character == field_term_char) ||
80
 
        character == line_sep_char  ||
81
 
        (character == 0))
82
 
      return true;
83
 
 
84
 
    return false;
85
 
 
86
 
  }
87
60
};
88
61
 
89
62
} /* namespace drizzled */