2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.jdbc.internal.dto;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * Represents an INFORMATON_SCHEMA.COLUMNS table row.
21 * MySQL returns type as column_type
23 * PostgreSQL returns "data_type" (e.g. "character varying") and "udt_name" as a type alias (e.g. "varchar")
24 * these should be aliased as the matching snake_case version of the attributes in this class. i.e.:
25 * SELECT column_name, data_type as column_type, udt_name as column_type_alias FROM information_schema.columns
27 * @author Jacob Laursen - Initial contribution
32 private @Nullable String columnName;
33 private boolean isNullable;
34 private @Nullable String columnType;
35 private @Nullable String columnTypeAlias;
37 public String getColumnName() {
38 String columnName = this.columnName;
39 return columnName != null ? columnName : "";
42 public String getColumnType() {
43 String columnType = this.columnType;
44 return columnType != null ? columnType : "";
47 public String getColumnTypeAlias() {
48 String columnTypeAlias = this.columnTypeAlias;
49 return columnTypeAlias != null ? columnTypeAlias : "";
52 public boolean getIsNullable() {
56 public void setColumnName(String columnName) {
57 this.columnName = columnName;
60 public void setColumnType(String columnType) {
61 this.columnType = columnType;
64 public void setColumnTypeAlias(String columnTypeAlias) {
65 this.columnTypeAlias = columnTypeAlias;
68 public void setIsNullable(boolean isNullable) {
69 this.isNullable = isNullable;