@@ -791,5 +791,62 @@ def test_1265_prefetchrows(self):
791791 cursor .execute ("select IntCol from TestTempTable" ).fetchall ()
792792 self .assertRoundTrips (2 )
793793
794+ def test_1266_refcursor_prefetchrows (self ):
795+ "1266 - test prefetch rows and arraysize using a refcursor"
796+ self .setup_round_trip_checker ()
797+
798+ # simple DDL only requires a single round trip
799+ with self .connection .cursor () as cursor :
800+ cursor .execute ("truncate table TestTempTable" )
801+ self .assertRoundTrips (1 )
802+
803+ # array execution only requires a single round trip
804+ num_rows = 590
805+ with self .connection .cursor () as cursor :
806+ sql = "insert into TestTempTable (IntCol) values (:1)"
807+ data = [(n + 1 ,) for n in range (num_rows )]
808+ cursor .executemany (sql , data )
809+ self .assertRoundTrips (1 )
810+
811+ # create refcursor and execute stored procedure
812+ with self .connection .cursor () as cursor :
813+ refcursor = self .connection .cursor ()
814+ refcursor .prefetchrows = 300
815+ refcursor .arraysize = 300
816+ cursor .callproc ("myrefcursorproc" , [refcursor ])
817+ refcursor .fetchall ()
818+ self .assertRoundTrips (2 )
819+
820+ def test_1267_existing_cursor_prefetchrows (self ):
821+ "1267 - test prefetch rows using existing cursor"
822+ self .setup_round_trip_checker ()
823+
824+ # Set prefetch rows on an existing cursor
825+ num_rows = 590
826+ with self .connection .cursor () as cursor :
827+ cursor .execute ("truncate table TestTempTable" )
828+ sql = "insert into TestTempTable (IntCol) values (:1)"
829+ data = [(n + 1 ,) for n in range (num_rows )]
830+ cursor .executemany (sql , data )
831+ cursor .prefetchrows = 300
832+ cursor .arraysize = 300
833+ cursor .execute ("select IntCol from TestTempTable" ).fetchall ()
834+ self .assertRoundTrips (4 )
835+
836+ def test_1268_bind_names_with_single_line_comments (self ):
837+ "1268 - test bindnames() with single line comments"
838+ self .cursor .prepare ("""--begin :value2 := :a + :b + :c +:a +3; end;
839+ begin :value2 := :a + :c +3; end;
840+ """ )
841+ self .assertEqual (self .cursor .bindnames (), ["VALUE2" , "A" , "C" ])
842+
843+ def test_1269_bind_names_with_multi_line_comments (self ):
844+ "1269 - test bindnames() with multi line comments"
845+ self .cursor .prepare ("""/*--select * from :a where :a = 1
846+ select * from table_names where :a = 1*/
847+ select * from :table_name where :value = 1
848+ """ )
849+ self .assertEqual (self .cursor .bindnames (), ["TABLE_NAME" , "VALUE" ])
850+
794851if __name__ == "__main__" :
795852 base .run_test_cases ()
0 commit comments