diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/AssociativeArrayDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/AssociativeArrayDatatype.kt index b0abd5f2..2e26424b 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/AssociativeArrayDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/AssociativeArrayDatatype.kt @@ -27,7 +27,7 @@ import org.sonar.plugins.plsqlopen.api.symbols.Scope class AssociativeArrayDatatype(node: AstNode? = null, currentScope: Scope?, val nestedType: PlSqlDatatype) : PlSqlDatatype { override val type = PlSqlType.ASSOCIATIVE_ARRAY - val name: String = currentScope?.let { + override val name: String = currentScope?.let { if (it.identifier != null && it.type == PlSqlGrammar.CREATE_PACKAGE) it.identifier + "." else "" } + diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/BooleanDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/BooleanDatatype.kt index 0e0b6a73..e0cce0ec 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/BooleanDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/BooleanDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class BooleanDatatype : PlSqlDatatype { override val type = PlSqlType.BOOLEAN + override val name: String = "BOOLEAN" + override fun toString(): String { return "Boolean" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/CharacterDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/CharacterDatatype.kt index b0e196ce..8d876d85 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/CharacterDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/CharacterDatatype.kt @@ -27,6 +27,13 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class CharacterDatatype : PlSqlDatatype { override val type = PlSqlType.CHARACTER + + override val name: String + get() = if (this.length == null) + "VARCHAR2" + else + "VARCHAR2(${this.length})" + val length: Int? constructor() { diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/DateDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/DateDatatype.kt index 7adc5f53..6ce844c7 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/DateDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/DateDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class DateDatatype : PlSqlDatatype { override val type = PlSqlType.DATE + override val name: String = "DATE" + override fun toString(): String { return "Date" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/ExceptionDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/ExceptionDatatype.kt index 24667022..d6f6acef 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/ExceptionDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/ExceptionDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class ExceptionDatatype : PlSqlDatatype { override val type = PlSqlType.EXCEPTION + override val name: String = "EXCEPTION" + override fun toString(): String { return "Exception" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/LobDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/LobDatatype.kt index 3889d826..0d5f7ef2 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/LobDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/LobDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class LobDatatype : PlSqlDatatype { override val type = PlSqlType.LOB + override val name: String = "LOB" + override fun toString(): String { return "Lob" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NullDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NullDatatype.kt index b99f1965..a844da53 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NullDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NullDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class NullDatatype : PlSqlDatatype { override val type = PlSqlType.NULL + override val name: String = "NULL" + override fun toString(): String { return "Null" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NumericDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NumericDatatype.kt index 7bd61cab..a30807c2 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NumericDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/NumericDatatype.kt @@ -27,6 +27,15 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class NumericDatatype : PlSqlDatatype { override val type = PlSqlType.NUMERIC + + override val name: String + get() = if (this.length == null) + "NUMBER()" + else if (this.precision == null) + "NUMBER(${this.length})" + else + "NUMBER(${this.length}, ${this.precision})" + val length: Int? val precision: Int? diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/PlSqlDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/PlSqlDatatype.kt index 81b0382b..8dcb8a75 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/PlSqlDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/PlSqlDatatype.kt @@ -23,4 +23,5 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType interface PlSqlDatatype { val type: PlSqlType + val name: String? } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RecordDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RecordDatatype.kt index e2d14641..7cc500ef 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RecordDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RecordDatatype.kt @@ -28,7 +28,7 @@ import org.sonar.plugins.plsqlopen.api.symbols.Symbol class RecordDatatype(node: AstNode? = null, currentScope: Scope?, val fields: List) : PlSqlDatatype { override val type = PlSqlType.RECORD - val name: String = currentScope?.let { + override val name: String = currentScope?.let { if (it.identifier != null && it.type == PlSqlGrammar.CREATE_PACKAGE) it.identifier + "." else "" } + diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RowtypeDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RowtypeDatatype.kt index 0e2380fd..8ee28280 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RowtypeDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/RowtypeDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class RowtypeDatatype : PlSqlDatatype { override val type = PlSqlType.ROWTYPE + override val name: String? = null + override fun toString(): String { return "Rowtype" } diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/UnknownDatatype.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/UnknownDatatype.kt index 481effcc..2cd4a8e3 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/UnknownDatatype.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/symbols/datatype/UnknownDatatype.kt @@ -24,6 +24,8 @@ import org.sonar.plugins.plsqlopen.api.symbols.PlSqlType class UnknownDatatype : PlSqlDatatype { override val type = PlSqlType.UNKNOWN + override val name: String? = null + override fun toString(): String { return "Unknown" }