~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

Merged trunk and use-std-unordred.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
 
205
205
    string tmp(packet, packet_length);
206
206
 
207
 
    if (not mysql_change_db(session, tmp))
 
207
    SchemaIdentifier identifier(tmp);
 
208
 
 
209
    if (not mysql_change_db(session, identifier))
208
210
    {
209
211
      session->my_ok();
210
212
    }
506
508
      param->select_limit=
507
509
        new Item_int((uint64_t) session->variables.select_limit);
508
510
  }
509
 
  if (!(res= session->openTablesLock(all_tables)))
 
511
  if (not (res= session->openTablesLock(all_tables)))
510
512
  {
511
513
    if (lex->describe)
512
514
    {
695
697
  */
696
698
  if ((var= get_system_var(session, OPT_SESSION, tmp, null_lex_string)))
697
699
  {
698
 
    end+= sprintf(buff, "@@session.%s", var_name);
 
700
    end+= snprintf(buff, sizeof(buff), "@@session.%s", var_name);
699
701
    var->set_name(buff, end-buff, system_charset_info);
700
702
    session->add_item_to_list(var);
701
703
  }
896
898
    return NULL;
897
899
  }
898
900
 
899
 
  if (table->is_derived_table() == false && table->db.str &&
900
 
      check_db_name(&table->db))
 
901
  if (table->is_derived_table() == false && table->db.str)
901
902
  {
902
 
    my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
903
 
    return NULL;
 
903
    my_casedn_str(files_charset_info, table->db.str);
 
904
 
 
905
    SchemaIdentifier schema_identifier(string(table->db.str, table->db.length));
 
906
    if (not check_db_name(schema_identifier))
 
907
    {
 
908
 
 
909
      my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
 
910
      return NULL;
 
911
    }
904
912
  }
905
913
 
906
914
  if (!alias)                                   /* Alias is case sensitive */
949
957
         tables=tables->next_local)
950
958
    {
951
959
      if (!my_strcasecmp(table_alias_charset, alias_str, tables->alias) &&
952
 
          !strcmp(ptr->db, tables->db))
 
960
          !strcasecmp(ptr->db, tables->db))
953
961
      {
954
962
        my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str);
955
963
        return NULL;
1599
1607
    return true;
1600
1608
  }
1601
1609
 
 
1610
  if (not plugin::StorageEngine::doesSchemaExist(identifier))
 
1611
  {
 
1612
    my_error(ER_BAD_DB_ERROR, MYF(0), identifier.getSchemaName().c_str());
 
1613
    return true;
 
1614
  }
 
1615
 
1602
1616
  return false;
1603
1617
}
1604
1618