~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/cache.h

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Brian Aker
5
 
 *  Copyright (C) 2010 Sun Microsystems, Inc.
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  (at your option) any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
 
22
 
#ifndef DRIZZLED_TABLE_CACHE_H
23
 
#define DRIZZLED_TABLE_CACHE_H
24
 
 
25
 
#include <boost/unordered_map.hpp>
26
 
#include <drizzled/identifier.h>
27
 
 
28
 
namespace drizzled {
29
 
 
30
 
class Session;
31
 
 
32
 
namespace table {
33
 
 
34
 
namespace instance {
35
 
class Shared;
36
 
37
 
 
38
 
class Concurrent;
39
 
 
40
 
typedef boost::unordered_multimap< identifier::Table::Key, Concurrent *> CacheMap;
41
 
typedef std::pair< CacheMap::const_iterator, CacheMap::const_iterator > CacheRange;
42
 
 
43
 
class Cache 
44
 
{
45
 
  CacheMap cache;
46
 
 
47
 
public:
48
 
  static inline Cache &singleton()
49
 
  {
50
 
    static Cache open_cache;
51
 
 
52
 
    return open_cache;
53
 
  }
54
 
 
55
 
  CacheMap &getCache()
56
 
  {
57
 
    return cache;
58
 
  }
59
 
 
60
 
  void rehash(size_t arg)
61
 
  {
62
 
    cache.rehash(arg);
63
 
  }
64
 
 
65
 
  bool areTablesUsed(Table *table, bool wait_for_name_lock);
66
 
  void removeSchema(const identifier::Schema &schema_identifier);
67
 
  bool removeTable(Session *session, identifier::Table &identifier, uint32_t flags);
68
 
  void release(table::instance::Shared *share);
69
 
  bool insert(table::Concurrent *arg);
70
 
 
71
 
  boost::mutex &mutex()
72
 
  {
73
 
    return _mutex;
74
 
  }
75
 
 
76
 
private:
77
 
  boost::mutex _mutex;
78
 
};
79
 
 
80
 
CacheMap &getCache(void);
81
 
void remove_table(table::Concurrent *arg);
82
 
 
83
 
} /* namepsace table */
84
 
} /* namepsace drizzled */
85
 
 
86
 
#endif /* DRIZZLED_TABLE_CACHE_H */