fix(db): edit add_selected_property fn to Insert URL if it does not exists.
This commit is contained in:
		
					parent
					
						
							
								04457fef62
							
						
					
				
			
			
				commit
				
					
						6c2442a82b
					
				
			
		
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -552,6 +552,12 @@ mod db_impl {
 | 
				
			||||||
            let mut conn = self.conn.lock().await;
 | 
					            let mut conn = self.conn.lock().await;
 | 
				
			||||||
            let tx = conn.transaction()?;
 | 
					            let tx = conn.transaction()?;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
					            // Insert URL if it does not exists
 | 
				
			||||||
 | 
					            tx.execute(
 | 
				
			||||||
 | 
					                "INSERT OR IGNORE INTO urls (url) VALUES (?)",
 | 
				
			||||||
 | 
					                [url]
 | 
				
			||||||
 | 
					            )?;
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            // Get URL ID
 | 
					            // Get URL ID
 | 
				
			||||||
            let url_id = tx.query_row(
 | 
					            let url_id = tx.query_row(
 | 
				
			||||||
                "SELECT id FROM urls WHERE url = ?",
 | 
					                "SELECT id FROM urls WHERE url = ?",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue