mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 09:47:30 +03:00 
			
		
		
		
	Fixed NamedTupleCursor.executemany() (ticket #65)
This commit is contained in:
		
							parent
							
								
									a2ee25ecfe
								
							
						
					
					
						commit
						9870ca4dce
					
				
							
								
								
									
										1
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								NEWS
									
									
									
									
									
								
							| 
						 | 
					@ -6,6 +6,7 @@ What's new in psycopg 2.4.3
 | 
				
			||||||
  - Rollback connections in transaction or in error before putting them
 | 
					  - Rollback connections in transaction or in error before putting them
 | 
				
			||||||
    back into a pool. Also discard broken connections (ticket #62).
 | 
					    back into a pool. Also discard broken connections (ticket #62).
 | 
				
			||||||
  - Lazy import of the slow uuid module, thanks to Marko Kreen.
 | 
					  - Lazy import of the slow uuid module, thanks to Marko Kreen.
 | 
				
			||||||
 | 
					  - Fixed NamedTupleCursor.executemany() (ticket #65).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
What's new in psycopg 2.4.2
 | 
					What's new in psycopg 2.4.2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -275,7 +275,7 @@ class NamedTupleCursor(_cursor):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def executemany(self, query, vars):
 | 
					    def executemany(self, query, vars):
 | 
				
			||||||
        self.Record = None
 | 
					        self.Record = None
 | 
				
			||||||
        return _cursor.executemany(self, vars)
 | 
					        return _cursor.executemany(self, query, vars)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def callproc(self, procname, vars=None):
 | 
					    def callproc(self, procname, vars=None):
 | 
				
			||||||
        self.Record = None
 | 
					        self.Record = None
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,6 +171,17 @@ class NamedTupleCursorTest(unittest.TestCase):
 | 
				
			||||||
        self.assertEqual(res[2].i, 3)
 | 
					        self.assertEqual(res[2].i, 3)
 | 
				
			||||||
        self.assertEqual(res[2].s, 'baz')
 | 
					        self.assertEqual(res[2].s, 'baz')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @skip_if_no_namedtuple
 | 
				
			||||||
 | 
					    def test_executemany(self):
 | 
				
			||||||
 | 
					        curs = self.conn.cursor()
 | 
				
			||||||
 | 
					        curs.executemany("delete from nttest where i = %s",
 | 
				
			||||||
 | 
					            [(1,), (2,)])
 | 
				
			||||||
 | 
					        curs.execute("select * from nttest order by 1")
 | 
				
			||||||
 | 
					        res = curs.fetchall()
 | 
				
			||||||
 | 
					        self.assertEqual(1, len(res))
 | 
				
			||||||
 | 
					        self.assertEqual(res[0].i, 3)
 | 
				
			||||||
 | 
					        self.assertEqual(res[0].s, 'baz')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @skip_if_no_namedtuple
 | 
					    @skip_if_no_namedtuple
 | 
				
			||||||
    def test_iter(self):
 | 
					    def test_iter(self):
 | 
				
			||||||
        curs = self.conn.cursor()
 | 
					        curs = self.conn.cursor()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user