Deinitialize the query result and release the connection as soon as possible.
This commit is contained in:
		
							parent
							
								
									a13949ca4d
								
							
						
					
					
						commit
						5b9cfd08c4
					
				
					 3 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -299,7 +299,8 @@ pub fn RepositoryInsert(comptime Model: type, comptime TableShape: type, comptim
 | 
			
		|||
			if (self.sql) |_| {} else { try self.buildSql(); }
 | 
			
		||||
 | 
			
		||||
			// Execute query and get its result.
 | 
			
		||||
			const queryResult = try self.execQuery();
 | 
			
		||||
			var queryResult = try self.execQuery();
 | 
			
		||||
			defer queryResult.deinit();
 | 
			
		||||
 | 
			
		||||
			//TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed.
 | 
			
		||||
			//TODO make a generic mapper and do it in repository.zig?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -216,7 +216,8 @@ pub fn RepositoryQuery(comptime Model: type, comptime TableShape: type, comptime
 | 
			
		|||
			if (self.sql) |_| {} else { try self.buildSql(); }
 | 
			
		||||
 | 
			
		||||
			// Execute query and get its result.
 | 
			
		||||
			const queryResult = try self.execQuery();
 | 
			
		||||
			var queryResult = try self.execQuery();
 | 
			
		||||
			defer queryResult.deinit();
 | 
			
		||||
 | 
			
		||||
			//TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed.
 | 
			
		||||
			//TODO make a generic mapper and do it in repository.zig?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -303,7 +303,8 @@ pub fn RepositoryUpdate(comptime Model: type, comptime TableShape: type, comptim
 | 
			
		|||
			if (self.sql) |_| {} else { try self.buildSql(); }
 | 
			
		||||
 | 
			
		||||
			// Execute query and get its result.
 | 
			
		||||
			const queryResult = try self.execQuery();
 | 
			
		||||
			var queryResult = try self.execQuery();
 | 
			
		||||
			defer queryResult.deinit();
 | 
			
		||||
 | 
			
		||||
			//TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed.
 | 
			
		||||
			//TODO make a generic mapper and do it in repository.zig?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue