本文整理汇总了Java中com.microsoft.sqlserver.jdbc.SQLServerConnection类的典型用法代码示例。如果您正苦于以下问题:Java SQLServerConnection类的具体用法?Java SQLServerConnection怎么用?Java SQLServerConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLServerConnection类属于com.microsoft.sqlserver.jdbc包,在下文中一共展示了SQLServerConnection类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: flushVertexGlobalUniqueIndexes
import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Override
public void flushVertexGlobalUniqueIndexes(SqlgGraph sqlgGraph, Map<SchemaTable, Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>>> vertexCache) {
for (SchemaTable schemaTable : vertexCache.keySet()) {
Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>> vertices = vertexCache.get(schemaTable);
Map<String, PropertyColumn> propertyColumnMap = sqlgGraph.getTopology().getPropertiesFor(schemaTable.withPrefix(VERTEX_PREFIX));
for (Map.Entry<String, PropertyColumn> propertyColumnEntry : propertyColumnMap.entrySet()) {
PropertyColumn propertyColumn = propertyColumnEntry.getValue();
for (GlobalUniqueIndex globalUniqueIndex : propertyColumn.getGlobalUniqueIndices()) {
try {
Connection connection = sqlgGraph.tx().getConnection();
SQLServerConnection sqlServerConnection = connection.unwrap(SQLServerConnection.class);
try (SQLServerBulkCopy bulkCopy = new SQLServerBulkCopy(sqlServerConnection)) {
bulkCopy.setDestinationTableName(sqlgGraph.getSqlDialect().maybeWrapInQoutes(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA) + "." +
sqlgGraph.getSqlDialect().maybeWrapInQoutes(VERTEX_PREFIX + globalUniqueIndex.getName())
);
bulkCopy.writeToServer(new SQLServerVertexGlobalUniqueIndexBulkRecord(bulkCopy, sqlgGraph, vertices, propertyColumn));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
}
}
示例2: wrapSqlServerConnection
import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
/**
* Wrap a SQL server connection
* @param conn the connection
* @return the wrapped connection
*/
public static Connection wrapSqlServerConnection(Connection conn) {
if ((conn instanceof WrappedConnection)) {
return conn;
}
if ((conn instanceof SQLServerConnection)) {
return new WrappedSQLServerConnection((SQLServerConnection) conn);
}
return new WrappedConnection(conn);
}
示例3: isolationLevels
import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Parameterized.Parameters
public static Collection<Object[]> isolationLevels() {
List<Object[]> levels = new ArrayList<>();
levels.add(new Object[]{"Read Uncommitted", Connection.TRANSACTION_READ_UNCOMMITTED});
levels.add(new Object[]{"Read Committed", Connection.TRANSACTION_READ_COMMITTED});
levels.add(new Object[]{"Repeatable Read", Connection.TRANSACTION_REPEATABLE_READ});
levels.add(new Object[]{"Serializable", Connection.TRANSACTION_SERIALIZABLE});
levels.add(new Object[]{"Read Committed Snapshot Isolation", SQLServerConnection.TRANSACTION_READ_COMMITTED});
levels.add(new Object[]{"Snapshot Isolation", SQLServerConnection.TRANSACTION_SNAPSHOT});
return levels;
}
示例4: flushEdgeGlobalUniqueIndexes
import com.microsoft.sqlserver.jdbc.SQLServerConnection; //导入依赖的package包/类
@Override
public void flushEdgeGlobalUniqueIndexes(SqlgGraph sqlgGraph,
Map<MetaEdge, Pair<SortedSet<String>, Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>>>> edgeCache) {
for (MetaEdge metaEdge : edgeCache.keySet()) {
Pair<SortedSet<String>, Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>>> triples = edgeCache.get(metaEdge);
Map<SqlgEdge, Triple<SqlgVertex, SqlgVertex, Map<String, Object>>> edgeMap = triples.getRight();
Map<String, PropertyColumn> propertyColumnMap = sqlgGraph.getTopology().getPropertiesFor(metaEdge.getSchemaTable().withPrefix(EDGE_PREFIX));
for (Map.Entry<String, PropertyColumn> propertyColumnEntry : propertyColumnMap.entrySet()) {
PropertyColumn propertyColumn = propertyColumnEntry.getValue();
for (GlobalUniqueIndex globalUniqueIndex : propertyColumn.getGlobalUniqueIndices()) {
try {
Connection connection = sqlgGraph.tx().getConnection();
SQLServerConnection sqlServerConnection = connection.unwrap(SQLServerConnection.class);
try (SQLServerBulkCopy bulkCopy = new SQLServerBulkCopy(sqlServerConnection)) {
bulkCopy.setDestinationTableName(sqlgGraph.getSqlDialect().maybeWrapInQoutes(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA) + "." +
sqlgGraph.getSqlDialect().maybeWrapInQoutes(VERTEX_PREFIX + globalUniqueIndex.getName())
);
bulkCopy.writeToServer(new SQLServerEdgeGlobalUniqueIndexBulkRecord(bulkCopy, sqlgGraph, edgeMap, propertyColumn));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
}
}