Package nz.co.gregs.dbvolution.databases
Class MySQLDB_5_7
- java.lang.Object
-
- nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
-
- nz.co.gregs.dbvolution.databases.MySQLDB_5_7
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Cloneable
,DBDatabase
,SupportsPolygonDatatype
public class MySQLDB_5_7 extends DBDatabaseImplementation implements SupportsPolygonDatatype
A DBDatabase tweaked for MySQL databases- Author:
- Gregory Graham
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
DBDatabaseImplementation.ResponseToException, DBDatabaseImplementation.RunRegularProcessors
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
static String
MYSQLDRIVERNAME
-
Fields inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
storedConnection
-
-
Constructor Summary
Constructors Constructor Description MySQLDB_5_7(String server, long port, String databaseName, String username, String password)
Creates DBDatabase suitable for use with MySQL attached to the supplied JDBC URL, username, and password.MySQLDB_5_7(String jdbcURL, String username, String password)
Creates DBDatabase suitable for use with MySQL attached to the supplied JDBC URL, username, and password.MySQLDB_5_7(DataSource ds)
Creates aDBDatabase
instance for the data source.MySQLDB_5_7(DatabaseConnectionSettings dcs)
Creates aDBDatabase
instance for the data source.MySQLDB_5_7(MySQL_5_7SettingsBuilder ds)
Creates aDBDatabase
instance for the data source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDatabaseSpecificFeatures(Statement statement)
Used By Subclasses To Inject Datatypes, Functions, Etc Into the Database.DBDatabaseImplementation.ResponseToException
addFeatureToFixException(Exception exp, QueryIntention intent, StatementDetails details)
Used to add features in a just-in-time manner.DBDatabase
clone()
Clones the DBDatabase.Integer
getDefaultPort()
Returns the port number usually assign to instances of this database.MySQL_5_7SettingsBuilder
getURLInterpreter()
-
Methods inherited from interface nz.co.gregs.dbvolution.databases.DBDatabase
getCount, getDBMigration, getRows, print, test
-
Methods inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
addRegularProcess, backupToDBDatabase, batchSQLStatementsWhenPossible, checkMetaDataForTable, checkTableExistsViaQuery, close, commitTransaction, copy, createForeignKeyConstraints, createIndexesOnAllFields, createOrUpdateTable, createTable, createTable, createTableNoExceptions, createTableNoExceptions, createTablesNoExceptions, createTablesNoExceptions, createTablesWithForeignKeysNoExceptions, createTableWithForeignKeys, delete, delete, deleteAllRowsFromTable, discardConnection, doReadOnlyTransaction, doTransaction, doTransaction, doTransactionWithoutCompleting, dropDatabase, dropDatabase, dropTable, dropTableIfExists, dropTableNoExceptions, equals, executeDBAction, executeDBQuery, get, get, get, get, get, getAllRows, getBaseDBDatabaseClass, getBatchSQLStatementsWhenPossible, getByExample, getByExample, getByExamples, getConnection, getConnectionFromDriverManager, getCount, getCurrentInstant, getCurrentLocalDatetime, getDatabaseInstance, getDatabaseName, getDatabaseSpecificDBConnection, getDataSource, getDBDatabaseMetaData, getDBQuery, getDBQuery, getDBQuery, getDBQuery, getDBQueryInsert, getDBRecursiveQuery, getDBStatement, getDBTable, getDBTransactionStatement, getDefinition, getDriverName, getExtras, getHost, getJdbcURL, getLabel, getLastException, getLowLevelStatement, getPassword, getPort, getPreventAccidentalDroppingOfDatabases, getPreventAccidentalDroppingOfTables, getPrintSQLBeforeExecuting, getQuietExceptionsPreference, getRegularProcessors, getRegularThreadPool, getSchema, getSettings, getSettingsFromJDBCURL, getSQLForDBQuery, getUrlFromSettings, getUsername, handleErrorDuringExecutingSQL, hasCreatedRequiredTables, hashCode, implement, initDatabase, insert, insert, insert, insertOrUpdate, insertOrUpdate, isDBDatabaseCluster, isMemoryDatabase, isPrintSQLBeforeExecuting, preventAccidentalDDLDuringTransaction, preventAccidentalDeletingAllRowsFromTable, preventAccidentalDroppingOfDatabases, preventAccidentalDroppingOfTables, preventDroppingOfDatabases, preventDroppingOfTables, printSQLIfRequested, printSQLIfRequested, removeForeignKeyConstraints, removeRegularProcess, requiredToProduceEmptyStringForNull, rollbackTransaction, save, save, save, setBatchSQLStatementsWhenPossible, setDatabaseName, setDefinition, setDefinitionBasedOnConnectionMetaData, setDriverName, setHasCreatedRequiredTables, setJdbcURL, setLabel, setLastException, setPassword, setPreventAccidentalDeletingAllRowsFromTable, setPrintSQLBeforeExecuting, setQuietExceptionsPreference, setSettings, setUsername, startServerIfRequired, stop, supportsDifferenceBetweenNullAndEmptyString, supportsGeometryTypesFullyInSchema, supportsMicrosecondPrecision, supportsNanosecondPrecision, supportsPolygonDatatype, supportsPooledConnections, tableExists, tableExists, toString, unusedConnection, update, update, updateTableToMatchDBRow, willCreateBlankQuery
-
-
-
-
Field Detail
-
MYSQLDRIVERNAME
public static final String MYSQLDRIVERNAME
- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MySQLDB_5_7
public MySQLDB_5_7(DataSource ds) throws SQLException
Creates aDBDatabase
instance for the data source.- Parameters:
ds
- ds- Throws:
SQLException
- database errors
-
MySQLDB_5_7
public MySQLDB_5_7(MySQL_5_7SettingsBuilder ds) throws SQLException
Creates aDBDatabase
instance for the data source.- Parameters:
ds
- ds- Throws:
SQLException
- database errors
-
MySQLDB_5_7
public MySQLDB_5_7(DatabaseConnectionSettings dcs) throws SQLException
Creates aDBDatabase
instance for the data source.- Parameters:
dcs
- the settings required to connect to the database- Throws:
SQLException
- database errors
-
MySQLDB_5_7
public MySQLDB_5_7(String jdbcURL, String username, String password) throws SQLException
Creates DBDatabase suitable for use with MySQL attached to the supplied JDBC URL, username, and password.- Parameters:
jdbcURL
- jdbcURLpassword
- passwordusername
- username- Throws:
SQLException
- database errors
-
MySQLDB_5_7
public MySQLDB_5_7(String server, long port, String databaseName, String username, String password) throws SQLException
Creates DBDatabase suitable for use with MySQL attached to the supplied JDBC URL, username, and password.- Parameters:
server
- the server to connect to.port
- the port to connect on.databaseName
- the database that is required on the server.username
- the user to login as.password
- the password required to login successfully.- Throws:
SQLException
- database errors
-
-
Method Detail
-
clone
public DBDatabase clone() throws CloneNotSupportedException
Description copied from class:DBDatabaseImplementation
Clones the DBDatabase.- Specified by:
clone
in interfaceDBDatabase
- Overrides:
clone
in classDBDatabaseImplementation
- Returns:
- a clone of the DBDatabase.
- Throws:
CloneNotSupportedException
- not likely
-
addDatabaseSpecificFeatures
public void addDatabaseSpecificFeatures(Statement statement) throws ExceptionDuringDatabaseFeatureSetup
Description copied from interface:DBDatabase
Used By Subclasses To Inject Datatypes, Functions, Etc Into the Database.- Specified by:
addDatabaseSpecificFeatures
in interfaceDBDatabase
- Parameters:
statement
- the statement to use when adding features, DO NOT CLOSE THIS STATEMENT.- Throws:
ExceptionDuringDatabaseFeatureSetup
- database exceptions may occur- See Also:
PostgresDB
,H2DB
,SQLiteDB
,OracleDB
,MSSQLServerDB
,MySQLDB
-
getDefaultPort
public Integer getDefaultPort()
Description copied from class:DBDatabaseImplementation
Returns the port number usually assign to instances of this database.There is no guarantee that the particular database instance uses this port, check with your DBA.
- Specified by:
getDefaultPort
in interfaceDBDatabase
- Specified by:
getDefaultPort
in classDBDatabaseImplementation
- Returns:
- the usual database port number
-
addFeatureToFixException
public DBDatabaseImplementation.ResponseToException addFeatureToFixException(Exception exp, QueryIntention intent, StatementDetails details) throws Exception
Description copied from class:DBDatabaseImplementation
Used to add features in a just-in-time manner.During a statement the database may throw an exception because a feature has not yet been added. Use this method to parse the exception and install the required feature.
The statement will be automatically run after this method exits.
- Specified by:
addFeatureToFixException
in interfaceDBDatabase
- Overrides:
addFeatureToFixException
in classDBDatabaseImplementation
- Parameters:
exp
- the exception throw by the database that may need fixingintent
- the intention of the query or DDL when the exception was throwndetails
- the details of the attempted execution- Returns:
- the preferred response to the exception
- Throws:
SQLException
- accessing the database may cause exceptionsException
-
getURLInterpreter
public MySQL_5_7SettingsBuilder getURLInterpreter()
- Specified by:
getURLInterpreter
in interfaceDBDatabase
-
-