/*
(non-Javadoc)

@see com.impetus.kundera.configure.schema.api.SchemaManager#dropSchema()
490536
@Override
    public void dropSchema()
    {
        try
        {
            if (operation != null && ("create-drop").equalsIgnoreCase(operation))
            {
                r.dbDrop(databaseName);
            }
        }
        catch (Exception e)
        {
            logger.error("Error while dropping schema", e);
            throw new SchemaGenerationException(e, "RethinkDB");
        }
    }
226348
@When("^I drop a Cassandra table named '(.+?)' using keyspace '(.+?)'$")
    public void dropTableWithData(String table, String keyspace) {
        try {
            commonspec.getCassandraClient().useKeyspace(keyspace);
            commonspec.getCassandraClient().dropTable(table);
        } catch (Exception e) {
            commonspec.getLogger().debug("Exception captured");
            commonspec.getLogger().debug(e.toString());
            commonspec.getExceptions().add(e);
        }
    }
685671
public byte[] requestMFPSchemata(byte[] schemaData)
   throws SIConnectionLostException,
          SIConnectionDroppedException,
          SIConnectionUnavailableException,
          SIErrorException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "requestMFPSchemata");

      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.bytes(this, tc, schemaData);

      byte[] returnSchemaData = null;

      CommsByteBuffer request = getCommsByteBuffer();
      request.wrap(schemaData);

      CommsByteBuffer reply = jfapExchange(request,
                                           JFapChannelConstants.SEG_REQUEST_SCHEMA,
                                           JFapChannelConstants.PRIORITY_HIGHEST,
                                           true);

      try
      {
         short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_REQUEST_SCHEMA_R);
         if (err != CommsConstants.SI_NO_EXCEPTION)
         {
            checkFor_SIConnectionUnavailableException(reply, err);
            checkFor_SIErrorException(reply, err);
            defaultChecker(reply, err);
         }

         // Now get the bytes
         returnSchemaData = reply.getRemaining();

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.bytes(this, tc, returnSchemaData);
      }
      finally
      {
         if (reply != null) reply.release();
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "requestMFPSchemata", returnSchemaData);
      return returnSchemaData;
   }
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: ");
                }
            }
        }
    }
465531
public void dropSchema()
    {
        if (operation != null && operation.equalsIgnoreCase("create-drop"))
        {
            for (TableInfo tableInfo : tableInfos)
            {
                if (tableInfo.getLobColumnInfo().isEmpty())
                {
                    coll = db.getCollection(tableInfo.getTableName());
                    coll.drop();
                    KunderaCoreUtils.printQuery("Drop collection:" + tableInfo.getTableName(), showQuery);
                }
                else
                {
                    coll = db.getCollection(tableInfo.getTableName() + MongoDBUtils.FILES);
                    coll.drop();
                    KunderaCoreUtils.printQuery("Drop collection:" + tableInfo.getTableName() + MongoDBUtils.FILES,
                            showQuery);
                    coll = db.getCollection(tableInfo.getTableName() + MongoDBUtils.CHUNKS);
                    coll.drop();
                    KunderaCoreUtils.printQuery("Drop collection:" + tableInfo.getTableName() + MongoDBUtils.CHUNKS,
                            showQuery);
                }
            }
        }
        db = null;
    }
1366282
function drop(schemas) {
  var resolver = new Resolver(schemas);
  var knex = this.knex;
  return Promise.map(schemas || [], function(schema) {
    return (schema.preDrop || _.noop)(knex);
  })
  .then(function () {
    // Reduce force sequential execution.
    return Promise.reduce(resolver.resolve().reverse(), dropSchema.bind(this), []);
  }.bind(this));
}
1324399
private SchemaManager getSchemaManagerForPu(final String persistenceUnit)
    {
        SchemaManager schemaManager = null;
        Map<String, Object> externalProperties = KunderaCoreUtils.getExternalProperties(persistenceUnit,
                externalPropertyMap, persistenceUnits);
        if (getSchemaProperty(persistenceUnit, externalProperties) != null
                && !getSchemaProperty(persistenceUnit, externalProperties).isEmpty())
        {
            ClientFactory clientFactory = ClientResolver.getClientFactory(persistenceUnit);
            schemaManager = clientFactory != null ? clientFactory.getSchemaManager(externalProperties) : null;
        }
        return schemaManager;
    }
1009947
private void dropKeyspaceOrCFs() throws InvalidRequestException, SchemaDisagreementException, TException, Exception
    {
        if (createdKeyspaces.contains(databaseName))// drop if created during
                                                    // create-drop call.
        {
            cassandra_client.system_drop_keyspace(databaseName);
        }
        else
        {
            cassandra_client.set_keyspace(databaseName);
            for (TableInfo tableInfo : tableInfos)
            {
                dropColumnFamily(tableInfo);
            }
        }
    }
1058275
def drop_schema(self):
        """"""
        execute = self.cursor.execute
        execute('DROP TABLE IF EXISTS gauged_data')
        execute('DROP TABLE IF EXISTS gauged_keys')
        execute('DROP TABLE IF EXISTS gauged_writer_history')
        execute('DROP TABLE IF EXISTS gauged_cache')
        execute('DROP TABLE IF EXISTS gauged_statistics')
        execute('DROP TABLE IF EXISTS gauged_metadata')
        self.db.commit()
710824
@Override
    public synchronized void dropEntity(final DbEntity entity) throws DatabaseEngineException {
        dropSequences(entity);
        dropTable(entity);
        entities.remove(entity.getName());
        logger.trace("Entity {} dropped", entity.getName());
    }
825287
private void dropTableUsingCql(TableInfo tableInfo) throws Exception
    {

        CQLTranslator translator = new CQLTranslator();
        StringBuilder dropQuery = new StringBuilder("drop table ");
        translator.ensureCase(dropQuery, tableInfo.getTableName(), false);

        KunderaCoreUtils.printQuery(dropQuery.toString(), showQuery);

        cassandra_client.execute_cql3_query(ByteBuffer.wrap(dropQuery.toString().getBytes()), Compression.NONE,
                ConsistencyLevel.ONE);
    }
300918
private void initSchema(final SchemaManager schemaManager, final CoreSession adminSession, final StructrPartition partition) throws Exception {

		final URL url            = SchemaEntityFactory.class.getProtectionDomain().getCodeSource().getLocation();
		final JarFile jarFile    = new JarFile(new File(url.toURI()));
		final List<String> names = new LinkedList<>();

		for (final Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements();) {

			final ZipEntry zipEntry = e.nextElement();
			final String name = zipEntry.getName();

			if (name.startsWith("schema/") && name.endsWith(".ldif")) {

				names.add(name);
			}
		}

		Collections.sort(names, new Comparator<String>() {

			@Override
			public int compare(String o1, String o2) {

				// first sort key: number of slashes (level)
				Integer s1 = StringUtils.countMatches(o1, "/");
				Integer s2 = StringUtils.countMatches(o2, "/");

				if (s1.equals(s2)) {

					// secondary sort key: string length
					Integer l1 = o1.length();
					Integer l2 = o2.length();

					if (l1.equals(l2)) {

						// tertiary sort key: the string values
						return o1.compareTo(o2);
					}

					return l1.compareTo(l2);
				}

				return s1.compareTo(s2);
			}

		});

		for (final String name : names) {

			try (final LdifReader reader = new LdifReader(jarFile.getInputStream(jarFile.getEntry(name)))) {

				for (final LdifEntry entry : reader) {

					final Entry schemaEntry  = new DefaultEntry(schemaManager, entry.getEntry());
					final Dn dn              = schemaEntry.getDn();

					if (!partition.hasEntry(new HasEntryOperationContext(adminSession, dn))) {

						logger.info("Importing {}...", name);
						partition.add(new AddOperationContext(adminSession, schemaEntry));
					}
				}
			}
		}
	}
262397
public void dropTable(Type<?> type) {
        try (Connection connection = getConnection();
             Statement statement = connection.createStatement()) {
            executeDropStatements(statement, Collections.<Type<?>>singletonList(type));
        } catch (SQLException e) {
            throw new TableModificationException(e);
        }
    }
265898
public function dropSchema($name)
    {
        $schema = new Schema($name);
        $this->actions[] =  function () use ($schema) {
             return $this->manipulation->drop($schema);
         };
    }
503012
private function getDroppedTables(Schema $oldSchema, Schema $newSchema)
    {
        $droppedTables = array();

        foreach ($oldSchema->getTables() as $table) {
            if (!$newSchema->hasTable($table->getName())) {
                $droppedTables[] = $table;
            }
        }

        return $droppedTables;
    }
1339422
func (m *InMemApplyer) Drop(s *Schema, v interface{}) error {

	// Find the type of operation being updated.
	switch v := v.(type) {
	case *Table:
		u.Debugf("%p:%s InfoSchema P:%p  dropping table %q from %v", s, s.Name, s.InfoSchema, v.Name, s.Tables())
		// s==v means schema is being dropped
		m.reg.mu.Lock()
		s.mu.Lock()
		s.dropTable(v)
		m.reg.schemas[s.Name] = s
		s.refreshSchemaUnlocked()
		s.mu.Unlock()
		m.reg.mu.Unlock()
	case *Schema:

		u.Debugf("%p:%s InfoSchema P:%p  dropping schema %q s==v?%v", s, s.Name, s.InfoSchema, v.Name, s == v)
		// s==v means schema is being dropped
		m.reg.mu.Lock()
		s.mu.Lock()

		delete(m.reg.schemas, s.Name)
		names := make([]string, 0, len(m.reg.schemaNames))
		for _, n := range m.reg.schemaNames {
			if s.Name != n {
				names = append(names, n)
			}
		}
		m.reg.schemaNames = names

		s.refreshSchemaUnlocked()
		s.mu.Unlock()
		m.reg.mu.Unlock()

	default:
		u.Errorf("invalid type %T", v)
		return fmt.Errorf("Could not find %T", v)
	}

	return nil
}
63996
@NonNull
  public static Drop dropTable(@NonNull String tableName) {
    return dropTable(CqlIdentifier.fromCql(tableName));
  }