本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}