blob: 3f00f31c400d4552f603dc8b5e4920c37e629394 (
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
|
/***************************************************************************
* Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
* 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:
* Andre Dietisheim - initial API and implementation
* Eike Stepper - maintenance
**************************************************************************/
package org.eclipse.emf.cdo.common.internal.db;
import org.eclipse.emf.cdo.common.internal.db.bundle.OM;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* @author Andre Dietisheim
*/
public abstract class AbstractDBAccessor
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, AbstractDBAccessor.class);
protected PreparedStatement getPreparedStatement(Connection connection) throws Exception
{
PreparedStatement preparedStatement = connection.prepareStatement(getSQL());
setParameters(preparedStatement);
TRACER.trace(getSQL());
return preparedStatement;
}
protected abstract String getSQL();
protected abstract void setParameters(PreparedStatement statement) throws SQLException, Exception;
}
|