Issue the database statements to drop the table associated with a dao.

@param dao
Associated dao.
@return The number of statements executed to do so.
428078
public static <T, ID> int dropTable(Dao<T, ID> dao, boolean ignoreErrors) throws SQLException {
		ConnectionSource connectionSource = dao.getConnectionSource();
		Class<T> dataClass = dao.getDataClass();
		DatabaseType databaseType = connectionSource.getDatabaseType();
		if (dao instanceof BaseDaoImpl<?, ?>) {
			return doDropTable(databaseType, connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), ignoreErrors);
		} else {
			TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(databaseType, dataClass);
			return doDropTable(databaseType, connectionSource, tableInfo, ignoreErrors);
		}
	}
397935
@Override
    public void dropSchema()
    {
        // dropping all the tables in the Oracle NoSQL store
        if (operation != null && operation.equalsIgnoreCase("create-drop"))
        {
            for (TableInfo tableInfo : tableInfos)
            {
                try
                {
                    StatementResult result = tableAPI.executeSync("DROP TABLE IF EXISTS " + tableInfo.getTableName());
                    if (!result.isSuccessful())
                    {
                        throw new SchemaGenerationException("Unable to DROP TABLE " + tableInfo.getTableName());
                    }
                }
                catch (IllegalArgumentException e)
                {
                    logger.error("Invalid DROP TABLE Statement. Caused By: ", e);
                    throw new SchemaGenerationException(e, "Invalid DROP TABLE Statement. Caused By: ");
                }
                catch (FaultException e)
                {
                    logger.error("DROP TABLE Statement couldn't be executed. Caused By: ", e);
                    throw new SchemaGenerationException(e, "Invalid DROP TABLE Statement is executed. Caused By: ");
                }
            }
        }
    }
1007996
@Override
    protected void generateDao(TableDefinition table, JavaWriter out1) {
        UniqueKeyDefinition key = table.getPrimaryKey();
        if (key == null) {
            logger.info("Skipping DAO generation", out1.file().getName());
            return;
        }
        VertxJavaWriter out = (VertxJavaWriter) out1;
        generateDAO(key, table, out);
    }
84895
public boolean dropColumn (Connection conn, String table, String column) throws SQLException
    {
        if (!tableContainsColumn(conn, table, column)) {
            return false;
        }
        executeQuery(conn, "ALTER TABLE " + tableSQL(table) + " DROP COLUMN " + columnSQL(column));
        log("Database column '" + column + "' removed from table '" + table + "'.");
        return true;
    }
928541
def DropTables(self):
    """"""

    rows, _ = self.ExecuteQuery(
        "SELECT table_name FROM information_schema.tables "
        "WHERE table_schema='%s'" % self.database_name)
    for row in rows:
      self.ExecuteQuery("DROP TABLE `%s`" % row["table_name"])
549678
public void dropConnection(String name, String database) {
        RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));

        DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
        requestExecutor.execute(command);
    }
1225054
public void dropSchema()
    {
        if (operation != null && operation.equalsIgnoreCase("create-drop"))
        {
            try
            {
                HTableDescriptor hTableDescriptor = null;
                if (admin.isTableAvailable(databaseName))
                {
                    if (admin.isTableEnabled(databaseName))
                    {
                        hTableDescriptor = admin.getTableDescriptor(databaseName.getBytes());
                        admin.disableTable(databaseName);
                    }
                    for (TableInfo tableInfo : tableInfos)
                    {
                        if (tableInfo != null && tableInfo.getTableName() != null
                                && hTableDescriptor.getFamily(tableInfo.getTableName().getBytes()) != null)
                        {
                            admin.deleteColumn(databaseName, tableInfo.getTableName());
                        }
                    }
                }
            }
            catch (TableNotFoundException tnfe)
            {
                logger.error("Table doesn't exist, Caused by ", tnfe);
                throw new SchemaGenerationException(tnfe, "Hbase");
            }
            catch (IOException ioe)
            {
                logger.error("Table isn't in enabled state, Caused by", ioe);
                throw new SchemaGenerationException(ioe, "Hbase");
            }
            finally
            {
                try
                {
                    admin.enableTable(databaseName);
                }
                catch (IOException ioe)
                {
                    logger.error("Table isn't in enabled state, Caused by", ioe);
                    throw new SchemaGenerationException(ioe, "Hbase");
                }
            }
        }
        operation = null;
        admin = null;
    }
