* Replacing ValidPath rows doesn't work because it causes a constraint
violation of the Refs table. So don't do that.
This commit is contained in:
		
							parent
							
								
									a443c7573b
								
							
						
					
					
						commit
						d1f6c0cbe3
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -311,7 +311,7 @@ void LocalStore::openDB(bool create)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Prepare SQL statements. */
 | 
					    /* Prepare SQL statements. */
 | 
				
			||||||
    stmtRegisterValidPath.create(db,
 | 
					    stmtRegisterValidPath.create(db,
 | 
				
			||||||
        "insert or replace into ValidPaths (path, hash, registrationTime, deriver) values (?, ?, ?, ?);");
 | 
					        "insert into ValidPaths (path, hash, registrationTime, deriver) values (?, ?, ?, ?);");
 | 
				
			||||||
    stmtAddReference.create(db,
 | 
					    stmtAddReference.create(db,
 | 
				
			||||||
        "insert or replace into Refs (referrer, reference) values (?, ?);");
 | 
					        "insert or replace into Refs (referrer, reference) values (?, ?);");
 | 
				
			||||||
    stmtQueryPathInfo.create(db,
 | 
					    stmtQueryPathInfo.create(db,
 | 
				
			||||||
| 
						 | 
					@ -837,7 +837,10 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SQLiteTxn txn(db);
 | 
					    SQLiteTxn txn(db);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    foreach (ValidPathInfos::const_iterator, i, infos) addValidPath(*i);
 | 
					    foreach (ValidPathInfos::const_iterator, i, infos)
 | 
				
			||||||
 | 
					        /* !!! Maybe the registration info should be updated if the
 | 
				
			||||||
 | 
					           path is already valid. */
 | 
				
			||||||
 | 
					        if (!isValidPath(i->path)) addValidPath(*i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    foreach (ValidPathInfos::const_iterator, i, infos) {
 | 
					    foreach (ValidPathInfos::const_iterator, i, infos) {
 | 
				
			||||||
        unsigned long long referrer = queryValidPathId(i->path);
 | 
					        unsigned long long referrer = queryValidPathId(i->path);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue