@@ -42,13 +42,14 @@ proc needsRecompile(g: ModuleGraph; fileIdx: FileIndex; fullpath: string;
4242proc getModuleId * (g: ModuleGraph ; fileIdx: FileIndex ; fullpath: string ): int =
4343 if g.config.symbolFiles in {disabledSf, writeOnlySf}: return getID ()
4444 let module = g.incr.db.getRow (
45- sql " select id, fullHash from modules where fullpath = ?" , fullpath)
45+ sql " select id, fullHash, nimid from modules where fullpath = ?" , fullpath)
4646 let currentFullhash = hashFileCached (g.config, fileIdx, fullpath)
4747 if module[0 ].len == 0 :
48- result = int db.insertID (sql " insert into modules(fullpath, interfHash, fullHash) values (?, ?, ?)" ,
49- fullpath, " " , currentFullhash)
48+ result = getID ()
49+ db.exec (sql " insert into modules(fullpath, interfHash, fullHash, nimid) values (?, ?, ?, ?)" ,
50+ fullpath, " " , currentFullhash, result )
5051 else :
51- result = parseInt (module[0 ])
52+ result = parseInt (module[2 ])
5253 if currentFullhash == module[1 ]:
5354 # not changed, so use the cached AST:
5455 doAssert (result != 0 )
@@ -844,13 +845,14 @@ proc loadNode*(g: ModuleGraph; module: PSym): PNode =
844845 result .add decodeNode (g, b, module.info)
845846
846847 db.exec (sql " insert into controlblock(idgen) values (?)" , gFrontEndId)
847- echo result
848848 replay (g, module, result )
849849
850850proc setupModuleCache * (g: ModuleGraph ) =
851851 if g.config.symbolFiles == disabledSf: return
852852 g.recordStmt = recordStmt
853853 let dbfile = getNimcacheDir (g.config) / " rodfiles.db"
854+ if g.config.symbolFiles == writeOnlySf:
855+ removeFile (dbfile)
854856 if not fileExists (dbfile):
855857 db = open (connection= dbfile, user= " nim" , password= " " ,
856858 database= " nim" )
0 commit comments