ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/jdbc/JdbcSavepoint.java

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

      
    
Rootfs path

      
    
Size
3261 (3.2 KB)
MD5
0b1001767632bd631aa3c9002ebe0ec7
SHA1
f0a393ae80e84e3aa0f29bfb39007ae11cbf1427
SHA256
37899c64ec435269b2d47e999b50b78a3572365cea0364b03d63535648d25409
SHA512

      
    
SHA1_git
8c5354214908e1f71e150cc8cb8e9b0f19e6fdf8
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
JdbcSavepoint.java | 3.2 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.jdbc; import java.sql.SQLException; import java.sql.Savepoint; import org.h2.api.ErrorCode; import org.h2.message.DbException; import org.h2.message.Trace; import org.h2.message.TraceObject; import org.h2.util.StringUtils; /** * A savepoint is a point inside a transaction to where a transaction can be * rolled back. The tasks that where done before the savepoint are not rolled * back in this case. */ public final class JdbcSavepoint extends TraceObject implements Savepoint { private static final String SYSTEM_SAVEPOINT_PREFIX = "SYSTEM_SAVEPOINT_"; private final int savepointId; private final String name; private JdbcConnection conn; JdbcSavepoint(JdbcConnection conn, int savepointId, String name, Trace trace, int id) { setTrace(trace, TraceObject.SAVEPOINT, id); this.conn = conn; this.savepointId = savepointId; this.name = name; } /** * Release this savepoint. This method only set the connection to null and * does not execute a statement. */ void release() { this.conn = null; } /** * Get the savepoint name for this name or id. * If the name is null, the id is used. * * @param name the name (may be null) * @param id the id * @return the savepoint name */ static String getName(String name, int id) { if (name != null) { return StringUtils.quoteJavaString(name); } return SYSTEM_SAVEPOINT_PREFIX + id; } /** * Roll back to this savepoint. */ void rollback() { checkValid(); conn.prepareCommand( "ROLLBACK TO SAVEPOINT " + getName(name, savepointId), Integer.MAX_VALUE).executeUpdate(null); } private void checkValid() { if (conn == null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, getName(name, savepointId)); } } /** * Get the generated id of this savepoint. * @return the id */ @Override public int getSavepointId() throws SQLException { try { debugCodeCall("getSavepointId"); checkValid(); if (name != null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_NAMED); } return savepointId; } catch (Exception e) { throw logAndConvert(e); } } /** * Get the name of this savepoint. * @return the name */ @Override public String getSavepointName() throws SQLException { try { debugCodeCall("getSavepointName"); checkValid(); if (name == null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_UNNAMED); } return name; } catch (Exception e) { throw logAndConvert(e); } } /** * INTERNAL */ @Override public String toString() { return getTraceObjectName() + ": id=" + savepointId + " name=" + name; } }
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
2.71
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