Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4c81edc459a89ced66663bd7fa251c7a71120e5e (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
42
43
44
45
46
47
48
49
50
51
52
/**
 * Copyright (c) 2004 - 2011 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:
 *    Eike Stepper - initial API and implementation
 *    Stefan Winkler - 271444: [DB] Multiple refactorings bug 271444
 */
package org.eclipse.emf.cdo.server.db;

import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 * @author Stefan Winkler
 * @since 2.0
 * @noextend This interface is not intended to be extended by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IPreparedStatementCache
{
  public void setConnection(Connection connection);

  public PreparedStatement getPreparedStatement(String sql, ReuseProbability reuseProbability);

  public void releasePreparedStatement(PreparedStatement ps);

  /**
   * An enum for the degree of probability to which a prepared statement is reused later on. This is used for managing
   * the cache of prepared statements so that statements which are more likely reused are kept in the cache longer. Rule
   * of thumb:
   * <ul>
   * <li>For global statements which are used regularly (such as lookup object in cdo_objects) use
   * {@link ReuseProbability#MAX MAX}.
   * <li>For constant object-specific statements which are used regularly use {@link ReuseProbability#HIGH HIGH}.
   * <li>For object-specific statements which are assembled from constants which are used regularly use
   * {@link ReuseProbability#MEDIUM MEDIUM}.
   * <li>For all other dynamic statements, like queries, use {@link ReuseProbability#LOW LOW}
   * </ul>
   * 
   * @author Stefan Winkler
   * @since 2.0
   * @noextend This interface is not intended to be extended by clients.
   */
  public static enum ReuseProbability
  {
    MAX, HIGH, MEDIUM, LOW;
  }
}

Back to the top