@@ -769,6 +769,50 @@ DECLARE_TEST(t_bug11750296)
769
769
}
770
770
771
771
772
+ DECLARE_TEST (t_bug25671389 )
773
+ {
774
+ DECLARE_BASIC_HANDLES (henv1 , hdbc1 , hstmt1 );
775
+
776
+ SQLINTEGER connection_id ;
777
+ SQLCHAR buf [255 ];
778
+ SQLHSTMT hstmt2 ;
779
+
780
+ SQLRETURN rc = SQL_ERROR ;
781
+ SQLCHAR sqlState [6 ] = { '\0' };
782
+ SQLCHAR eMsg [SQL_MAX_MESSAGE_LENGTH ] = { '\0' };
783
+ SQLINTEGER nError = 0 ;
784
+ SQLSMALLINT msgLen = 0 ;
785
+
786
+ is (OK == alloc_basic_handles (& henv1 , & hdbc1 , & hstmt1 ));
787
+ /* The bug is repeatable when limit is set and two STMTs exist */
788
+ ok_con (hdbc1 , SQLAllocHandle (SQL_HANDLE_STMT , hdbc1 , & hstmt2 ));
789
+ ok_stmt (hstmt2 , SQLSetStmtAttr (hstmt2 , SQL_ATTR_MAX_ROWS , (SQLPOINTER )100 , 0 ));
790
+
791
+ ok_sql (hstmt1 , "SELECT connection_id()" );
792
+ ok_stmt (hstmt1 , SQLFetch (hstmt1 ));
793
+ connection_id = my_fetch_int (hstmt1 , 1 );
794
+ ok_stmt (hstmt1 , SQLFreeStmt (hstmt1 , SQL_CLOSE ));
795
+
796
+ /* From another connection, kill the connection created above */
797
+ sprintf (buf , "KILL %d" , connection_id );
798
+ ok_stmt (hstmt , SQLExecDirect (hstmt , (SQLCHAR * )buf , SQL_NTS ));
799
+
800
+ /* Now check that the connection killed returns the right SQLSTATE */
801
+ expect_sql (hstmt2 , "SELECT connection_id()" , SQL_ERROR );
802
+
803
+ rc = SQLGetDiagRec (SQL_HANDLE_STMT , hstmt2 , 1 , sqlState , & nError , eMsg , sizeof (eMsg ), & msgLen );
804
+ /* Check that the error has been properly reported */
805
+ is (rc == SQL_SUCCESS );
806
+ is (nError > 0 );
807
+ is (strlen (sqlState ) > 0 );
808
+ is (strlen (eMsg ) > 0 );
809
+ is (msgLen > 0 );
810
+
811
+ free_basic_handles (& henv1 , & hdbc1 , & hstmt1 );
812
+ return OK ;
813
+ }
814
+
815
+
772
816
BEGIN_TESTS
773
817
#ifndef NO_DRIVERMANAGER
774
818
#ifndef USE_IODBC
@@ -785,6 +829,7 @@ BEGIN_TESTS
785
829
ADD_TEST (t_warning )
786
830
ADD_TEST (t_bug3456 )
787
831
ADD_TEST (t_bug16224 )
832
+ ADD_TEST (t_bug25671389 )
788
833
#ifndef USE_IODBC
789
834
ADD_TEST (bind_invalidcol )
790
835
ADD_TEST (t_handle_err )
0 commit comments