~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_schema.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:
41
41
  if (not validateSchemaOptions())
42
42
    return true;
43
43
 
44
 
  identifier::Schema schema_identifier(string(db->str, db->length));
 
44
  SchemaIdentifier schema_identifier(string(db->str, db->length));
45
45
 
46
46
  if (not check_db_name(session, schema_identifier))
47
47
  {
48
 
    my_error(ER_WRONG_DB_NAME, schema_identifier);
 
48
    std::string path;
 
49
    schema_identifier.getSQLPath(path);
 
50
    my_error(ER_WRONG_DB_NAME, MYF(0), path.c_str());
49
51
 
50
52
    return false;
51
53
  }
52
54
 
53
 
  identifier::Schema identifier(db->str);
 
55
  SchemaIdentifier identifier(db->str);
54
56
  if (not plugin::StorageEngine::getSchemaDefinition(identifier, old_definition))
55
57
  {
56
 
    my_error(ER_SCHEMA_DOES_NOT_EXIST, identifier); 
 
58
    my_error(ER_SCHEMA_DOES_NOT_EXIST, MYF(0), db->str);
57
59
    return true;
58
60
  }
59
61
 
68
70
    @todo right now the logic for alter schema is just sitting here, at some point this should be packaged up in a class/etc.
69
71
  */
70
72
 
71
 
  // First initialize the schema message
72
 
  drizzled::message::schema::init(schema_message, old_definition->name());
73
 
 
74
73
  // We set the name from the old version to keep case preference
 
74
  schema_message.set_name(old_definition->name());
75
75
  schema_message.set_version(old_definition->version());
76
76
  schema_message.set_uuid(old_definition->uuid());
77
77
  schema_message.mutable_engine()->set_name(old_definition->engine().name());
85
85
  
86
86
  drizzled::message::update(schema_message);
87
87
 
88
 
  bool res= alter_db(session, schema_message, old_definition);
 
88
  bool res= alter_db(session, schema_message);
89
89
 
90
90
  return not res;
91
91
}