~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_show.cc

MergingĀ fromĀ Mark.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
** List all table types supported
83
83
***************************************************************************/
84
84
 
85
 
static int make_version_string(char *buf, int buf_length, uint version)
86
 
{
87
 
  return snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff);
88
 
}
89
 
 
90
85
static bool show_plugins(THD *thd, plugin_ref plugin,
91
86
                            void *arg)
92
87
{
94
89
  struct st_mysql_plugin *plug= plugin_decl(plugin);
95
90
  struct st_plugin_dl *plugin_dl= plugin_dlib(plugin);
96
91
  CHARSET_INFO *cs= system_charset_info;
97
 
  char version_buf[20];
98
92
 
99
93
  restore_record(table, s->default_values);
100
94
 
101
95
  table->field[0]->store(plugin_name(plugin)->str,
102
96
                         plugin_name(plugin)->length, cs);
103
97
 
104
 
  table->field[1]->store(version_buf,
105
 
        make_version_string(version_buf, sizeof(version_buf), plug->version),
106
 
        cs);
107
 
 
 
98
  if (plug->version)
 
99
  {
 
100
    table->field[1]->store(plug->version, strlen(plug->version), cs);
 
101
    table->field[1]->set_notnull();
 
102
  }
 
103
  else
 
104
    table->field[1]->set_null();
108
105
 
109
106
  switch (plugin_state(plugin)) {
110
107
  /* case PLUGIN_IS_FREED: does not happen */
124
121
  table->field[3]->store(plugin_type_names[plug->type].str,
125
122
                         plugin_type_names[plug->type].length,
126
123
                         cs);
127
 
  table->field[4]->store(version_buf,
128
 
        make_version_string(version_buf, sizeof(version_buf),
129
 
                            *(uint *)plug->info), cs);
130
124
 
131
125
  if (plugin_dl)
132
126
  {
133
 
    table->field[5]->store(plugin_dl->dl.str, plugin_dl->dl.length, cs);
 
127
    table->field[4]->store(plugin_dl->dl.str, plugin_dl->dl.length, cs);
 
128
    table->field[4]->set_notnull();
 
129
  }
 
130
  else
 
131
  {
 
132
    table->field[4]->set_null();
 
133
  }
 
134
 
 
135
  if (plug->author)
 
136
  {
 
137
    table->field[5]->store(plug->author, strlen(plug->author), cs);
134
138
    table->field[5]->set_notnull();
135
 
    table->field[6]->store(version_buf,
136
 
          make_version_string(version_buf, sizeof(version_buf),
137
 
                              plugin_dl->version),
138
 
          cs);
 
139
  }
 
140
  else
 
141
    table->field[5]->set_null();
 
142
 
 
143
  if (plug->descr)
 
144
  {
 
145
    table->field[6]->store(plug->descr, strlen(plug->descr), cs);
139
146
    table->field[6]->set_notnull();
140
147
  }
141
148
  else
142
 
  {
143
 
    table->field[5]->set_null();
144
149
    table->field[6]->set_null();
145
 
  }
146
 
 
147
 
 
148
 
  if (plug->author)
149
 
  {
150
 
    table->field[7]->store(plug->author, strlen(plug->author), cs);
151
 
    table->field[7]->set_notnull();
152
 
  }
153
 
  else
154
 
    table->field[7]->set_null();
155
 
 
156
 
  if (plug->descr)
157
 
  {
158
 
    table->field[8]->store(plug->descr, strlen(plug->descr), cs);
159
 
    table->field[8]->set_notnull();
160
 
  }
161
 
  else
162
 
    table->field[8]->set_null();
163
150
 
164
151
  switch (plug->license) {
165
152
  case PLUGIN_LICENSE_GPL:
166
 
    table->field[9]->store(PLUGIN_LICENSE_GPL_STRING, 
 
153
    table->field[7]->store(PLUGIN_LICENSE_GPL_STRING, 
167
154
                           strlen(PLUGIN_LICENSE_GPL_STRING), cs);
168
155
    break;
169
156
  case PLUGIN_LICENSE_BSD:
170
 
    table->field[9]->store(PLUGIN_LICENSE_BSD_STRING, 
 
157
    table->field[7]->store(PLUGIN_LICENSE_BSD_STRING, 
171
158
                           strlen(PLUGIN_LICENSE_BSD_STRING), cs);
172
159
    break;
173
160
  default:
174
 
    table->field[9]->store(PLUGIN_LICENSE_PROPRIETARY_STRING, 
 
161
    table->field[7]->store(PLUGIN_LICENSE_PROPRIETARY_STRING, 
175
162
                           strlen(PLUGIN_LICENSE_PROPRIETARY_STRING), cs);
176
163
    break;
177
164
  }
178
 
  table->field[9]->set_notnull();
 
165
  table->field[7]->set_notnull();
179
166
 
180
167
  return schema_table_store_record(thd, table);
181
168
}
4639
4626
 
4640
4627
ST_FIELD_INFO plugin_fields_info[]=
4641
4628
{
4642
 
  {"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
 
4629
  {"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", 
4643
4630
   SKIP_OPEN_TABLE},
4644
4631
  {"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
4645
4632
  {"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
4646
4633
  {"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE},
4647
 
  {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
4648
4634
  {"PLUGIN_LIBRARY", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Library",
4649
4635
   SKIP_OPEN_TABLE},
4650
 
  {"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
4651
4636
  {"PLUGIN_AUTHOR", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
4652
4637
  {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
4653
4638
  {"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 1, "License", SKIP_OPEN_TABLE},