mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Ignore SQL comments in query console
This commit is contained in:
		
							parent
							
								
									6f16b4caec
								
							
						
					
					
						commit
						af053b61fc
					
				@ -37,6 +37,11 @@ function execute(req) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            while (query.startsWith('-- ') {
 | 
			
		||||
                // Query starts with one or more SQL comments, discard these before we execute.
 | 
			
		||||
                query = query.substr(query.indexOf('\n') + 1)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (query.toLowerCase().startsWith('select') || query.toLowerCase().startsWith('with')) {
 | 
			
		||||
                results.push(sql.getRows(query));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user