ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/engine/IsolationLevel.java

Path
ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/engine/IsolationLevel.java
Status
scanned
Type
file
Name
IsolationLevel.java
Extension
.java
Programming language
Java
Mime type
text/x-java
File type
Java source, ASCII text
Tag

      
    
Rootfs path

      
    
Size
4737 (4.6 KB)
MD5
8076b79ce5d1fdc812801c02f472446f
SHA1
a118a19d0789eb7033acd2beb5a8cd5ee411475a
SHA256
25ab9bb679d2c3b83f01c3677a08b53d7f0a4f28b140a95c2eaa07886779cdc9
SHA512

      
    
SHA1_git
86a4c1149fc8838052f5d0aec0f766895a3c2e0e
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
IsolationLevel.java | 4.6 KB |

/* * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.engine; import java.sql.Connection; import org.h2.message.DbException; /** * Level of isolation. */ public enum IsolationLevel { /** * Dirty reads, non-repeatable reads and phantom reads are allowed. */ READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED, Constants.LOCK_MODE_OFF), /** * Dirty reads aren't allowed; non-repeatable reads and phantom reads are * allowed. */ READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED, Constants.LOCK_MODE_READ_COMMITTED), /** * Dirty reads and non-repeatable reads aren't allowed; phantom reads are * allowed. */ REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ, Constants.LOCK_MODE_TABLE), /** * Dirty reads, non-repeatable reads and phantom reads are'n allowed. */ SNAPSHOT(Constants.TRANSACTION_SNAPSHOT, Constants.LOCK_MODE_TABLE), /** * Dirty reads, non-repeatable reads and phantom reads are'n allowed. * Concurrent and serial execution of transactions with this isolation level * should have the same effect. */ SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE, Constants.LOCK_MODE_TABLE); /** * Returns the isolation level from LOCK_MODE equivalent for PageStore and * old versions of H2. * * @param level * the LOCK_MODE value * @return the isolation level */ public static IsolationLevel fromJdbc(int level) { switch (level) { case Connection.TRANSACTION_READ_UNCOMMITTED: return IsolationLevel.READ_UNCOMMITTED; case Connection.TRANSACTION_READ_COMMITTED: return IsolationLevel.READ_COMMITTED; case Connection.TRANSACTION_REPEATABLE_READ: return IsolationLevel.REPEATABLE_READ; case Constants.TRANSACTION_SNAPSHOT: return IsolationLevel.SNAPSHOT; case Connection.TRANSACTION_SERIALIZABLE: return IsolationLevel.SERIALIZABLE; default: throw DbException.getInvalidValueException("isolation level", level); } } /** * Returns the isolation level from LOCK_MODE equivalent for PageStore and * old versions of H2. * * @param lockMode * the LOCK_MODE value * @return the isolation level */ public static IsolationLevel fromLockMode(int lockMode) { switch (lockMode) { case Constants.LOCK_MODE_OFF: return IsolationLevel.READ_UNCOMMITTED; case Constants.LOCK_MODE_READ_COMMITTED: default: return IsolationLevel.READ_COMMITTED; case Constants.LOCK_MODE_TABLE: case Constants.LOCK_MODE_TABLE_GC: return IsolationLevel.SERIALIZABLE; } } /** * Returns the isolation level from its SQL name. * * @param sql * the SQL name * @return the isolation level from its SQL name */ public static IsolationLevel fromSql(String sql) { switch (sql) { case "READ UNCOMMITTED": return READ_UNCOMMITTED; case "READ COMMITTED": return READ_COMMITTED; case "REPEATABLE READ": return REPEATABLE_READ; case "SNAPSHOT": return SNAPSHOT; case "SERIALIZABLE": return SERIALIZABLE; default: throw DbException.getInvalidValueException("isolation level", sql); } } private final String sql; private final int jdbc, lockMode; private IsolationLevel(int jdbc, int lockMode) { sql = name().replace('_', ' ').intern(); this.jdbc = jdbc; this.lockMode = lockMode; } /** * Returns the SQL representation of this isolation level. * * @return SQL representation of this isolation level */ public String getSQL() { return sql; } /** * Returns the JDBC constant for this isolation level. * * @return the JDBC constant for this isolation level */ public int getJdbc() { return jdbc; } /** * Returns the LOCK_MODE equivalent for PageStore and old versions of H2. * * @return the LOCK_MODE equivalent */ public int getLockMode() { return lockMode; } /** * Returns whether a non-repeatable read phenomena is allowed. * * @return whether a non-repeatable read phenomena is allowed */ public boolean allowNonRepeatableRead() { return ordinal() < REPEATABLE_READ.ordinal(); } }
Detected license expression
mpl-2.0 AND epl-1.0
Detected license expression (SPDX)
MPL-2.0 AND EPL-1.0
Percentage of license text
1.87
Copyrights
- end_line: 2
  copyright: Copyright 2004-2023 H2 Group. Multiple-Licensed
  start_line: 2
Holders
- holder: H2 Group. Multiple-Licensed
  end_line: 2
  start_line: 2
Authors

      
    
License detections License expression License expression SPDX
mpl_2_0_and_epl_1_0-796bf8d7-f485-3520-923d-e6a4b1ecd2f3 mpl-2.0 AND epl-1.0 MPL-2.0 AND EPL-1.0
URL Start line End line
https://h2database.com/html/license.html 3 3
Package URL License Primary language
pkg:osgi/com.h2database.source@2.2.220