~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.h

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • mto: (1711.1.21 build) (1725.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: prafulla_t@users.sourceforge.net-20100806112112-7w5u0s3nx9u67nzt
Fix for Bug 586051

1. test_if_ref method which checks whether predicate is already evaluated
   due to ref/eq_ref access or not was incorrectly removing a predicate 
   that was not implicitly evaluated due to ref access (due to presence of filesort ?)
   It was field=NULL predicate.
   Such predicate should be kept and execution engine will filter out rows
   correctly. Removal of such predicate led to returning of rows which had
   NULL for join/predicate columns.
2. field COMP_OP NULL will always false for all fields except when COMP_OP
   is NULL-safe equality operator. Modified range optimizer to return zero
   row count in such cases.
   Query now does not even run. It returns zero result. As such Fix(1) is not
   required but we might hit that case in some other query (I have not tried it
   yet)
3. Fixed Field::val_str to print "NULL" for literal NULL instead of "0". It
   added lot of confusion while debugging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <assert.h>
25
25
#include <drizzled/plugin/storage_engine.h>
 
26
#include <drizzled/data_home.h>
26
27
#include <boost/unordered_map.hpp>
27
 
#include <boost/thread/shared_mutex.hpp>
 
28
 
 
29
#include <pthread.h>
28
30
 
29
31
extern const drizzled::CHARSET_INFO *default_charset_info;
30
32
 
35
37
class Schema : public drizzled::plugin::StorageEngine
36
38
{
37
39
  bool writeSchemaFile(const drizzled::SchemaIdentifier &schema_identifier, const drizzled::message::Schema &db);
38
 
  bool readSchemaFile(const drizzled::SchemaIdentifier &schema_identifier, drizzled::message::Schema &schema);
 
40
  bool readSchemaFile(const std::string &schema_file_name, drizzled::message::Schema &schema);
39
41
 
40
42
  void prime();
41
43
 
42
 
  typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
 
44
  typedef boost::unordered_map<std::string, drizzled::message::Schema> SchemaCache;
43
45
  SchemaCache schema_cache;
44
46
  bool schema_cache_filled;
45
47
 
46
 
  boost::shared_mutex mutex;
 
48
  pthread_rwlock_t schema_lock;
47
49
 
48
50
public:
49
51
  Schema();
51
53
  ~Schema();
52
54
 
53
55
 
54
 
  drizzled::Cursor *create(drizzled::Table &)
 
56
  bool doCanCreateTable(const drizzled::TableIdentifier &identifier);
 
57
 
 
58
  drizzled::Cursor *create(drizzled::TableShare &)
55
59
  {
56
60
    return NULL;
57
61
  }
58
62
 
59
 
  void doGetSchemaIdentifiers(drizzled::SchemaIdentifier::vector &set_of_names);
60
 
  bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::schema::shared_ptr &proto);
 
63
  void doGetSchemaIdentifiers(drizzled::SchemaIdentifiers &set_of_names);
 
64
  bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::Schema &proto);
61
65
 
62
66
  bool doCreateSchema(const drizzled::message::Schema &schema_message);
63
67
 
74
78
    return ENOENT;
75
79
  }
76
80
 
 
81
 
 
82
  void doGetTableNames(drizzled::CachedDirectory&,
 
83
                       const drizzled::SchemaIdentifier&,
 
84
                       std::set<std::string>&)
 
85
  {
 
86
  }
 
87
 
77
88
  bool doDoesTableExist(drizzled::Session&, const drizzled::TableIdentifier&)
78
89
  {
79
90
    return false;
109
120
  {}
110
121
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
111
122
                             const drizzled::SchemaIdentifier &schema_identifier,
112
 
                             drizzled::TableIdentifier::vector &set_of_identifiers);
 
123
                             drizzled::TableIdentifiers &set_of_identifiers);
113
124
};
114
125
 
115
126
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */