@@ -45,18 +45,31 @@ internal abstract class CreateVirtualTableMixin(
4545 )
4646 .mapNotNull { it.moduleArgumentDef?.moduleColumnDef?.columnName ? : it.moduleArgumentDef?.columnDef?.columnName }
4747
48- val synthesizedColumns = if (usesFtsModule) {
49- val columnNames = columnNameElements.map { it.name }
50-
51- listOf (
52- SynthesizedColumn (
53- table = this ,
54- acceptableValues = listOf (" docid" , " rowid" , " oid" , " _rowid_" , tableName.name)
55- .filter { it !in columnNames },
56- ),
57- )
58- } else {
59- emptyList()
48+ val synthesizedColumns = when {
49+ usesFts3Module || usesFts4Module -> {
50+ val columnNames = columnNameElements.map { it.name }
51+
52+ listOf (
53+ SynthesizedColumn (
54+ table = this ,
55+ acceptableValues = listOf (" docid" , " rowid" , " oid" , " _rowid_" , tableName.name)
56+ .filter { it !in columnNames },
57+ ),
58+ )
59+ }
60+ usesFts5Module -> {
61+ val columnNames = columnNameElements.map { it.name }
62+
63+ listOf (
64+ SynthesizedColumn (
65+ table = this ,
66+ acceptableValues = listOf (" rowid" , " _row_id_" , " rank" , tableName.name)
67+ .filter { it !in columnNames },
68+ ),
69+ )
70+ }
71+
72+ else -> emptyList()
6073 }
6174
6275 return LazyQuery (tableName) {
@@ -77,3 +90,12 @@ internal class CreateVirtualTableElementType(name: String) :
7790
7891val SqlCreateVirtualTableStmt .usesFtsModule: Boolean
7992 get() = this .moduleName?.text?.startsWith(prefix = " fts" , ignoreCase = true ) == true
93+
94+ val SqlCreateVirtualTableStmt .usesFts3Module: Boolean
95+ get() = this .moduleName?.text?.startsWith(prefix = " fts3" , ignoreCase = true ) == true
96+
97+ val SqlCreateVirtualTableStmt .usesFts4Module: Boolean
98+ get() = this .moduleName?.text?.startsWith(prefix = " fts4" , ignoreCase = true ) == true
99+
100+ val SqlCreateVirtualTableStmt .usesFts5Module: Boolean
101+ get() = this .moduleName?.text?.startsWith(prefix = " fts5" , ignoreCase = true ) == true
0 commit comments