blob: eea146c0dc4ccfd1a79abc05c416a1b47303bed7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.framework.server.admin.search;
import java.sql.DatabaseMetaData;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.SupportedDatabase;
import org.eclipse.osee.framework.server.admin.BaseServerCommand;
/**
* @author Roberto E. Escobar
*/
class TaggerDropAllWorker extends BaseServerCommand {
private static final String TRUNCATE_SQL = "TRUNCATE TABLE osee_search_tags";
private static final String DELETE_TABLE_SQL = "DELETE FROM osee_search_tags";
protected TaggerDropAllWorker() {
super("Drop All Search Tags");
}
@Override
protected void doCommandWork(IProgressMonitor monitor) throws Exception {
String deleteSql = null;
DatabaseMetaData metaData = ConnectionHandler.getMetaData();
if (SupportedDatabase.isDatabaseType(metaData, SupportedDatabase.derby)) {
deleteSql = DELETE_TABLE_SQL;
} else {
deleteSql = TRUNCATE_SQL;
}
ConnectionHandler.runPreparedUpdate(deleteSql);
}
}
|