~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message.cc

doStartTableScan() result not checked.

Add __attribute__((warn_unused_result)) to Cursor::startTableScan()
and by extension init_read_records

then go and fix the places where we weren't checking for errors.

This patch helped by Monty Widenius' patch to MariaDB. Greatly increased
confidence that we either handle the errors correctly or are at least
on par with bugs :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "drizzled/message/schema.pb.h"
31
31
 
32
32
#include <string>
 
33
#include <uuid/uuid.h>
33
34
 
34
35
namespace drizzled {
35
36
namespace message {
49
50
static const std::string DATE("DATE");
50
51
static const std::string EPOCH("EPOCH");
51
52
static const std::string TIMESTAMP("TIMESTAMP");
52
 
static const std::string MICROTIME("MICROTIME");
53
53
static const std::string DATETIME("DATETIME");
54
54
static const std::string TIME("TIME");
55
55
static const std::string UUID("UUID");
75
75
static const std::string MATCH_PARTIAL("PARTIAL");
76
76
static const std::string MATCH_SIMPLE("SIMPLE");
77
77
 
 
78
void init(drizzled::message::Table &arg, const std::string &name_arg, const std::string &schema_arg, const std::string &engine_arg)
 
79
{
 
80
  arg.set_name(name_arg);
 
81
  arg.set_schema(schema_arg);
 
82
  arg.set_creation_timestamp(time(NULL));
 
83
  arg.set_update_timestamp(time(NULL));
 
84
  arg.mutable_engine()->set_name(engine_arg);
 
85
 
 
86
  /* 36 characters for uuid string +1 for NULL */
 
87
  uuid_t uu;
 
88
  char uuid_string[37];
 
89
  uuid_generate_random(uu);
 
90
  uuid_unparse(uu, uuid_string);
 
91
  arg.set_uuid(uuid_string, 36);
 
92
 
 
93
  arg.set_version(1);
 
94
}
 
95
 
 
96
void init(drizzled::message::Schema &arg, const std::string &name_arg)
 
97
{
 
98
  arg.set_name(name_arg);
 
99
  arg.mutable_engine()->set_name(std::string("filesystem")); // For the moment we have only one.
 
100
  if (not arg.has_collation())
 
101
  {
 
102
    arg.set_collation(default_charset_info->name);
 
103
  }
 
104
 
 
105
  /* 36 characters for uuid string +1 for NULL */
 
106
  uuid_t uu;
 
107
  char uuid_string[37];
 
108
  uuid_generate_random(uu);
 
109
  uuid_unparse(uu, uuid_string);
 
110
  arg.set_uuid(uuid_string, 36);
 
111
 
 
112
  arg.set_version(1);
 
113
}
 
114
 
78
115
void update(drizzled::message::Schema &arg)
79
116
{
80
117
  arg.set_version(arg.version() + 1);