ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/mode/FunctionsLegacy.java

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

      
    
Rootfs path

      
    
Size
1993 (1.9 KB)
MD5
7f6ac50c0a9bd21213d2601cac1f63e5
SHA1
fb58089ff1108e4a45f2b83670d1828cd60fc0ca
SHA256
7cf8639c304d4a49003e11b8fd3434a5910edddce76802fc1f55ca9f575e15d0
SHA512

      
    
SHA1_git
1bf9c54670571626613f8504de6b4b8220df2b2a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
FunctionsLegacy.java | 1.9 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.mode; import java.util.HashMap; import org.h2.engine.SessionLocal; import org.h2.expression.Expression; import org.h2.message.DbException; import org.h2.value.TypeInfo; import org.h2.value.Value; /** * This class implements some legacy functions not available in Regular mode. */ public class FunctionsLegacy extends ModeFunction { private static final HashMap<String, FunctionInfo> FUNCTIONS = new HashMap<>(); private static final int IDENTITY = 6001; private static final int SCOPE_IDENTITY = IDENTITY + 1; static { FUNCTIONS.put("IDENTITY", new FunctionInfo("IDENTITY", IDENTITY, 0, Value.BIGINT, true, false)); FUNCTIONS.put("SCOPE_IDENTITY", new FunctionInfo("SCOPE_IDENTITY", SCOPE_IDENTITY, 0, Value.BIGINT, true, false)); } /** * Returns mode-specific function for a given name, or {@code null}. * * @param upperName * the upper-case name of a function * @return the function with specified name or {@code null} */ public static FunctionsLegacy getFunction(String upperName) { FunctionInfo info = FUNCTIONS.get(upperName); if (info != null) { return new FunctionsLegacy(info); } return null; } private FunctionsLegacy(FunctionInfo info) { super(info); } @Override public Value getValue(SessionLocal session) { switch (info.type) { case IDENTITY: case SCOPE_IDENTITY: return session.getLastIdentity().convertTo(type); default: throw DbException.getInternalError("type=" + info.type); } } @Override public Expression optimize(SessionLocal session) { type = TypeInfo.getTypeInfo(info.returnDataType); return this; } }
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
4.31
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