当前位置: 首页>>代码示例>>Java>>正文


Java SqlStatement类代码示例

本文整理汇总了Java中liquibase.statement.SqlStatement的典型用法代码示例。如果您正苦于以下问题:Java SqlStatement类的具体用法?Java SqlStatement怎么用?Java SqlStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SqlStatement类属于liquibase.statement包,在下文中一共展示了SqlStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertContainers

import liquibase.statement.SqlStatement; //导入依赖的package包/类
public List<SqlStatement> insertContainers(List<Long> containers, Database database)
{
	final List<SqlStatement> output;
	InsertStatement currentSqlStatement;
	output = new ArrayList<SqlStatement>();
	
	for (Long id : containers)
	{
		currentSqlStatement =
		SQLStatementHelper.getDefaultInsertStatement(database, "multiple_choice_exercise_container");
		currentSqlStatement.addColumnValue("id", id);
		currentSqlStatement.addColumnValue("name", String.valueOf(id));
		output.add(currentSqlStatement);
	}
	return output;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:17,代码来源:MultipleChoiceExerciseContainerLoader.java

示例2: resourceInsert

import liquibase.statement.SqlStatement; //导入依赖的package包/类
private List<SqlStatement> resourceInsert( String resourcePath, Database database)
	{
		final List <SqlStatement> sqlStatements;
		final String tableName;
		final InsertStatement insertStatement;
		final String contentType;
		//resourcePath = ResourceHelper.getResourceAddress(isFromGameResourceInput() ,getSetPath(), resourcePath.substring(1));
		tableName= "image_resource";
		contentType = getContentType(resourcePath);
		sqlStatements = new ArrayList <SqlStatement>();
		insertStatement =SQLStatementHelper.getDefaultInsertStatement(database, tableName); 
		insertStatement.addColumnValue("name", resourcePath);
		insertStatement.addColumnValue("hi_res_image_content_type", contentType);
		insertStatement.addColumnValue("hi_res_image_path", resourcePath);
		insertStatement.addColumnValue("lo_res_image_content_type", contentType);
		insertStatement.addColumnValue("lo_res_image_path", resourcePath);
		sqlStatements.add(insertStatement);
		return sqlStatements; 
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:20,代码来源:MultipleChoiceImageLoader.java

示例3: execute

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public void execute(Database arg0) throws CustomChangeException {
	log.info(this.getClass() + " is being executed");
	final List<String> list;
	final List<SqlStatement> transactions;
	list =getMultipleChoiceImageResources();

	Map<String, String> inputOuputImagesMap = inputToOutput(list);
		
	transactions = new ArrayList<SqlStatement>();
	Iterator<Entry<String, String>> it = inputOuputImagesMap.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String,String> pair = it.next();
        it.remove(); // avoids a ConcurrentModificationException
		transactions.addAll(resourceInsert(pair.getValue(),arg0));
        
    }
		SQLStatementHelper.defaultDirtyExecuteAndCommit(arg0, transactions, log);
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:20,代码来源:MultipleChoiceImageLoader.java

示例4: execute

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public void execute(Database arg0) throws CustomChangeException {
	log.info(String.format("%s is being executed", this.getClass().getName()));
	final ArrayList<SqlStatement> sqlStatements;
	final ArrayList<Map<String,String>>  records;  
	InsertStatement insertStatement;
	sqlStatements = new ArrayList<SqlStatement>();
	records = ParserHelper.parse(isFromGameResourceInput(), getGamePath(), getSetPath(), getFileName());
	for (Map<String,String> element : records){
		FieldValidationHelper.testValidationUpperLimit(element.get("Temática"), "Temática", 100, log);
		insertStatement =SQLStatementHelper.getDefaultInsertStatement(arg0, "multiple_choice_subject");
		insertStatement.addColumnValue("text", FieldValidationHelper.getSubString(element.get("Temática"), 100));
		sqlStatements.add(insertStatement);
	}
	SQLStatementHelper.defaultDirtyExecuteAndCommit(arg0, sqlStatements, log);
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:17,代码来源:MultipleChoiceSubjectLoader.java

示例5: execute

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public void execute(Database arg0) throws CustomChangeException {
	log.info(String.format("%s is being executed", this.getClass().getName()));
	final ArrayList<SqlStatement> sqlStatements;
	final ArrayList<Map<String,String>>  records;  
	RawSqlStatement rawSqlStatement;
	sqlStatements = new ArrayList<SqlStatement>();
	records = ParserHelper.parse(isFromGameResourceInput(), getGamePath(), getSetPath(), getFileName());
	for (Map<String,String> element : records){
		if (FieldValidationHelper.isLengthLowerLimitValid(element.get("Tema específico"),1))
		{
		FieldValidationHelper.testValidationUpperLimit(element.get("Tema específico"), "Temas específicos", 100, log);
		rawSqlStatement = SQLStatementHelper.getRawSqlStatementSelect(log, arg0, "multiple_choice_subject_specific", "multiple_choice_subject", 
				String.format("text =\'%s\' and ((select count(1) as c from multiple_choice_subject_specific ss inner join multiple_choice_subject s on (s.id= ss.multiple_choice_subject_id) where s.text= \'%s\' and ss.text =\'%s\') =0) ", FieldValidationHelper.getSubString(element.get("Temática"), 100), FieldValidationHelper.getSubString(element.get("Temática"), 100),FieldValidationHelper.getSubString(element.get("Tema específico"), 100)  ),
				"text", 
				 "multiple_choice_subject_id", 
				 String.format("\'%s\'",FieldValidationHelper.getSubString(element.get("Tema específico"), 100)), 
				 "id");
		sqlStatements.add(rawSqlStatement);
		}
		}
	SQLStatementHelper.defaultDirtyExecuteAndCommit(arg0, sqlStatements, log);
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:24,代码来源:MultipleChoiceSubjectSpecificLoader.java

示例6: execute

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public void execute(Database arg0) throws CustomChangeException {
	// TODO Auto-generated method stub
	// TODO Auto-generated method stub
	log.info(this.getClass().getName());
	ArrayList<SqlStatement> sqlStatements = new ArrayList<SqlStatement>();
	HashSet<Integer> records = parse();
	
	for (Integer exerciseId : records){
				InsertStatement insertStatement =new InsertStatement(arg0.getDefaultSchema().getCatalogName(), arg0.getDefaultSchema().getSchemaName(), "hang_man_game_container"); 
				insertStatement.addColumnValue("id", exerciseId);
				insertStatement.addColumnValue("name", exerciseId.toString());
				
				sqlStatements.add(insertStatement);
	}
	SQLStatementHelper.defaultExecuteAndCommit(arg0, sqlStatements, log);
	
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:19,代码来源:HangManGameContainerLoader.java

示例7: update

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public int update(SqlStatement sql) throws DatabaseException
{
	if (sql instanceof LockDatabaseChangeLogStatement)
	{
		return 1;
	}
	else if (sql instanceof UnlockDatabaseChangeLogStatement)
	{
		return 1;
	}

	suppressSqlStatement(sql);

	return 0;
}
 
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:17,代码来源:SuppressOutputExecutor.java

示例8: generateStatements

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public SqlStatement[] generateStatements(final Database database)
{
	validateParameters();

	final Executor currentExecutor = ExecutorService.getInstance().getExecutor(database);

	if (startOrStop == START_OR_STOP.START)
	{
		startSuppressing(database, currentExecutor);
	}
	else if (startOrStop == START_OR_STOP.STOP)
	{
		stopSuppressing(database, currentExecutor);
	}
	else
	{
		throw new IllegalArgumentException("Unknown startOrStop value " + startOrStop.name());
	}

	return new SqlStatement[] {};
}
 
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:23,代码来源:SuppressOutputChange.java

示例9: generateRollbackStatements

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public SqlStatement[] generateRollbackStatements(final Database database) throws RollbackImpossibleException
{
	validateParameters();

	final Executor currentExecutor = ExecutorService.getInstance().getExecutor(database);

	if (startOrStop == START_OR_STOP.START)
	{
		stopSuppressing(database, currentExecutor);
	}
	else if (startOrStop == START_OR_STOP.STOP)
	{
		startSuppressing(database, currentExecutor);
	}
	else
	{
		throw new IllegalArgumentException("Unknown startOrStop value " + startOrStop.name());
	}

	return new SqlStatement[] {};
}
 
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:23,代码来源:SuppressOutputChange.java

示例10: validate

import liquibase.statement.SqlStatement; //导入依赖的package包/类
public ValidationErrors validate(Database database) {
    ValidationErrors changeValidationErrors = new ValidationErrors();
    for (SqlStatement statement : generateStatements(database)) {
        boolean supported = SqlGeneratorFactory.getInstance().supports(statement, database);
        if (!supported) {
            if (statement.skipOnUnsupported()) {
                LogFactory.getLogger().info(getChangeMetaData().getName()+" is not supported on "+database.getTypeName()+" but will continue");
            } else {
                changeValidationErrors.addError(getChangeMetaData().getName()+" is not supported on "+database.getTypeName());
            }
        } else {
            changeValidationErrors.addAll(SqlGeneratorFactory.getInstance().validate(statement, database));
        }
    }

    return changeValidationErrors;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:AbstractChange.java

示例11: checkType

import liquibase.statement.SqlStatement; //导入依赖的package包/类
private void checkType(Type type, SqlStatement statement, SqlGenerator generator, Database database, SortedSet<SqlGenerator> validGenerators) {
    for (Type typeClass : ((ParameterizedType) type).getActualTypeArguments()) {
        if (typeClass instanceof TypeVariable) {
            typeClass = ((TypeVariable) typeClass).getBounds()[0];
        }
    
        if (isTypeEqual( typeClass, SqlStatement.class)) {
            return;
        }
        
        if (((Class) typeClass).isAssignableFrom(statement.getClass())) {
            if (generator.supports(statement, database)) {
                validGenerators.add(generator);
            }
        }
    }

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:SqlGeneratorFactory.java

示例12: getAffectedDatabaseObjects

import liquibase.statement.SqlStatement; //导入依赖的package包/类
public Set<DatabaseObject> getAffectedDatabaseObjects(SqlStatement statement, Database database) {
    Set<DatabaseObject> affectedObjects = new HashSet<DatabaseObject>();

    SqlGeneratorChain sqlGeneratorChain = createGeneratorChain(statement, database);
    if (sqlGeneratorChain != null) {
        //noinspection unchecked
        Sql[] sqls = sqlGeneratorChain.generateSql(statement, database);
        if (sqls != null) {
            for (Sql sql : sqls) {
                affectedObjects.addAll(sql.getAffectedDatabaseObjects());
            }
        }
    }

    return affectedObjects;

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:SqlGeneratorFactory.java

示例13: generateStatements

import liquibase.statement.SqlStatement; //导入依赖的package包/类
/**
 * Generates a {@link DropSpatialIndexStatement} followed by a {@link DropIndexStatement}, if
 * applicable. The first statement allows extra clean-up when dropping an index. The second
 * statement leverages the normal <code>DROP INDEX</code> logic.
 */
@Override
public SqlStatement[] generateStatements(final Database database) {
   final Collection<SqlStatement> statements = new ArrayList<SqlStatement>();
   // MySQL and PostgreSQL only need the normal DROP INDEX statement.
   if (!(database instanceof MySQLDatabase) && !(database instanceof PostgresDatabase)) {
      final DropSpatialIndexStatement dropSpatialIndex = new DropSpatialIndexStatement(
            this.indexName, this.catalogName, this.schemaName, this.tableName);
      statements.add(dropSpatialIndex);
   }

   // GeoDB doesn't use a tradition index structure so don't issue the normal DROP INDEX
   // statement.
   if (!(database instanceof DerbyDatabase) && !(database instanceof H2Database)) {
      final DropIndexStatement dropIndex = new DropIndexStatement(this.indexName,
            this.catalogName, this.schemaName, this.tableName, null);
      statements.add(dropIndex);
   }
   return statements.toArray(new SqlStatement[statements.size()]);
}
 
开发者ID:lonnyj,项目名称:liquibase-spatial,代码行数:25,代码来源:DropSpatialIndexChange.java

示例14: generateStatements

import liquibase.statement.SqlStatement; //导入依赖的package包/类
public SqlStatement[] generateStatements(Database database) {
    SqlStatement[] statements = null;
    try {
        configureCustomChange();
        if (customChange instanceof CustomSqlChange) {
            statements = ((CustomSqlChange) customChange).generateStatements(database);
        } else if (customChange instanceof CustomTaskChange) {
            ((CustomTaskChange) customChange).execute(database);
        } else {
            throw new UnexpectedLiquibaseException(customChange.getClass().getName() + " does not implement " + CustomSqlChange.class.getName() + " or " + CustomTaskChange.class.getName());
        }
    } catch (CustomChangeException e) {
        throw new UnexpectedLiquibaseException(e);
    }

    if (statements == null) {
        statements = new SqlStatement[0];
    }
    return statements;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:21,代码来源:CustomChangeWrapper.java

示例15: generateRollbackStatements

import liquibase.statement.SqlStatement; //导入依赖的package包/类
@Override
public SqlStatement[] generateRollbackStatements(Database database) throws UnsupportedChangeException, RollbackImpossibleException {
    SqlStatement[] statements = null;
    try {
        configureCustomChange();
        if (customChange instanceof CustomSqlRollback) {
            statements = ((CustomSqlRollback) customChange).generateRollbackStatements(database);
        } else if (customChange instanceof CustomTaskRollback) {
            ((CustomTaskRollback) customChange).rollback(database);
        } else {
            throw new UnsupportedChangeException("Unknown rollback type: "+customChange.getClass().getName());
        }
    } catch (CustomChangeException e) {
        throw new UnsupportedChangeException(e);
    }

    if (statements == null) {
        statements = new SqlStatement[0];
    }
    return statements;

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:23,代码来源:CustomChangeWrapper.java


注:本文中的liquibase.statement.SqlStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。