當前位置: 首頁>>代碼示例>>Java>>正文


Java Connection.TRANSACTION_NONE屬性代碼示例

本文整理匯總了Java中java.sql.Connection.TRANSACTION_NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Connection.TRANSACTION_NONE屬性的具體用法?Java Connection.TRANSACTION_NONE怎麽用?Java Connection.TRANSACTION_NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.sql.Connection的用法示例。


在下文中一共展示了Connection.TRANSACTION_NONE屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTI

/**
 * Set Transaction Isolation level on the specified JDBC Connection
 */
public static void setTI(Connection c, String tiString)
        throws SQLException {
    int i = -1;
    if (tiString.equals("TRANSACTION_READ_UNCOMMITTED"))
        i = Connection.TRANSACTION_READ_UNCOMMITTED;
    if (tiString.equals("TRANSACTION_READ_COMMITTED"))
        i = Connection.TRANSACTION_READ_COMMITTED;
    if (tiString.equals("TRANSACTION_REPEATABLE_READ"))
        i = Connection.TRANSACTION_REPEATABLE_READ;
    if (tiString.equals("TRANSACTION_SERIALIZABLE"))
        i = Connection.TRANSACTION_SERIALIZABLE;
    if (tiString.equals("TRANSACTION_NONE"))
        i = Connection.TRANSACTION_NONE;
    if (i < 0) {
        throw new SQLException(
                "Trans. isol. value not supported by "
                + RCData.class.getName() + ": " + tiString);
    }
    c.setTransactionIsolation(i);
}
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:23,代碼來源:RCData.java

示例2: tiToString

/**
 * Return a String representation for the given numerical
 * java.sql.Connection Transaction level.
 * <P>
 * Database implementations are free to provide their own transaction
 * isolation levels, so you can't depend upon this method to much.
 * </P>
 * Returns null, since DB implementations are free to provide
 */
public static String tiToString(int ti) {
    switch (ti) {
        case Connection.TRANSACTION_READ_UNCOMMITTED:
            return "TRANSACTION_READ_UNCOMMITTED";
        case Connection.TRANSACTION_READ_COMMITTED:
            return "TRANSACTION_READ_COMMITTED";
        case Connection.TRANSACTION_REPEATABLE_READ:
            return "TRANSACTION_REPEATABLE_READ";
        case Connection.TRANSACTION_SERIALIZABLE:
            return "TRANSACTION_SERIALIZABLE";
        case Connection.TRANSACTION_NONE:
            return "TRANSACTION_NONE";
    }
    return "Custom Transaction Isolation numerical value: " + ti;
}
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:24,代碼來源:RCData.java

示例3: setTI

