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

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

      
    
Rootfs path

      
    
Size
8352 (8.2 KB)
MD5
b0fd1e42215a733b0cd589e74e535df0
SHA1
846b3b5bb631e35dcd79f7919decf9394bc0aeaa
SHA256
c358eefecca49e7aa01a3632cfac4906a454dc0c3664565a5ccf7e3939d3d226
SHA512

      
    
SHA1_git
fd53f9864d31357ed4437889af8f911d6db38c77
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
Session.java | 8.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.engine; import java.util.ArrayList; import org.h2.command.CommandInterface; import org.h2.jdbc.meta.DatabaseMeta; import org.h2.message.Trace; import org.h2.result.ResultInterface; import org.h2.store.DataHandler; import org.h2.util.NetworkConnectionInfo; import org.h2.util.TimeZoneProvider; import org.h2.util.Utils; import org.h2.value.ValueLob; /** * A local or remote session. A session represents a database connection. */ public abstract class Session implements CastDataProvider, AutoCloseable { /** * Static settings. */ public static final class StaticSettings { /** * Whether unquoted identifiers are converted to upper case. */ public final boolean databaseToUpper; /** * Whether unquoted identifiers are converted to lower case. */ public final boolean databaseToLower; /** * Whether all identifiers are case insensitive. */ public final boolean caseInsensitiveIdentifiers; /** * Creates new instance of static settings. * * @param databaseToUpper * whether unquoted identifiers are converted to upper case * @param databaseToLower * whether unquoted identifiers are converted to lower case * @param caseInsensitiveIdentifiers * whether all identifiers are case insensitive */ public StaticSettings(boolean databaseToUpper, boolean databaseToLower, boolean caseInsensitiveIdentifiers) { this.databaseToUpper = databaseToUpper; this.databaseToLower = databaseToLower; this.caseInsensitiveIdentifiers = caseInsensitiveIdentifiers; } } /** * Dynamic settings. */ public static final class DynamicSettings { /** * The database mode. */ public final Mode mode; /** * The current time zone. */ public final TimeZoneProvider timeZone; /** * Creates new instance of dynamic settings. * * @param mode * the database mode * @param timeZone * the current time zone */ public DynamicSettings(Mode mode, TimeZoneProvider timeZone) { this.mode = mode; this.timeZone = timeZone; } } private ArrayList<String> sessionState; boolean sessionStateChanged; private boolean sessionStateUpdating; volatile StaticSettings staticSettings; Session() { } /** * Get the list of the cluster servers for this session. * * @return A list of "ip:port" strings for the cluster servers in this * session. */ public abstract ArrayList<String> getClusterServers(); /** * Parse a command and prepare it for execution. * * @param sql the SQL statement * @param fetchSize the number of rows to fetch in one step * @return the prepared command */ public abstract CommandInterface prepareCommand(String sql, int fetchSize); /** * Roll back pending transactions and close the session. */ @Override public abstract void close(); /** * Get the trace object * * @return the trace object */ public abstract Trace getTrace(); /** * Check if close was called. * * @return if the session has been closed */ public abstract boolean isClosed(); /** * Get the data handler object. * * @return the data handler */ public abstract DataHandler getDataHandler(); /** * Check whether this session has a pending transaction. * * @return true if it has */ public abstract boolean hasPendingTransaction(); /** * Cancel the current or next command (called when closing a connection). */ public abstract void cancel(); /** * Check if this session is in auto-commit mode. * * @return true if the session is in auto-commit mode */ public abstract boolean getAutoCommit(); /** * Set the auto-commit mode. This call doesn't commit the current * transaction. * * @param autoCommit the new value */ public abstract void setAutoCommit(boolean autoCommit); /** * Add a temporary LOB, which is closed when the session commits. * * @param v the value * @return the specified value */ public abstract ValueLob addTemporaryLob(ValueLob v); /** * Check if this session is remote or embedded. * * @return true if this session is remote */ public abstract boolean isRemote(); /** * Set current schema. * * @param schema the schema name */ public abstract void setCurrentSchemaName(String schema); /** * Get current schema. * * @return the current schema name */ public abstract String getCurrentSchemaName(); /** * Sets the network connection information if possible. * * @param networkConnectionInfo the network connection information */ public abstract void setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo); /** * Returns the isolation level. * * @return the isolation level */ public abstract IsolationLevel getIsolationLevel(); /** * Sets the isolation level. * * @param isolationLevel the isolation level to set */ public abstract void setIsolationLevel(IsolationLevel isolationLevel); /** * Returns static settings. These settings cannot be changed during * lifecycle of session. * * @return static settings */ public abstract StaticSettings getStaticSettings(); /** * Returns dynamic settings. These settings can be changed during lifecycle * of session. * * @return dynamic settings */ public abstract DynamicSettings getDynamicSettings(); /** * Returns database meta information. * * @return database meta information */ public abstract DatabaseMeta getDatabaseMeta(); /** * Returns whether INFORMATION_SCHEMA contains old-style tables. * * @return whether INFORMATION_SCHEMA contains old-style tables */ public abstract boolean isOldInformationSchema(); /** * Re-create the session state using the stored sessionState list. */ void recreateSessionState() { if (sessionState != null && !sessionState.isEmpty()) { sessionStateUpdating = true; try { for (String sql : sessionState) { CommandInterface ci = prepareCommand(sql, Integer.MAX_VALUE); ci.executeUpdate(null); } } finally { sessionStateUpdating = false; sessionStateChanged = false; } } } /** * Read the session state if necessary. */ public void readSessionState() { if (!sessionStateChanged || sessionStateUpdating) { return; } sessionStateChanged = false; sessionState = Utils.newSmallArrayList(); CommandInterface ci = prepareCommand(!isOldInformationSchema() ? "SELECT STATE_COMMAND FROM INFORMATION_SCHEMA.SESSION_STATE" : "SELECT SQL FROM INFORMATION_SCHEMA.SESSION_STATE", Integer.MAX_VALUE); ResultInterface result = ci.executeQuery(0, false); while (result.next()) { sessionState.add(result.currentRow()[0].getString()); } } /** * Sets this session as thread local session, if this session is a local * session. * * @return old thread local session, or {@code null} */ public Session setThreadLocalSession() { return null; } /** * Resets old thread local session. * * @param oldSession * the old thread local session, or {@code null} */ public void resetThreadLocalSession(Session oldSession) { } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
1.46
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 expression License clue details
(mpl-2.0 OR epl-1.0) AND proprietary-license {'score': 20.37, 'matcher': '3-seq', 'end_line': 3, 'rule_url': 'https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'from_file': None, 'start_line': 2, 'matched_text': ' * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,\n * and the EPL 1.0 (https://h2database.com/html/license.html).', 'match_coverage': 20.37, 'matched_length': 11, 'rule_relevance': 100, 'rule_identifier': 'mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'license_expression': '(mpl-2.0 OR epl-1.0) AND proprietary-license', 'license_expression_spdx': '(MPL-2.0 OR EPL-1.0) AND LicenseRef-scancode-proprietary-license'}
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