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

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

      
    
Rootfs path

      
    
Size
2938 (2.9 KB)
MD5
33c6c9772d3f4f6a2807edeb9c043a52
SHA1
1aa2acef5f86caa9c50e971436893d3a931b02ee
SHA256
782c503eb91a39988042545f18908494fc5d57e36f4bed28f726fabbf254ed20
SHA512

      
    
SHA1_git
f6e9fc7c29f045bcaa47784d4ce396cb2b6c342a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
CompatibilityDateTimeValueFunction.java | 2.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 org.h2.engine.SessionLocal; import org.h2.expression.ExpressionVisitor; import org.h2.expression.Operation0; import org.h2.expression.function.NamedExpression; import org.h2.util.DateTimeUtils; import org.h2.util.TimeZoneProvider; import org.h2.value.TypeInfo; import org.h2.value.Value; import org.h2.value.ValueTimestamp; import org.h2.value.ValueTimestampTimeZone; /** * Current datetime value function. */ final class CompatibilityDateTimeValueFunction extends Operation0 implements NamedExpression { /** * The function "SYSDATE" */ static final int SYSDATE = 0; /** * The function "SYSTIMESTAMP" */ static final int SYSTIMESTAMP = 1; private static final String[] NAMES = { "SYSDATE", "SYSTIMESTAMP" }; private final int function, scale; private final TypeInfo type; CompatibilityDateTimeValueFunction(int function, int scale) { this.function = function; this.scale = scale; if (function == SYSDATE) { type = TypeInfo.getTypeInfo(Value.TIMESTAMP, 0L, 0, null); } else { type = TypeInfo.getTypeInfo(Value.TIMESTAMP_TZ, 0L, scale, null); } } @Override public Value getValue(SessionLocal session) { ValueTimestampTimeZone v = session.currentTimestamp(); long dateValue = v.getDateValue(); long timeNanos = v.getTimeNanos(); int offsetSeconds = v.getTimeZoneOffsetSeconds(); int newOffset = TimeZoneProvider.getDefault() .getTimeZoneOffsetUTC(DateTimeUtils.getEpochSeconds(dateValue, timeNanos, offsetSeconds)); if (offsetSeconds != newOffset) { v = DateTimeUtils.timestampTimeZoneAtOffset(dateValue, timeNanos, offsetSeconds, newOffset); } if (function == SYSDATE) { return ValueTimestamp.fromDateValueAndNanos(v.getDateValue(), v.getTimeNanos() / DateTimeUtils.NANOS_PER_SECOND * DateTimeUtils.NANOS_PER_SECOND); } return v.castTo(type, session); } @Override public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags) { builder.append(getName()); if (scale >= 0) { builder.append('(').append(scale).append(')'); } return builder; } @Override public boolean isEverything(ExpressionVisitor visitor) { switch (visitor.getType()) { case ExpressionVisitor.DETERMINISTIC: return false; } return true; } @Override public TypeInfo getType() { return type; } @Override public int getCost() { return 1; } @Override public String getName() { return NAMES[function]; } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
4.17
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