AnyLogic
Expand
Font size

public class UtilitiesDatabase
extends Object

Constructor Summary

ConstructorDescription
UtilitiesDatabase() 

Method Summary

Modifier and TypeMethodDescription
static voidcopyDatabaseTable(Connection sourceConnection, Connection targetConnection, String sourceTableName, String targetTableName) 
static voidcopyDatabaseTable(Connection sourceConnection, Connection targetConnection, String sourceTableName, String targetTableName, boolean clearTargetTable, boolean autoCommit) 
static voidcopyDatabaseTables(ProgressConsumer monitor, Connection sourceConnection, Connection targetConnection, List<String> sourceTableNames, List<String> targetTableNames, boolean clearTargetTable, boolean autoCommit) 
static voidexportTables(ProgressConsumer monitor, Connection sourceDatabase, Connection targetDatabase, Collection<String> sqlStatements, List<String> sourceNames) 
static StringgetIdentifierQuoteString(Connection connection) 
static booleanisInt(double value)
Determines whether provided double value is integer or not.
static booleanisMariaDb(Connection connection) 
static booleanisMicrosoftAccess(Connection connection) 
static booleanisOracleDB(Connection connection) 
static booleanlogIfNeeded(Utilities agent, LoggingType loggingType, boolean staticEntry, Supplier<ILogEntry> logEntrySupplier)
Logs information to database
static booleanlogIfNeeded(Utilities agent, LoggingType loggingType, Supplier<ILogEntry> logEntrySupplier)
Logs information to database
static StringtoStringDB(Object value) 
static StringtrimTableName(String s) 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

UtilitiesDatabase

public UtilitiesDatabase()

Method Details

getIdentifierQuoteString

@AnyLogicInternalAPI
public static String getIdentifierQuoteString(Connection connection)

exportTables

@AnyLogicInternalAPI
public static void exportTables(ProgressConsumer monitor,
 Connection sourceDatabase,
 Connection targetDatabase,
 Collection<String> sqlStatements,
 List<String> sourceNames)

trimTableName

@AnyLogicInternalAPI
public static String trimTableName(String s)

copyDatabaseTables

@AnyLogicInternalAPI
public static void copyDatabaseTables(ProgressConsumer monitor,
 Connection sourceConnection,
 Connection targetConnection,
 List<String> sourceTableNames,
 List<String> targetTableNames,
 boolean clearTargetTable,
 boolean autoCommit)

copyDatabaseTable

@AnyLogicInternalAPI
public static void copyDatabaseTable(Connection sourceConnection,
 Connection targetConnection,
 String sourceTableName,
 String targetTableName)

copyDatabaseTable

@AnyLogicInternalAPI
public static void copyDatabaseTable(Connection sourceConnection,
 Connection targetConnection,
 String sourceTableName,
 String targetTableName,
 boolean clearTargetTable,
 boolean autoCommit)
                              throws SQLException
Throws:
SQLException

isInt

@AnyLogicInternalAPI
public static boolean isInt(double value)
Determines whether provided double value is integer or not. The method is implemented for importing Excel data which can already have rounding errors because of chosen cell type (e.g. 'General' for numeric data instead of 'Number'). That is why no comparison with epsilon is used.
Parameters:
value - floating point-number
Returns:
true if value is integer, false if double

logIfNeeded

@AnyLogicInternalAPI
public static boolean logIfNeeded(Utilities agent,
 LoggingType loggingType,
 Supplier<ILogEntry> logEntrySupplier)
Logs information to database
Returns:
true if log entry has been created and processed, false e.g. if logging settings don't allow logging

logIfNeeded

@AnyLogicInternalAPI
public static boolean logIfNeeded(Utilities agent,
 LoggingType loggingType,
 boolean staticEntry,
 Supplier<ILogEntry> logEntrySupplier)
Logs information to database
Parameters:
loggingType - type of logging
staticEntry - true if the log entry doesn't depend on a particular object instance (some structural entry, e.g. Agent type name)
Returns:
true if log entry has been created and processed, false e.g. if logging settings don't allow logging

toStringDB

public static String toStringDB(Object value)

isMicrosoftAccess

public static boolean isMicrosoftAccess(Connection connection)
                                 throws SQLException
Throws:
SQLException

isOracleDB

public static boolean isOracleDB(Connection connection)
                          throws SQLException
Throws:
SQLException

isMariaDb

public static boolean isMariaDb(Connection connection)
                         throws SQLException
Throws:
SQLException