~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_schema.cc

  • Committer: Vijay Samuel
  • Date: 2010-09-10 21:03:37 UTC
  • mto: (1757.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1758.
  • Revision ID: vijay@vijay-20100910210337-rf7c2ymawtqj6tkv
Merge added utf 8 tamil test case suite and test case for creating a database in tamil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <drizzled/statement/alter_schema.h>
25
25
#include <drizzled/plugin/storage_engine.h>
26
26
#include <drizzled/db.h>
27
 
#include <drizzled/message.h>
28
27
 
29
28
#include <string>
30
29
 
36
35
bool statement::AlterSchema::execute()
37
36
{
38
37
  LEX_STRING *db= &session->lex->name;
39
 
  message::SchemaPtr old_definition;
 
38
  message::Schema old_definition;
40
39
 
41
40
  if (not validateSchemaOptions())
42
41
    return true;
49
48
    return false;
50
49
  }
51
50
 
52
 
  SchemaIdentifier identifier(db->str);
 
51
  schema_message.set_name(db->str);
 
52
  schema_message.mutable_engine()->set_name("filesystem"); // For the moment we have only one.
 
53
  SchemaIdentifier identifier(schema_message.name());
 
54
 
53
55
  if (not plugin::StorageEngine::getSchemaDefinition(identifier, old_definition))
54
56
  {
55
57
    my_error(ER_SCHEMA_DOES_NOT_EXIST, MYF(0), db->str);
63
65
               MYF(0));
64
66
    return true;
65
67
  }
66
 
  /*
67
 
    @todo right now the logic for alter schema is just sitting here, at some point this should be packaged up in a class/etc.
68
 
  */
69
 
 
70
 
  // We set the name from the old version to keep case preference
71
 
  schema_message.set_name(old_definition->name());
72
 
  schema_message.set_version(old_definition->version());
73
 
  schema_message.set_uuid(old_definition->uuid());
74
 
  schema_message.mutable_engine()->set_name(old_definition->engine().name());
75
 
 
76
 
  // We need to make sure we don't destroy any collation that might have
77
 
  // been changed.
 
68
 
78
69
  if (not schema_message.has_collation())
79
70
  {
80
 
    schema_message.set_collation(old_definition->collation());
 
71
    schema_message.set_collation(schema_message.collation());
81
72
  }
82
 
  
83
 
  drizzled::message::update(schema_message);
84
73
 
85
74
  bool res= mysql_alter_db(session, schema_message);
86
75