@@ -579,12 +579,19 @@ void bugs::bug66871()
579
579
res= stmt->getResultSet ();
580
580
ASSERT (res->next ());
581
581
ASSERT_EQUALS (res->getInt (1 ), 2 );
582
+
582
583
}
583
584
catch (::sql::SQLException & /* e*/ )
584
585
{
586
+ delete res;
587
+ delete stmt;
588
+
585
589
return ; /* Everything is fine */
586
590
}
587
591
592
+ delete res;
593
+ delete stmt;
594
+
588
595
FAIL (" Exception wasn't thrown by execute" );
589
596
}
590
597
@@ -732,6 +739,70 @@ void bugs::bug66235()
732
739
}
733
740
}
734
741
742
+ void bugs::bug21066575 ()
743
+ {
744
+ logMsg (" bug::bug21066575" );
745
+ try
746
+ {
747
+
748
+
749
+ stmt.reset (con->createStatement ());
750
+ stmt->execute (" DROP TABLE IF EXISTS bug21066575" );
751
+ stmt->execute (" CREATE TABLE bug21066575(txt text)" );
752
+ stmt->execute (" INSERT INTO bug21066575(txt) VALUES('abc')" );
753
+
754
+ pstmt.reset (con->prepareStatement (" select * from bug21066575" ));
755
+
756
+ for (int i = 0 ; i < 10 ; ++i)
757
+ {
758
+ res.reset (pstmt->executeQuery ());
759
+ res->next ();
760
+ ASSERT_EQUALS (" abc" , res->getString (1 ));
761
+ }
762
+
763
+ stmt->execute (" DROP TABLE IF EXISTS bug21066575_2" );
764
+
765
+ stmt->execute (" CREATE TABLE `bug21066575_2` (\
766
+ `f1` longtext,\
767
+ `id` int(11) NOT NULL AUTO_INCREMENT,\
768
+ PRIMARY KEY (`id`)\
769
+ ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1" );
770
+
771
+ stmt->execute (" insert into bug21066575_2(f1) values(repeat('f',1024000)),"
772
+ " (repeat('f',1024000)),"
773
+ " (repeat('f',1024000)),"
774
+ " (repeat('f',1024000))" );
775
+
776
+ // Detect with Valgrind if there are memory leaks
777
+ for (int i= 0 ; i < 100 ; i++)
778
+ {
779
+ pstmt.reset (con->prepareStatement (" select id, f1 from bug21066575_2" ));
780
+
781
+ // pstmt->setInt(1, i);
782
+ res.reset (pstmt->executeQuery ());
783
+ while (res->next ()) {
784
+ std::stringstream ss;
785
+ ss << " id = " << res->getInt (1 );
786
+ ss << std::endl;
787
+ ss << " f1 = " << res->getString (2 );
788
+ logMsg (ss.str ().c_str ());
789
+ }
790
+ }
791
+
792
+ res.reset ();
793
+ pstmt.reset ();
794
+
795
+ sleep (1 );
796
+
797
+ stmt->execute (" DROP TABLE IF EXISTS test" );
798
+ }
799
+ catch (sql::SQLException &e)
800
+ {
801
+ logErr (e.what ());
802
+ logErr (" SQLState: " + std::string (e.getSQLState ()));
803
+ fail (e.what (), __FILE__, __LINE__);
804
+ }
805
+ }
735
806
736
807
void bugs::bug14520822 ()
737
808
{
0 commit comments