ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/table/TableBase.java

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

      
    
Rootfs path

      
    
Size
4877 (4.8 KB)
MD5
e73f33262096c259e80b49209de036bc
SHA1
8f62335d0291455bcfc051dabd57503231b50b0d
SHA256
2f9dbbcde0cf02d27dc8e6af0ede498538dc7852e37ed01ee30d943ca7ade16e
SHA512

      
    
SHA1_git
7bafe43938238c91fbd6e4f6e2080dcbe2ed5987
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TableBase.java | 4.8 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.table; import java.util.Collections; import java.util.List; import org.h2.command.ddl.CreateTableData; import org.h2.engine.Database; import org.h2.index.IndexType; import org.h2.result.SearchRow; import org.h2.result.SortOrder; import org.h2.util.StringUtils; import org.h2.value.Value; /** * The base class of a regular table, or a user defined table. * * @author Thomas Mueller * @author Sergi Vladykin */ public abstract class TableBase extends Table { /** * The table engine used (null for regular tables). */ private final String tableEngine; /** Provided table parameters */ private final List<String> tableEngineParams; private final boolean globalTemporary; /** * Returns main index column if index is an primary key index and has only * one column with _ROWID_ compatible data type. * * @param indexType type of an index * @param cols columns of the index * @return main index column or {@link SearchRow#ROWID_INDEX} */ public static int getMainIndexColumn(IndexType indexType, IndexColumn[] cols) { if (!indexType.isPrimaryKey() || cols.length != 1) { return SearchRow.ROWID_INDEX; } IndexColumn first = cols[0]; if ((first.sortType & SortOrder.DESCENDING) != 0) { return SearchRow.ROWID_INDEX; } switch (first.column.getType().getValueType()) { case Value.TINYINT: case Value.SMALLINT: case Value.INTEGER: case Value.BIGINT: return first.column.getColumnId(); default: return SearchRow.ROWID_INDEX; } } public TableBase(CreateTableData data) { super(data.schema, data.id, data.tableName, data.persistIndexes, data.persistData); this.tableEngine = data.tableEngine; this.globalTemporary = data.globalTemporary; if (data.tableEngineParams != null) { this.tableEngineParams = data.tableEngineParams; } else { this.tableEngineParams = Collections.emptyList(); } setTemporary(data.temporary); setColumns(data.columns.toArray(new Column[0])); } @Override public String getDropSQL() { StringBuilder builder = new StringBuilder("DROP TABLE IF EXISTS "); getSQL(builder, DEFAULT_SQL_FLAGS).append(" CASCADE"); return builder.toString(); } @Override public String getCreateSQLForMeta() { return getCreateSQL(true); } @Override public String getCreateSQL() { return getCreateSQL(false); } private String getCreateSQL(boolean forMeta) { Database db = getDatabase(); if (db == null) { // closed return null; } StringBuilder buff = new StringBuilder("CREATE "); if (isTemporary()) { if (isGlobalTemporary()) { buff.append("GLOBAL "); } else { buff.append("LOCAL "); } buff.append("TEMPORARY "); } else if (isPersistIndexes()) { buff.append("CACHED "); } else { buff.append("MEMORY "); } buff.append("TABLE "); if (isHidden) { buff.append("IF NOT EXISTS "); } getSQL(buff, DEFAULT_SQL_FLAGS); if (comment != null) { buff.append(" COMMENT "); StringUtils.quoteStringSQL(buff, comment); } buff.append("( "); for (int i = 0, l = columns.length; i < l; i++) { if (i > 0) { buff.append(", "); } buff.append(columns[i].getCreateSQL(forMeta)); } buff.append(" )"); if (tableEngine != null) { String d = db.getSettings().defaultTableEngine; if (d == null || !tableEngine.endsWith(d)) { buff.append(" ENGINE "); StringUtils.quoteIdentifier(buff, tableEngine); } } if (!tableEngineParams.isEmpty()) { buff.append(" WITH "); for (int i = 0, l = tableEngineParams.size(); i < l; i++) { if (i > 0) { buff.append(", "); } StringUtils.quoteIdentifier(buff, tableEngineParams.get(i)); } } if (!isPersistIndexes() && !isPersistData()) { buff.append(" NOT PERSISTENT"); } if (isHidden) { buff.append(" HIDDEN"); } return buff.toString(); } @Override public boolean isGlobalTemporary() { return globalTemporary; } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
2.43
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
- author: Thomas Mueller
  end_line: 21
  start_line: 21
- author: Sergi Vladykin
  end_line: 22
  start_line: 22
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