static public void setTI(Connection c, String tiString)
        throws SQLException {
    int i = -1;
    if (tiString.equals("TRANSACTION_READ_UNCOMMITTED"))
        i = Connection.TRANSACTION_READ_UNCOMMITTED;
    if (tiString.equals("TRANSACTION_READ_COMMITTED"))
        i = Connection.TRANSACTION_READ_COMMITTED;
    if (tiString.equals("TRANSACTION_REPEATABLE_READ"))
        i = Connection.TRANSACTION_REPEATABLE_READ;
    if (tiString.equals("TRANSACTION_SERIALIZABLE"))
        i = Connection.TRANSACTION_SERIALIZABLE;
    if (tiString.equals("TRANSACTION_NONE"))
        i = Connection.TRANSACTION_NONE;
    if (i < 0) {
        throw new SQLException(
                "Trans. isol. value not supported by "
                + RCData.class.getName() + ": " + tiString);
    }
    c.setTransactionIsolation(i);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:20,代碼來源:RCData.java

示例4: tiToString

/**
 * Return String for numerical java.sql.Connection Transaction level.
 *
 * Returns null, since DB implementations are free to provide
 * their own transaction isolation levels.
 */
static public String tiToString(int ti) {
    switch (ti) {
        case Connection.TRANSACTION_READ_UNCOMMITTED:
            return "TRANSACTION_READ_UNCOMMITTED";
        case Connection.TRANSACTION_READ_COMMITTED:
            return "TRANSACTION_READ_COMMITTED";
        case Connection.TRANSACTION_REPEATABLE_READ:
            return "TRANSACTION_REPEATABLE_READ";
        case Connection.TRANSACTION_SERIALIZABLE:
            return "TRANSACTION_SERIALIZABLE";
        case Connection.TRANSACTION_NONE:
            return "TRANSACTION_NONE";
    }
    return "Custom Transaction Isolation numerical value: " + ti;
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:21,代碼來源:RCData.java

示例5: testIsolationLevel

/**
 * Tests isolation level functionality
 * 
 * @throws Exception
 *             if an error occurs
 */
public void testIsolationLevel() throws Exception {
    if (versionMeetsMinimum(4, 0)) {
        String[] isoLevelNames = new String[] { "Connection.TRANSACTION_NONE", "Connection.TRANSACTION_READ_COMMITTED",
                "Connection.TRANSACTION_READ_UNCOMMITTED", "Connection.TRANSACTION_REPEATABLE_READ", "Connection.TRANSACTION_SERIALIZABLE" };

        int[] isolationLevels = new int[] { Connection.TRANSACTION_NONE, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_READ_UNCOMMITTED,
                Connection.TRANSACTION_REPEATABLE_READ, Connection.TRANSACTION_SERIALIZABLE };

        DatabaseMetaData dbmd = this.conn.getMetaData();

        for (int i = 0; i < isolationLevels.length; i++) {
            if (dbmd.supportsTransactionIsolationLevel(isolationLevels[i])) {
                this.conn.setTransactionIsolation(isolationLevels[i]);

                assertTrue(
                        "Transaction isolation level that was set (" + isoLevelNames[i]
                                + ") was not returned, nor was a more restrictive isolation level used by the server",
                        this.conn.getTransactionIsolation() == isolationLevels[i] || this.conn.getTransactionIsolation() > isolationLevels[i]);
            }
        }
    }
}
 
開發者ID:Jugendhackt,項目名稱:OpenVertretung,代碼行數:28,代碼來源:ConnectionTest.java

示例6: level

public int level() {
    switch ( this ) {
        case READ_UNCOMMITTED:
            return Connection.TRANSACTION_READ_UNCOMMITTED;
        case READ_COMMITTED:
            return Connection.TRANSACTION_READ_COMMITTED;
        case REPEATABLE_READ:
            return Connection.TRANSACTION_REPEATABLE_READ;
        case SERIALIZABLE:
            return Connection.TRANSACTION_SERIALIZABLE;
        case NONE:
            return Connection.TRANSACTION_NONE;
        default:
            return -1;
    }
}
 
開發者ID:agroal,項目名稱:agroal,代碼行數:16,代碼來源:AgroalConnectionFactoryConfiguration.java

示例7: setDefaults

public void setDefaults(Connection connection) throws SQLException {

        connection.setHoldability(this.holdability);

        if (this.transactionIsolation != Connection.TRANSACTION_NONE) {
            connection.setTransactionIsolation(this.transactionIsolation);
        }
        connection.setAutoCommit(this.isAutoCommit);
        connection.setReadOnly(this.isReadOnly);
        connection.setCatalog(this.catalog);
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:11,代碼來源:ConnectionDefaults.java

示例8: rowSetIsolationTypes

@DataProvider(name = "rowSetIsolationTypes")
protected Object[][] rowSetIsolationTypes() throws Exception {
    RowSet rs = newInstance();

    return new Object[][]{
        {rs, Connection.TRANSACTION_NONE},
        {rs, Connection.TRANSACTION_READ_COMMITTED},
        {rs, Connection.TRANSACTION_READ_UNCOMMITTED},
        {rs, Connection.TRANSACTION_REPEATABLE_READ},
        {rs, Connection.TRANSACTION_SERIALIZABLE}
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:12,代碼來源:CommonRowSetTests.java

示例9: getTransactionIsolation

@Override
   public int getTransactionIsolation() throws SQLException {
return Connection.TRANSACTION_NONE;
   }
 
開發者ID:thulab,項目名稱:iotdb-jdbc,代碼行數:4,代碼來源:TsfileConnection.java


注:本文中的java.sql.Connection.TRANSACTION_NONE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。