~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Brian Aker
  • Date: 2010-12-07 09:12:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1985.
  • Revision ID: brian@tangent.org-20101207091212-1m0w20tck6z7632m
This is a fix for bug lp:686197

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
      break;                                    // fatal error is set
223
223
    DRIZZLE_QUERY_START(session->getQueryString()->c_str(),
224
224
                        session->thread_id,
225
 
                        const_cast<const char *>(session->schema()->c_str()));
 
225
                        const_cast<const char *>(session->db.empty() ? "" : session->db.c_str()));
226
226
 
227
227
    mysql_parse(session, session->getQueryString()->c_str(), session->getQueryString()->length());
228
228
 
743
743
      {
744
744
        DRIZZLE_QUERY_EXEC_START(session->getQueryString()->c_str(),
745
745
                                 session->thread_id,
746
 
                                 const_cast<const char *>(session->schema()->c_str()));
 
746
                                 const_cast<const char *>(session->db.empty() ? "" : session->db.c_str()));
747
747
        // Implement Views here --Brian
748
748
        /* Actually execute the query */
749
749
        try 
1542
1542
 
1543
1543
 
1544
1544
/**
 
1545
  CREATE TABLE query pre-check.
 
1546
 
 
1547
  @param session                        Thread handler
 
1548
  @param tables         Global table list
 
1549
  @param create_table           Table which will be created
 
1550
 
 
1551
  @retval
 
1552
    false   OK
 
1553
  @retval
 
1554
    true   Error
 
1555
*/
 
1556
 
 
1557
bool create_table_precheck(TableIdentifier &identifier)
 
1558
{
 
1559
  if (not plugin::StorageEngine::canCreateTable(identifier))
 
1560
  {
 
1561
    my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", identifier.getSchemaName().c_str());
 
1562
    return true;
 
1563
  }
 
1564
 
 
1565
  if (not plugin::StorageEngine::doesSchemaExist(identifier))
 
1566
  {
 
1567
    my_error(ER_BAD_DB_ERROR, MYF(0), identifier.getSchemaName().c_str());
 
1568
    return true;
 
1569
  }
 
1570
 
 
1571
  return false;
 
1572
}
 
1573
 
 
1574
 
 
1575
/**
1545
1576
  negate given expression.
1546
1577
 
1547
1578
  @param session  thread handler