Package org.dbunit.dataset.datatype

Examples of org.dbunit.dataset.datatype.IDataTypeFactory


    void setDbType(IDatabaseConnection connection) throws Exception {
        DatabaseConfig dbConfig = connection.getConfig();
        String name = connection.getConnection().getMetaData().getDatabaseProductName().toLowerCase();
        int major = connection.getConnection().getMetaData().getDatabaseMajorVersion();
        IDataTypeFactory type = null;

        if (name.contains("postgres")) {
            type = new PostgresqlDataTypeFactory();
        } else if (name.contains("oracle")) {
            if (major >= 10) {
View Full Code Here


    void setDbType(IDatabaseConnection connection) throws Exception {
        DatabaseConfig dbConfig = connection.getConfig();
        String name = connection.getConnection().getMetaData().getDatabaseProductName().toLowerCase();
        int major = connection.getConnection().getMetaData().getDatabaseMajorVersion();
        IDataTypeFactory type = null;

        if (name.contains("postgres")) {
            type = new PostgresqlDataTypeFactory();
        } else if (name.contains("oracle")) {
            if (major >= 10) {
View Full Code Here

    private void setDbType(IDatabaseConnection connection) throws Exception {
        DatabaseConfig config = connection.getConfig();
        String name = connection.getConnection().getMetaData().getDatabaseProductName().toLowerCase();
        int major = connection.getConnection().getMetaData().getDatabaseMajorVersion();
        IDataTypeFactory type = null;
        if (name.contains("postgres")) {
            type = new org.dbunit.ext.postgresql.PostgresqlDataTypeFactory();
        } else if (name.contains("oracle")) {
            if (major >= 10) {
                type = new org.dbunit.ext.oracle.Oracle10DataTypeFactory();
View Full Code Here

    private void setDatabaseType(IDatabaseConnection connection) throws SQLException {
        DatabaseConfig config = connection.getConfig();
        String name = connection.getConnection().getMetaData().getDatabaseProductName().toLowerCase();
        int major = connection.getConnection().getMetaData().getDatabaseMajorVersion();
        IDataTypeFactory type = null;
        if (name.contains("postgres")) {
            type = new org.dbunit.ext.postgresql.PostgresqlDataTypeFactory();
        } else if (name.contains("oracle")) {
            if (major>=10) {
                type = new org.dbunit.ext.oracle.Oracle10DataTypeFactory();
            } else {
                type = new org.dbunit.ext.oracle.OracleDataTypeFactory();
            }
        }
        if (type!=null) {
            LOG.info("setting db type for dbunit to " + type.getClass().getCanonicalName());
            config.setProperty("http://www.dbunit.org/properties/datatypeFactory",type);
        }
    }
View Full Code Here

        logger.trace("createMetaData(tableName={}, resultSet={}, connection={}) - start",
            new Object[] { tableName, resultSet, connection });

      DatabaseConfig dbConfig = connection.getConfig();
      IMetadataHandler columnFactory = (IMetadataHandler)dbConfig.getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
        IDataTypeFactory typeFactory = super.getDataTypeFactory(connection);
        return createMetaData(tableName, resultSet, typeFactory, columnFactory);
    }
View Full Code Here

                IMetadataHandler metadataHandler = (IMetadataHandler)config.getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
                ResultSet resultSet = metadataHandler.getColumns(databaseMetaData, schemaName, tableName);

                try
                {
                    IDataTypeFactory dataTypeFactory = super.getDataTypeFactory(_connection);
                    boolean datatypeWarning = config.getFeature(
                            DatabaseConfig.FEATURE_DATATYPE_WARNING);

                    List columnList = new ArrayList();
                    while (resultSet.next())
View Full Code Here

                "instance of the datatype factory (for example 'new OracleDataTypeFactory()').";
        }
        // TODO Would a "DatabaseUnitConfigurationException make more sense?
        throw new DatabaseUnitRuntimeException(msg);
    }
        IDataTypeFactory dataTypeFactory = (IDataTypeFactory)factoryObj;
       
      // Validate, e.g. oracle metaData + oracleDataTypeFactory ==> OK
        Connection jdbcConnection = connection.getConnection();
        DatabaseMetaData metaData = jdbcConnection.getMetaData();
      String validationMessage = validateDataTypeFactory(dataTypeFactory, metaData);
View Full Code Here

        // Setup data type factory
        if(this.dataTypeFactory!=null) {
            try
            {
                IDataTypeFactory dataTypeFactory = (IDataTypeFactory)Class.forName(
                        this.dataTypeFactory).newInstance();
                config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
            }
            catch (ClassNotFoundException e)
            {
View Full Code Here

    public static ITableMetaData createMetaData(String tableName,
            ResultSet resultSet, IDatabaseConnection connection)
            throws SQLException, DataSetException
    {
        DatabaseConfig config = connection.getConfig();
        IDataTypeFactory typeFactory = (IDataTypeFactory)config.getProperty(
                DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
        return createMetaData(tableName, resultSet, typeFactory);
    }
View Full Code Here

                        null, schemaName, tableName, "%");

                try
                {
                    DatabaseConfig config = _connection.getConfig();
                    IDataTypeFactory dataTypeFactory = (IDataTypeFactory)config.getProperty(
                            DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
                    boolean datatypeWarning = config.getFeature(
                            DatabaseConfig.FEATURE_DATATYPE_WARNING);

                    List columnList = new ArrayList();
                    while (resultSet.next())
                    {
                        String columnName = resultSet.getString(4);
                        int sqlType = resultSet.getInt(5);
                        String sqlTypeName = resultSet.getString(6);
//                        int columnSize = resultSet.getInt(7);
                        int nullable = resultSet.getInt(11);

                        // Convert SQL type to DataType
                        DataType dataType =
                                dataTypeFactory.createDataType(sqlType, sqlTypeName);
                        if (dataType != DataType.UNKNOWN)
                        {
                            Column column = new Column(columnName, dataType,
                                    sqlTypeName, Column.nullableValue(nullable));
                            columnList.add(column);
View Full Code Here

TOP

Related Classes of org.dbunit.dataset.datatype.IDataTypeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.