555492
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
		for(CachedDAO<?,?,?> d : dao) {  
			for(int i=0;i<d.segSize;++i) {
				startCleansing(env, d.table()+i);
			}
		}
	}
63996
@NonNull
  public static Drop dropTable(@NonNull String tableName) {
    return dropTable(CqlIdentifier.fromCql(tableName));
  }
1286643
private int getTotalCount(String sql, Connection conn, MappedStatement ms, BoundSql boundSql) throws SQLException {
    int start = sql.indexOf("from");
    if (start == -1) {
      throw new RuntimeException("statement has no 'from' keyword");
    }
    int stop = sql.indexOf("order by");
    if (stop == -1) {
      stop = sql.length();
    }

    String countSql = "select count(0) " + sql.substring(start, stop);
    BoundSql countBoundSql = new BoundSql(ms.getConfiguration(), countSql, boundSql.getParameterMappings(), boundSql.getParameterObject());
    ParameterHandler parameterHandler = new DefaultParameterHandler(ms, boundSql.getParameterObject(), countBoundSql);
    PreparedStatement stmt = null;
    ResultSet rs = null;
    int count = 0;
    try {
      stmt = conn.prepareStatement(countSql);
      // 通过parameterHandler给PreparedStatement对象设置参数
      parameterHandler.setParameters(stmt);
      rs = stmt.executeQuery();
      if (rs.next()) {
        count = rs.getInt(1);
      }
    } finally {
      CloseableUtil.closeQuietly(rs);
      CloseableUtil.closeQuietly(stmt);
    }
    return count;
  }
447481
public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz)
			throws SQLException {
		@SuppressWarnings("unchecked")
		Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz);
		return new RuntimeExceptionDao<T, ID>(castDao);
	}
226823
public boolean dropTable (Connection conn, String name) throws SQLException
    {
        if (!tableExists(conn, name)) {
            return false;
        }
        executeQuery(conn, "DROP TABLE " + tableSQL(name));
        log("Table '" + name + "' dropped.");
        return true;
    }
697615
@Override
   public SqlStatement[] generateStatements(final Database database) {
      final Collection<SqlStatement> statements = new ArrayList<SqlStatement>();
      // MySQL and PostgreSQL only need the normal DROP INDEX statement.
      if (!(database instanceof MySQLDatabase) && !(database instanceof PostgresDatabase)) {
         final DropSpatialIndexStatement dropSpatialIndex = new DropSpatialIndexStatement(
               this.indexName, this.catalogName, this.schemaName, this.tableName);
         statements.add(dropSpatialIndex);
      }

      // GeoDB doesn't use a tradition index structure so don't issue the normal DROP INDEX
      // statement.
      if (!(database instanceof DerbyDatabase) && !(database instanceof H2Database)) {
         final DropIndexStatement dropIndex = new DropIndexStatement(this.indexName,
               this.catalogName, this.schemaName, this.tableName, null);
         statements.add(dropIndex);
      }
      return statements.toArray(new SqlStatement[statements.size()]);
   }
553684
function dropDatabase (db, fn) {
  db.connection.db.executeDbCommand({
    dropDatabase: 1
  }, function(err, result) {
    db.disconnect()
    fn && fn(err, result)
  })
}
669016
public static void unregisterDao(ConnectionSource connectionSource,
			Class<?> clazz) {

		Dao<?, ?> dao = DaoManager.lookupDao(connectionSource, clazz);
		if (dao != null) {
			DaoManager.unregisterDao(connectionSource, dao);
		}

	}
991293
public <T, K> DAO<T, K> getDAO(
                    final Class<T> entityClass
                    )
    {
        if (entityClass == null) {
            throw new ObjectTypeException( "entity type NOT specified (null)" );
        }

        DAO<T, K>  dao = null;
        try {
            @SuppressWarnings( "unchecked" )
            DAO<T, K>  dao_tmp = (DAO<T, K>)_daoMap.get( entityClass );
                                 //throws ClassCastException
            dao = dao_tmp;
        } catch (Exception ex) {
            throw new RepositoryConfigurationException( ex );
        }

        if (dao == null) {
            throw new RepositoryConfigurationException( "unknown entity type: " + entityClass );
        }

        return dao;
    }
410058
public synchronized void shutdownDB() throws DatabaseException {

		if (db != null) {
			db.close();
			db = null;
		}

		if (env != null) {
			env.close();
			env = null;
		}
	}