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


Java ShardMapping.equals方法代码示例

本文整理汇总了Java中com.mysql.fabric.ShardMapping.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ShardMapping.equals方法的具体用法?Java ShardMapping.equals怎么用?Java ShardMapping.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysql.fabric.ShardMapping的用法示例。


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

示例1: addQueryTable

import com.mysql.fabric.ShardMapping; //导入方法依赖的package包/类
/**
 * Add a table to the set of tables used for the next query on this connection.
 * This is used for:
 * <ul>
 * <li>Choosing a shard given the tables used</li>
 * <li>Preventing cross-shard queries</li>
 * </ul>
 */
public void addQueryTable(String tableName) throws SQLException {
    ensureNoTransactionInProgress();

    this.currentConnection = null;

    // choose shard mapping if necessary
    if (this.shardMapping == null) {
        if (this.fabricConnection.getShardMapping(this.database, tableName) != null) {
            setShardTable(tableName);
        }
    } else { // make sure we aren't in conflict with the chosen shard mapping
        ShardMapping mappingForTableName = this.fabricConnection.getShardMapping(this.database, tableName);
        if (mappingForTableName != null && !mappingForTableName.equals(this.shardMapping)) {
            throw SQLError.createSQLException("Cross-shard query not allowed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, null, getExceptionInterceptor(), this);
        }
    }
    this.queryTables.add(tableName);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:27,代码来源:FabricMySQLConnectionProxy.java

示例2: addQueryTable

import com.mysql.fabric.ShardMapping; //导入方法依赖的package包/类
/**
 * Add a table to the set of tables used for the next query on this connection.
 * This is used for:
 * <ul>
 * <li>Choosing a shard given the tables used</li>
 * <li>Preventing cross-shard queries</li>
 * </ul>
 */
public void addQueryTable(String tableName) throws SQLException {
    ensureNoTransactionInProgress();

    this.currentConnection = null;

    try {
        // choose shard mapping if necessary
        if (this.shardMapping == null) {
            if (this.fabricConnection.getShardMapping(this.database, tableName) != null) {
                setShardTable(tableName);
            }
        } else { // make sure we aren't in conflict with the chosen shard mapping
            ShardMapping mappingForTableName = this.fabricConnection.getShardMapping(this.database, tableName);
            if (mappingForTableName != null && !mappingForTableName.equals(this.shardMapping)) {
                throw SQLError.createSQLException("Cross-shard query not allowed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, null, getExceptionInterceptor(),
                        this);
            }
        }
        this.queryTables.add(tableName);
    } catch (FabricCommunicationException ex) {
        throw SQLError.createSQLException("Fabric communication failure.", SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE, ex, getExceptionInterceptor(),
                this);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:FabricMySQLConnectionProxy.java

示例3: addQueryTable

import com.mysql.fabric.ShardMapping; //导入方法依赖的package包/类
/**
 * Add a table to the set of tables used for the next query on this connection.
 * This is used for:
 * <ul>
 * <li>Choosing a shard given the tables used</li>
 * <li>Preventing cross-shard queries</li>
 * </ul>
 */
public void addQueryTable(String tableName) throws SQLException {
	ensureNoTransactionInProgress();

	this.currentConnection = null;

	try {
		// choose shard mapping if necessary
		if (this.shardMapping == null) {
			if (this.fabricConnection.getShardMapping(this.database, tableName) != null) {
				setShardTable(tableName);
			}
		} else { // make sure we aren't in conflict with the chosen shard mapping
			ShardMapping mappingForTableName = this.fabricConnection.getShardMapping(this.database, tableName);
			if (mappingForTableName != null &&
				!mappingForTableName.equals(this.shardMapping))
				throw SQLError.createSQLException("Cross-shard query not allowed",
												  SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
												  null,
												  getExceptionInterceptor(),
												  this);
		}
		this.queryTables.add(tableName);
	} catch(FabricCommunicationException ex) {
		throw SQLError.createSQLException("Fabric communication failure.",
										  SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE,
										  ex,
										  getExceptionInterceptor(),
										  this);
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:39,代码来源:FabricMySQLConnectionProxy.java


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