Java SQL Type deleteFromAllTables(Connection con)

Here you can find the source of deleteFromAllTables(Connection con)

Description

delete From All Tables

License

Open Source License

Declaration

private static void deleteFromAllTables(Connection con)
            throws SQLException 

Method Source Code

//package com.java2s;
/*//from  w w w .  j a  v  a2 s  . c o m
 * Artifactory is a binaries repository manager.
 * Copyright (C) 2013 JFrog Ltd.
 *
 * Artifactory is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Artifactory is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Artifactory.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.sql.Connection;

import java.sql.SQLException;
import java.sql.Statement;

public class Main {
    /**
     * A list of all the tables in the database
     */
    public static String[] tables = new String[] { "db_properties",
            "artifactory_servers", "stats_remote", "stats", "watches",
            "node_props", "node_meta_infos", "nodes",
            "indexed_archives_entries", "archive_names", "archive_paths",
            "indexed_archives", "binary_blobs", "binaries", "aces", "acls",
            "users_groups", "groups", "user_props", "users",
            "permission_target_repos", "permission_targets", "configs",
            "tasks", "module_props", "build_props", "build_jsons",
            "build_promotions", "build_dependencies", "build_artifacts",
            "build_modules", "builds", "unique_ids" };

    private static void deleteFromAllTables(Connection con)
            throws SQLException {
        for (String table : tables) {
            try (Statement statement = con.createStatement()) {
                statement.execute("DELETE FROM " + table);
            }
        }
    }
}

Related

  1. createSqlDataType(@Nonnull final String javaDataType)
  2. createTable2()
  3. createTestData()
  4. decodeJavaType(Object pType)
  5. deleteData(Connection conn)
  6. deserializeSQLTypesToJava(String sqltypename, String value)
  7. dumpTypes(Connection pConnection)
  8. extractConstant(String typeName)
  9. fillLogParams(String sql, Map logParams)