From ed088bbe28555a808322376fccae2648d1c924f5 Mon Sep 17 00:00:00 2001 From: zzboy Date: Wed, 8 May 2024 00:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86columnSpecs=E4=B8=BAnull?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/wang/yuheng/Reader.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/wang/yuheng/Reader.kt b/src/main/kotlin/wang/yuheng/Reader.kt index 73a5c65..f670539 100644 --- a/src/main/kotlin/wang/yuheng/Reader.kt +++ b/src/main/kotlin/wang/yuheng/Reader.kt @@ -41,12 +41,12 @@ interface Reader { var comment = "" var defaultValue = "" - val commentIndex = col.columnSpecs.map { it.toUpperCase() }.indexOf("COMMENT") + val commentIndex = col.columnSpecs?.map { it.toUpperCase() }?.indexOf("COMMENT") ?: -1 if (commentIndex > -1) { comment = col.columnSpecs[commentIndex + 1] } - val defaultValueIndex = col.columnSpecs.map { it.toUpperCase() }.indexOf("DEFAULT") + val defaultValueIndex = col.columnSpecs?.map { it.toUpperCase() }?.indexOf("DEFAULT") ?: -1 if (defaultValueIndex > -1) { defaultValue = col.columnSpecs[defaultValueIndex + 1] } @@ -60,7 +60,7 @@ interface Reader { size = Integer.parseInt(dataTypeArguments[0].toString()) } - val notNull = col.columnSpecs.joinToString(",").toUpperCase().contains("NOT,NULL") + val notNull = col.columnSpecs?.joinToString(",")?.toUpperCase()?.contains("NOT,NULL") ?: false Column(name, comment, dataType.dataType, size, defaultValue, notNull) }.collect(Collectors.toList()) }