Search in sources :

Example 31 with Database

use of liquibase.database.Database in project liquibase by liquibase.

the class MySQLDatabaseTest method escapeTableName_withSchema.

@Override
@Test
public void escapeTableName_withSchema() {
    Database database = getDatabase();
    assertEquals("catalogName.tableName", database.escapeTableName("catalogName", "schemaName", "tableName"));
}
Also used : Database(liquibase.database.Database) AbstractJdbcDatabaseTest(liquibase.database.AbstractJdbcDatabaseTest) Test(org.junit.Test)

Example 32 with Database

use of liquibase.database.Database in project liquibase by liquibase.

the class MySQLDatabaseTest method testGetDefaultDriver.

public void testGetDefaultDriver() {
    Database database = new MySQLDatabase();
    assertEquals("com.mysql.jdbc.Driver", database.getDefaultDriver("jdbc:mysql://localhost/liquibase"));
    assertNull(database.getDefaultDriver("jdbc:db2://localhost;databaseName=liquibase"));
}
Also used : Database(liquibase.database.Database)

Example 33 with Database

use of liquibase.database.Database in project liquibase by liquibase.

the class DB2DatabaseTest method testGetDefaultDriver.

public void testGetDefaultDriver() {
    Database database = new DB2Database();
    assertEquals("com.ibm.db2.jcc.DB2Driver", database.getDefaultDriver("jdbc:db2://localhost:50000/liquibas"));
    assertNull(database.getDefaultDriver("jdbc:oracle://localhost;databaseName=liquibase"));
}
Also used : Database(liquibase.database.Database)

Example 34 with Database

use of liquibase.database.Database in project liquibase by liquibase.

the class PostgresDatabaseTest method escapeTableName_withSchema.

@Override
@Test
public void escapeTableName_withSchema() {
    Database database = getDatabase();
    assertEquals("\"schemaName\".\"tableName\"", database.escapeTableName("catalogName", "schemaName", "tableName"));
}
Also used : Database(liquibase.database.Database) AbstractJdbcDatabaseTest(liquibase.database.AbstractJdbcDatabaseTest) Test(org.junit.Test)

Example 35 with Database

use of liquibase.database.Database in project liquibase by liquibase.

the class PostgresDatabaseTest method escapeTableName_all.

@Test
public void escapeTableName_all() {
    Database database = getDatabase();
    database.setObjectQuotingStrategy(ObjectQuotingStrategy.QUOTE_ALL_OBJECTS);
    assertEquals("\"tbl\"", database.escapeTableName(null, null, "tbl"));
    assertEquals("\"user\"", database.escapeTableName(null, null, "user"));
}
Also used : Database(liquibase.database.Database) AbstractJdbcDatabaseTest(liquibase.database.AbstractJdbcDatabaseTest) Test(org.junit.Test)

Aggregations

Database (liquibase.database.Database)147 Test (org.junit.Test)74 MSSQLDatabase (liquibase.database.core.MSSQLDatabase)50 SQLiteDatabase (liquibase.database.core.SQLiteDatabase)43 Sql (liquibase.sql.Sql)42 DB2Database (liquibase.database.core.DB2Database)41 OracleDatabase (liquibase.database.core.OracleDatabase)39 PostgresDatabase (liquibase.database.core.PostgresDatabase)37 AbstractSqlGeneratorTest (liquibase.sqlgenerator.AbstractSqlGeneratorTest)36 MySQLDatabase (liquibase.database.core.MySQLDatabase)35 DerbyDatabase (liquibase.database.core.DerbyDatabase)33 H2Database (liquibase.database.core.H2Database)33 HsqlDatabase (liquibase.database.core.HsqlDatabase)33 SybaseASADatabase (liquibase.database.core.SybaseASADatabase)33 SybaseDatabase (liquibase.database.core.SybaseDatabase)33 CreateTableStatement (liquibase.statement.core.CreateTableStatement)33 AutoIncrementConstraint (liquibase.statement.AutoIncrementConstraint)30 DatabaseException (liquibase.exception.DatabaseException)25 AbstractJdbcDatabaseTest (liquibase.database.AbstractJdbcDatabaseTest)21 UnexpectedLiquibaseException (liquibase.exception.UnexpectedLiquibaseException)17