~skinny.moey/drizzle/transaction_id_innodb

« back to all changes in this revision

Viewing changes to plugin/schema_dictionary/schemas.cc

  • Committer: Joseph Daly
  • Date: 2010-10-29 00:12:38 UTC
  • mfrom: (1856.2.32 merge)
  • Revision ID: skinny.moey@gmail.com-20101029001238-y6dxgjv9eam7uc2a
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
using namespace drizzled;
26
26
 
27
27
SchemasTool::SchemasTool() :
28
 
  plugin::TableFunction("DATA_DICTIONARY", "SCHEMAS")
 
28
  DataDictionary("SCHEMAS")
29
29
{
30
30
  add_field("SCHEMA_NAME");
31
31
  add_field("DEFAULT_COLLATION_NAME");
36
36
  add_field("SCHEMA_USE_COUNT", plugin::TableFunction::NUMBER, 0, true);
37
37
}
38
38
 
39
 
SchemasTool::Generator::Generator(Field **arg) :
40
 
  plugin::TableFunction::Generator(arg),
 
39
SchemasTool::Generator::Generator(drizzled::Field **arg) :
 
40
  DataDictionary::Generator(arg),
41
41
  schema_generator(getSession())
42
42
{
43
43
}
44
 
  
45
 
bool SchemasTool::Generator::nextSchema()
 
44
 
 
45
bool SchemasTool::Generator::populate()
46
46
{
47
47
  drizzled::message::SchemaPtr schema_ptr;
48
48
  while ((schema_ptr= schema_generator))
49
49
  {
50
 
    schema= schema_ptr;
51
 
    return true;
52
 
  }
53
 
 
54
 
  return false;
55
 
}
56
 
 
57
 
 
58
 
bool SchemasTool::Generator::populate()
59
 
{
60
 
  if (nextSchema())
61
 
  {
62
 
    fill();
63
 
    return true;
64
 
  }
65
 
 
66
 
  return false;
67
 
}
68
 
 
69
 
/**
70
 
  A lack of a parsed schema file means we are using defaults.
71
 
*/
72
 
void SchemasTool::Generator::fill()
73
 
{
74
 
  /* SCHEMA_NAME */
75
 
  push(schema->name());
76
 
 
77
 
  /* DEFAULT_COLLATION_NAME */
78
 
  push(schema->collation());
79
 
 
80
 
  /* SCHEMA_CREATION_TIME */
81
 
  time_t time_arg= schema->creation_timestamp();
82
 
  char buffer[40];
83
 
  struct tm tm_buffer;
84
 
 
85
 
  localtime_r(&time_arg, &tm_buffer);
86
 
  strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
87
 
  push(buffer);
88
 
 
89
 
  /* SCHEMA_UPDATE_TIME */
90
 
  time_arg= schema->update_timestamp();
91
 
  localtime_r(&time_arg, &tm_buffer);
92
 
  strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
93
 
  push(buffer);
94
 
 
95
 
  /* SCHEMA_UUID */
96
 
  push(schema->uuid());
97
 
 
98
 
  /* SCHEMA_VERSION */
99
 
  push(schema->version());
100
 
 
101
 
  /* SCHEMA_USE_COUNT */
102
 
  push(schema->version());
 
50
    /* SCHEMA_NAME */
 
51
    push(schema_ptr->name());
 
52
 
 
53
    /* DEFAULT_COLLATION_NAME */
 
54
    push(schema_ptr->collation());
 
55
 
 
56
    /* SCHEMA_CREATION_TIME */
 
57
    time_t time_arg= schema_ptr->creation_timestamp();
 
58
    char buffer[40];
 
59
    struct tm tm_buffer;
 
60
 
 
61
    localtime_r(&time_arg, &tm_buffer);
 
62
    strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
 
63
    push(buffer);
 
64
 
 
65
    /* SCHEMA_UPDATE_TIME */
 
66
    time_arg= schema_ptr->update_timestamp();
 
67
    localtime_r(&time_arg, &tm_buffer);
 
68
    strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", &tm_buffer);
 
69
    push(buffer);
 
70
 
 
71
    /* SCHEMA_UUID */
 
72
    push(schema_ptr->uuid());
 
73
 
 
74
    /* SCHEMA_VERSION */
 
75
    push(schema_ptr->version());
 
76
 
 
77
    /* SCHEMA_USE_COUNT */
 
78
    push(schema_ptr->version());
 
79
    return true;
 
80
  }
 
81
 
 
82
  return false;
103
83
}