org.eclipse.emf.cdo.server.db
Class CDODBUtil

java.lang.Object
  extended by org.eclipse.emf.cdo.server.db.CDODBUtil

public final class CDODBUtil
extends java.lang.Object


Field Summary
static int DEFAULT_STATEMENT_CACHE_CAPACITY
           
static java.lang.String EXT_POINT_MAPPING_STRATEGIES
           
 
Method Summary
static IMappingStrategy createHorizontalMappingStrategy(boolean auditing)
           
static IMappingStrategy createMappingStrategy(java.lang.String type)
          Can only be used when Eclipse is running.
static IPreparedStatementCache createStatementCache()
          Creates a prepared statement cache with the default capacity.
static IPreparedStatementCache createStatementCache(int capacity)
          Creates a prepared statement cache with the given capacity.
static IDBStore createStore(IMappingStrategy mappingStrategy, org.eclipse.net4j.db.IDBAdapter dbAdapter, org.eclipse.net4j.db.IDBConnectionProvider dbConnectionProvider)
           
static long getLong(CDOID id)
          Get the long value of a CDOID (by delegating to CDOIDUtil.getLong(org.eclipse.emf.cdo.common.id.CDOID)) In addition, provide a check for external IDs which are not supported by the DBStore
static void sqlDump(java.sql.Connection conn, java.lang.String sql)
          Deprecated. Should only be used when debugging.
static void sqlDump(org.eclipse.net4j.db.IDBConnectionProvider connectionProvider, java.lang.String sql)
          Deprecated. Should only be used when debugging.
static int sqlUpdate(java.sql.PreparedStatement stmt, boolean exactlyOne)
          Execute update on the given prepared statement and handle common cases of return values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STATEMENT_CACHE_CAPACITY

public static final int DEFAULT_STATEMENT_CACHE_CAPACITY
Since:
2.0
See Also:
Constant Field Values

EXT_POINT_MAPPING_STRATEGIES

public static final java.lang.String EXT_POINT_MAPPING_STRATEGIES
Since:
2.0
See Also:
Constant Field Values
Method Detail

createStore

public static IDBStore createStore(IMappingStrategy mappingStrategy,
                                   org.eclipse.net4j.db.IDBAdapter dbAdapter,
                                   org.eclipse.net4j.db.IDBConnectionProvider dbConnectionProvider)
Since:
2.0

createHorizontalMappingStrategy

public static IMappingStrategy createHorizontalMappingStrategy(boolean auditing)
Since:
2.0

createMappingStrategy

public static IMappingStrategy createMappingStrategy(java.lang.String type)
Can only be used when Eclipse is running. In standalone scenarios create the mapping strategy instance by directly calling the constructor of the mapping strategy class.

Since:
2.0
See Also:
#createHorizontalMappingStrategy()

getLong

public static long getLong(CDOID id)
Get the long value of a CDOID (by delegating to CDOIDUtil.getLong(org.eclipse.emf.cdo.common.id.CDOID)) In addition, provide a check for external IDs which are not supported by the DBStore

Parameters:
id - the ID to convert to long
Returns:
the long value of the ID
Throws:
java.lang.IllegalArgumentException - if the ID is not convertibla
Since:
2.0

sqlUpdate

public static int sqlUpdate(java.sql.PreparedStatement stmt,
                            boolean exactlyOne)
                     throws java.sql.SQLException
Execute update on the given prepared statement and handle common cases of return values.

Parameters:
stmt - the prepared statement
exactlyOne - if true, the update count is checked to be 1. Else the update result is only checked so that the update was successful (i.e. result code != Statement.EXECUTE_FAILED).
Returns:
the update count / execution result as returned by PreparedStatement.executeUpdate(). Can be used by the caller to perform more advanced checks.
Throws:
java.sql.SQLException - if PreparedStatement.executeUpdate() throws it.
java.lang.IllegalStateException - if the check indicated by excatlyOne indicates an error.
Since:
2.0

sqlDump

@Deprecated
public static void sqlDump(java.sql.Connection conn,
                                      java.lang.String sql)
Deprecated. Should only be used when debugging.

For debugging purposes ONLY!

Since:
2.0

sqlDump

@Deprecated
public static void sqlDump(org.eclipse.net4j.db.IDBConnectionProvider connectionProvider,
                                      java.lang.String sql)
Deprecated. Should only be used when debugging.

For debugging purposes ONLY!

Since:
2.0

createStatementCache

public static IPreparedStatementCache createStatementCache()
Creates a prepared statement cache with the default capacity.

Since:
2.0
See Also:
createStatementCache(int)

createStatementCache

public static IPreparedStatementCache createStatementCache(int capacity)
Creates a prepared statement cache with the given capacity.

Since:
2.0

Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
All Rights Reserved.