~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: pawel
  • Date: 2010-03-29 20:16:08 UTC
  • mto: This revision was merged to the branch mainline in revision 1428.
  • Revision ID: pawel@paw-20100329201608-ndqnc736k47uvy3s
changed function-like defines into functions in some files

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
  @returns true if errors are detected, false otherwise.
192
192
*/
193
193
 
194
 
static bool store_db_create_info(SchemaIdentifier &schema_identifier, string &buffer, bool if_not_exists)
 
194
static bool store_db_create_info(const char *dbname, string &buffer, bool if_not_exists)
195
195
{
196
196
  message::Schema schema;
197
197
 
198
 
  bool found= plugin::StorageEngine::getSchemaDefinition(schema_identifier, schema);
 
198
  bool found= plugin::StorageEngine::getSchemaDefinition(dbname, schema);
199
199
  if (not found)
200
200
    return false;
201
201
 
217
217
  return true;
218
218
}
219
219
 
220
 
bool mysqld_show_create_db(Session &session, SchemaIdentifier &schema_identifier, bool if_not_exists)
 
220
bool mysqld_show_create_db(Session *session, const char *dbname, bool if_not_exists)
221
221
{
222
 
  message::Schema schema_message;
223
222
  string buffer;
224
223
 
225
 
  if (not plugin::StorageEngine::getSchemaDefinition(schema_identifier, schema_message))
226
 
  {
227
 
    /*
228
 
      This assumes that the only reason for which store_db_create_info()
229
 
      can fail is incorrect database name (which is the case now).
230
 
    */
231
 
    my_error(ER_BAD_DB_ERROR, MYF(0), schema_identifier.getSQLPath().c_str());
232
 
    return true;
233
 
  }
234
 
 
235
 
  if (not store_db_create_info(schema_identifier, buffer, if_not_exists))
236
 
  {
237
 
    /*
238
 
      This assumes that the only reason for which store_db_create_info()
239
 
      can fail is incorrect database name (which is the case now).
240
 
    */
241
 
    my_error(ER_BAD_DB_ERROR, MYF(0), schema_identifier.getSQLPath().c_str());
 
224
  if (not store_db_create_info(dbname, buffer, if_not_exists))
 
225
  {
 
226
    /*
 
227
      This assumes that the only reason for which store_db_create_info()
 
228
      can fail is incorrect database name (which is the case now).
 
229
    */
 
230
    my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
242
231
    return true;
243
232
  }
244
233
 
246
235
  field_list.push_back(new Item_empty_string("Database",NAME_CHAR_LEN));
247
236
  field_list.push_back(new Item_empty_string("Create Database",1024));
248
237
 
249
 
  if (session.client->sendFields(&field_list))
250
 
    return true;
251
 
 
252
 
  session.client->store(schema_message.name());
253
 
  session.client->store(buffer);
254
 
 
255
 
  if (session.client->flush())
256
 
    return true;
257
 
 
258
 
  session.my_eof();
 
238
  if (session->client->sendFields(&field_list))
 
239
    return true;
 
240
 
 
241
  session->client->store(dbname, strlen(dbname));
 
242
  session->client->store(buffer);
 
243
 
 
244
  if (session->client->flush())
 
245
    return true;
 
246
 
 
247
  session->my_eof();
259
248
 
260
249
  return false;
261
250
}
415
404
 
416
405
    if (field->has_charset())
417
406
    {
 
407
      if (field->charset() != share->table_charset)
 
408
      {
 
409
        packet->append(STRING_WITH_LEN(" CHARACTER SET "));
 
410
        packet->append(field->charset()->csname);
 
411
      }
 
412
 
418
413
      /*
419
414
        For string types dump collation name only if
420
415
        collation is not primary for the given charset