为什么我不能在Kotlin的内部类中使用外部属性?

时间:2020-08-27 08:36:13

标签: kotlin

OBJECT_LIST_QUERY = """ SELECT seq, catalog_name, schema_name, object_type, object_name, ARGUMENT_SIGNATURE, script FROM ( select '01' seq, DATABASE_NAME catalog_name, '*' schema_name, 'DATABASE' object_type, DATABASE_NAME object_name, '' ARGUMENT_SIGNATURE , 'CREATE OR REPLACE' || CASE WHEN D.IS_TRANSIENT = 'YES' THEN ' TRANSIENT' ELSE '' END || ' ' || 'DATABASE ' || D.DATABASE_NAME || ' ' || '\nDATA_RETENTION_TIME_IN_DAYS = ' || TO_VARCHAR(RETENTION_TIME) || CASE WHEN D.COMMENT IS NULL THEN '' ELSE '\nCOMMENT = ''' || D.COMMENT || '''' END || ';' script from INFORMATION_SCHEMA.DATABASES D WHERE DATABASE_NAME = '{}' UNION ALL select '02' seq, catalog_name, schema_name schema_name, 'SCHEMA' object_type, schema_name object_name, '' ARGUMENT_SIGNATURE , 'CREATE OR REPLACE' || CASE WHEN S.IS_TRANSIENT = 'YES' THEN ' TRANSIENT' ELSE '' END || ' ' || 'SCHEMA ' || S.SCHEMA_NAME || ' ' || CASE WHEN S.IS_MANAGED_ACCESS = 'YES' THEN '\nWITH MANAGED ACCESS' ELSE '' END || ' ' || '\nDATA_RETENTION_TIME_IN_DAYS = ' || TO_VARCHAR(RETENTION_TIME) || CASE WHEN S.COMMENT IS NULL THEN '' ELSE '\nCOMMENT = ''' || S.COMMENT || '''' END || ';' script from INFORMATION_SCHEMA.SCHEMATA S UNION ALL select '03' seq, table_catalog catalog_name, TABLE_SCHEMA schema_name, 'TABLE' object_type, TABLE_NAME object_name, '' ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE != 'VIEW' UNION ALL select '04' seq, table_catalog catalog_name, TABLE_SCHEMA schema_name, 'VIEW' object_type, TABLE_NAME object_name, '' ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA != 'INFORMATION_SCHEMA' UNION ALL select '06' seq, SEQUENCE_catalog catalog_name, SEQUENCE_SCHEMA schema_name, 'SEQUENCE' object_type, SEQUENCE_NAME object_name, '' ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.SEQUENCES UNION ALL select '07' seq, FILE_FORMAT_catalog catalog_name, FILE_FORMAT_SCHEMA schema_name, 'FILE_FORMAT' object_type, FILE_FORMAT_NAME object_name, '' ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.FILE_FORMATS UNION ALL select '08' seq, PIPE_catalog catalog_name, PIPE_SCHEMA schema_name, 'PIPE' object_type, PIPE_NAME object_name, '' ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.PIPES UNION ALL select '09' seq, FUNCTION_catalog catalog_name, FUNCTION_SCHEMA schema_name, 'FUNCTION' object_type, FUNCTION_NAME object_name, ARGUMENT_SIGNATURE, '' script from INFORMATION_SCHEMA.FUNCTIONS UNION ALL select '10' seq, PROCEDURE_catalog catalog_name, PROCEDURE_SCHEMA schema_name, 'PROCEDURE' object_type, PROCEDURE_NAME object_name, ARGUMENT_SIGNATURE, '' script from "INFORMATION_SCHEMA"."PROCEDURES" ) T ORDER BY seq, catalog_name, schema_name, object_name""" GET_DDL_QUERY = "SELECT GET_DDL('{}', '{}') script" VoiceViewHolder的内部类。

VoiceAdapters是外部类private val aHomeViewModel的属性。

我认为内部类VoiceAdapters中的aHomeViewModel.delete(binding.amVoice)将正确运行,但实际上失败了,为什么?

代码

VoiceViewHolder

1 个答案:

答案 0 :(得分:-1)

希望能为您提供帮助

inner class VoiceViewHolder { ... }