From 5e42b191eaee6ebd844aa2d8243e05cb68d31830 Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 24 Mar 2017 15:46:53 -0700 Subject: [PATCH 01/24] Implementing new cache to remove unnecessary ODBC calls --- source/shared/core_sqlsrv.h | 1 + source/shared/core_stmt.cpp | 57 ++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h index 55c0678b..c194ca5a 100644 --- a/source/shared/core_sqlsrv.h +++ b/source/shared/core_sqlsrv.h @@ -1308,6 +1308,7 @@ struct sqlsrv_stmt : public sqlsrv_context { unsigned int current_stream_read; // # of bytes read so far. (if we read an empty PHP stream, we send an empty string // to the server) zval field_cache; // cache for a single row of fields, to allow multiple and out of order retrievals + zval col_cache; // Used by get_field_as_string not to call SQLColAttribute() after every fetch. zval active_stream; // the currently active stream reading data from the database sqlsrv_stmt( sqlsrv_conn* c, SQLHANDLE handle, error_callback e, void* drv TSRMLS_DC ); diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index 9dd505ec..ec700974 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -48,6 +48,18 @@ struct field_cache { // rely on the hash table destructor to free the memory }; +// Used to cache display size and SQL type of a column in get_field_as_string() +struct col_cache { + SQLLEN sql_type; + SQLLEN display_size; + + col_cache( SQLLEN col_sql_type, SQLLEN col_display_size ) + { + sql_type = col_sql_type; + display_size = col_display_size; + } +}; + const int INITIAL_FIELD_STRING_LEN = 256; // base allocation size when retrieving a string field // UTF-8 tags for byte length of characters, used by streams to make sure we don't clip a character in between reads @@ -89,6 +101,7 @@ void default_sql_size_and_scale( sqlsrv_stmt* stmt, unsigned int paramno, zval* // given a zval and encoding, determine the appropriate sql type, column size, and decimal scale (if appropriate) void default_sql_type( sqlsrv_stmt* stmt, SQLULEN paramno, zval* param_z, SQLSRV_ENCODING encoding, _Out_ SQLSMALLINT& sql_type TSRMLS_DC ); +void col_cache_dtor( zval* data_z ); void field_cache_dtor( zval* data_z ); void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC ); void get_field_as_string( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, sqlsrv_phptype sqlsrv_php_type, @@ -144,6 +157,10 @@ sqlsrv_stmt::sqlsrv_stmt( sqlsrv_conn* c, SQLHANDLE handle, error_callback e, vo ZVAL_NEW_ARR( &output_params ); core::sqlsrv_zend_hash_init(*conn, Z_ARRVAL( output_params ), 5 /* # of buckets */, sqlsrv_output_param_dtor, 0 /*persistent*/ TSRMLS_CC); + // initialize the col cache + ZVAL_NEW_ARR( &col_cache ); + core::sqlsrv_zend_hash_init( *conn, Z_ARRVAL(col_cache), 5 /* # of buckets */, col_cache_dtor, 0 /*persistent*/ TSRMLS_CC ); + // initialize the field cache ZVAL_NEW_ARR( &field_cache ); core::sqlsrv_zend_hash_init(*conn, Z_ARRVAL(field_cache), 5 /* # of buckets */, field_cache_dtor, 0 /*persistent*/ TSRMLS_CC); @@ -169,6 +186,7 @@ sqlsrv_stmt::~sqlsrv_stmt( void ) zval_ptr_dtor( &output_params ); zval_ptr_dtor( ¶m_streams ); zval_ptr_dtor( ¶m_datetime_buffers ); + zval_ptr_dtor( &col_cache ); zval_ptr_dtor( &field_cache ); } @@ -184,6 +202,7 @@ void sqlsrv_stmt::free_param_data( TSRMLS_D ) zend_hash_clean( Z_ARRVAL( output_params )); zend_hash_clean( Z_ARRVAL( param_streams )); zend_hash_clean( Z_ARRVAL( param_datetime_buffers )); + zend_hash_clean( Z_ARRVAL( col_cache )); zend_hash_clean( Z_ARRVAL( field_cache )); } @@ -755,12 +774,13 @@ bool core_sqlsrv_fetch( sqlsrv_stmt* stmt, SQLSMALLINT fetch_orientation, SQLULE CHECK_CUSTOM_ERROR( stmt->past_fetch_end, stmt, SQLSRV_ERROR_FETCH_PAST_END ) { throw core::CoreException(); } - - SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC ); - - CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) { - throw core::CoreException(); - } + // First time only + if ( !stmt->fetch_called ) { + SQLSMALLINT has_fields = core::SQLNumResultCols(stmt TSRMLS_CC); + CHECK_CUSTOM_ERROR(has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS) { + throw core::CoreException(); + } + } // close the stream to release the resource close_active_stream( stmt TSRMLS_CC ); @@ -1971,6 +1991,12 @@ void default_sql_size_and_scale( sqlsrv_stmt* stmt, unsigned int paramno, zval* } } +void col_cache_dtor( zval* data_z ) +{ + col_cache* cache = static_cast( Z_PTR_P( data_z )); + sqlsrv_free( cache ); +} + void field_cache_dtor( zval* data_z ) { field_cache* cache = static_cast( Z_PTR_P( data_z )); @@ -2132,11 +2158,22 @@ void get_field_as_string( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, sqlsrv_ph break; } - // Get the SQL type of the field. unixODBC 2.3.1 requires wide calls to support pooling - core::SQLColAttributeW( stmt, field_index + 1, SQL_DESC_CONCISE_TYPE, NULL, 0, NULL, &sql_field_type TSRMLS_CC ); + col_cache* cached = NULL; + if ( NULL != ( cached = static_cast( zend_hash_index_find_ptr( Z_ARRVAL( stmt->col_cache ), static_cast< zend_ulong >( field_index ))))) { + sql_field_type = cached->sql_type; + sql_display_size = cached->display_size; + } + else { + // Get the SQL type of the field. unixODBC 2.3.1 requires wide calls to support pooling + core::SQLColAttributeW( stmt, field_index + 1, SQL_DESC_CONCISE_TYPE, NULL, 0, NULL, &sql_field_type TSRMLS_CC ); + + // Calculate the field size. + calc_string_size( stmt, field_index, sql_field_type, sql_display_size TSRMLS_CC ); + + col_cache cache( sql_field_type, sql_display_size ); + core::sqlsrv_zend_hash_index_update_mem( *stmt, Z_ARRVAL( stmt->col_cache ), field_index, &cache, sizeof( col_cache ) TSRMLS_CC ); + } - // Calculate the field size. - calc_string_size( stmt, field_index, sql_field_type, sql_display_size TSRMLS_CC ); // if this is a large type, then read the first few bytes to get the actual length from SQLGetData if( sql_display_size == 0 || sql_display_size == INT_MAX || From 27bae233c0033764a4b681bfeaedcc1061304b68 Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 24 Mar 2017 15:53:41 -0700 Subject: [PATCH 02/24] Update identation --- source/shared/core_sqlsrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h index c194ca5a..5ab2caa7 100644 --- a/source/shared/core_sqlsrv.h +++ b/source/shared/core_sqlsrv.h @@ -1308,7 +1308,7 @@ struct sqlsrv_stmt : public sqlsrv_context { unsigned int current_stream_read; // # of bytes read so far. (if we read an empty PHP stream, we send an empty string // to the server) zval field_cache; // cache for a single row of fields, to allow multiple and out of order retrievals - zval col_cache; // Used by get_field_as_string not to call SQLColAttribute() after every fetch. + zval col_cache; // Used by get_field_as_string not to call SQLColAttribute() after every fetch. zval active_stream; // the currently active stream reading data from the database sqlsrv_stmt( sqlsrv_conn* c, SQLHANDLE handle, error_callback e, void* drv TSRMLS_DC ); From 4339bad6948fe0b7c685e80d8766cecf9a56ec09 Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 24 Mar 2017 16:01:45 -0700 Subject: [PATCH 03/24] Update identation --- source/shared/core_stmt.cpp | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index ec700974..cb0ba2e2 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -50,14 +50,14 @@ struct field_cache { // Used to cache display size and SQL type of a column in get_field_as_string() struct col_cache { - SQLLEN sql_type; - SQLLEN display_size; + SQLLEN sql_type; + SQLLEN display_size; - col_cache( SQLLEN col_sql_type, SQLLEN col_display_size ) - { - sql_type = col_sql_type; + col_cache( SQLLEN col_sql_type, SQLLEN col_display_size ) + { + sql_type = col_sql_type; display_size = col_display_size; - } + } }; const int INITIAL_FIELD_STRING_LEN = 256; // base allocation size when retrieving a string field @@ -157,9 +157,9 @@ sqlsrv_stmt::sqlsrv_stmt( sqlsrv_conn* c, SQLHANDLE handle, error_callback e, vo ZVAL_NEW_ARR( &output_params ); core::sqlsrv_zend_hash_init(*conn, Z_ARRVAL( output_params ), 5 /* # of buckets */, sqlsrv_output_param_dtor, 0 /*persistent*/ TSRMLS_CC); - // initialize the col cache - ZVAL_NEW_ARR( &col_cache ); - core::sqlsrv_zend_hash_init( *conn, Z_ARRVAL(col_cache), 5 /* # of buckets */, col_cache_dtor, 0 /*persistent*/ TSRMLS_CC ); + // initialize the col cache + ZVAL_NEW_ARR( &col_cache ); + core::sqlsrv_zend_hash_init( *conn, Z_ARRVAL(col_cache), 5 /* # of buckets */, col_cache_dtor, 0 /*persistent*/ TSRMLS_CC ); // initialize the field cache ZVAL_NEW_ARR( &field_cache ); @@ -186,7 +186,7 @@ sqlsrv_stmt::~sqlsrv_stmt( void ) zval_ptr_dtor( &output_params ); zval_ptr_dtor( ¶m_streams ); zval_ptr_dtor( ¶m_datetime_buffers ); - zval_ptr_dtor( &col_cache ); + zval_ptr_dtor( &col_cache ); zval_ptr_dtor( &field_cache ); } @@ -202,7 +202,7 @@ void sqlsrv_stmt::free_param_data( TSRMLS_D ) zend_hash_clean( Z_ARRVAL( output_params )); zend_hash_clean( Z_ARRVAL( param_streams )); zend_hash_clean( Z_ARRVAL( param_datetime_buffers )); - zend_hash_clean( Z_ARRVAL( col_cache )); + zend_hash_clean( Z_ARRVAL( col_cache )); zend_hash_clean( Z_ARRVAL( field_cache )); } @@ -775,12 +775,12 @@ bool core_sqlsrv_fetch( sqlsrv_stmt* stmt, SQLSMALLINT fetch_orientation, SQLULE throw core::CoreException(); } // First time only - if ( !stmt->fetch_called ) { - SQLSMALLINT has_fields = core::SQLNumResultCols(stmt TSRMLS_CC); - CHECK_CUSTOM_ERROR(has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS) { - throw core::CoreException(); - } - } + if ( !stmt->fetch_called ) { + SQLSMALLINT has_fields = core::SQLNumResultCols(stmt TSRMLS_CC); + CHECK_CUSTOM_ERROR(has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS) { + throw core::CoreException(); + } + } // close the stream to release the resource close_active_stream( stmt TSRMLS_CC ); @@ -1993,8 +1993,8 @@ void default_sql_size_and_scale( sqlsrv_stmt* stmt, unsigned int paramno, zval* void col_cache_dtor( zval* data_z ) { - col_cache* cache = static_cast( Z_PTR_P( data_z )); - sqlsrv_free( cache ); + col_cache* cache = static_cast( Z_PTR_P( data_z )); + sqlsrv_free( cache ); } void field_cache_dtor( zval* data_z ) From 48e99149860cad4b21f2f6c1534cb7ea225a9d45 Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 24 Mar 2017 17:03:24 -0700 Subject: [PATCH 04/24] Update spaces --- source/shared/core_stmt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index cb0ba2e2..fa3af746 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -776,8 +776,8 @@ bool core_sqlsrv_fetch( sqlsrv_stmt* stmt, SQLSMALLINT fetch_orientation, SQLULE } // First time only if ( !stmt->fetch_called ) { - SQLSMALLINT has_fields = core::SQLNumResultCols(stmt TSRMLS_CC); - CHECK_CUSTOM_ERROR(has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS) { + SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC ); + CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) { throw core::CoreException(); } } From f835c34319f0fd47d47bc4eb165d27bb7c5276ee Mon Sep 17 00:00:00 2001 From: ulvii Date: Fri, 24 Mar 2017 17:12:10 -0700 Subject: [PATCH 05/24] Update core_stmt.cpp --- source/shared/core_stmt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index fa3af746..011349fd 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -774,7 +774,7 @@ bool core_sqlsrv_fetch( sqlsrv_stmt* stmt, SQLSMALLINT fetch_orientation, SQLULE CHECK_CUSTOM_ERROR( stmt->past_fetch_end, stmt, SQLSRV_ERROR_FETCH_PAST_END ) { throw core::CoreException(); } - // First time only + // First time only if ( !stmt->fetch_called ) { SQLSMALLINT has_fields = core::SQLNumResultCols( stmt TSRMLS_CC ); CHECK_CUSTOM_ERROR( has_fields == 0, stmt, SQLSRV_ERROR_NO_FIELDS ) { From 80b510ef2f4da533deeeb14e7baadf257ed2f914 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 12:57:18 -0700 Subject: [PATCH 06/24] removing tabs --- source/shared/core_sqlsrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/core_sqlsrv.h b/source/shared/core_sqlsrv.h index 5ab2caa7..4adb72e8 100644 --- a/source/shared/core_sqlsrv.h +++ b/source/shared/core_sqlsrv.h @@ -1308,7 +1308,7 @@ struct sqlsrv_stmt : public sqlsrv_context { unsigned int current_stream_read; // # of bytes read so far. (if we read an empty PHP stream, we send an empty string // to the server) zval field_cache; // cache for a single row of fields, to allow multiple and out of order retrievals - zval col_cache; // Used by get_field_as_string not to call SQLColAttribute() after every fetch. + zval col_cache; // Used by get_field_as_string not to call SQLColAttribute() after every fetch. zval active_stream; // the currently active stream reading data from the database sqlsrv_stmt( sqlsrv_conn* c, SQLHANDLE handle, error_callback e, void* drv TSRMLS_DC ); From b883ee47e45c6c10e28831c5bee0acae0548d411 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 12:58:42 -0700 Subject: [PATCH 07/24] Update core_stmt.cpp --- source/shared/core_stmt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index 011349fd..bb340d2a 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -2159,7 +2159,7 @@ void get_field_as_string( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, sqlsrv_ph } col_cache* cached = NULL; - if ( NULL != ( cached = static_cast( zend_hash_index_find_ptr( Z_ARRVAL( stmt->col_cache ), static_cast< zend_ulong >( field_index ))))) { + if ( NULL != ( cached = static_cast< col_cache* >( zend_hash_index_find_ptr( Z_ARRVAL( stmt->col_cache ), static_cast< zend_ulong >( field_index ))))) { sql_field_type = cached->sql_type; sql_display_size = cached->display_size; } From d0aed143dcfbfdf17b7b92782ac1a3802d9d06ae Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 15:24:41 -0700 Subject: [PATCH 08/24] Clear Cache before next results set We need to clear cache if a statement has multiple rowsets. --- source/shared/core_stmt.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index bb340d2a..2c73f5fd 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -1034,6 +1034,9 @@ void core_sqlsrv_next_result( sqlsrv_stmt* stmt TSRMLS_DC, bool finalize_output_ close_active_stream( stmt TSRMLS_CC ); + //Clear column sql types and sql display sizes. + zend_hash_clean( Z_ARRVAL( stmt->col_cache )); + SQLRETURN r; if( throw_on_errors ) { r = core::SQLMoreResults( stmt TSRMLS_CC ); From 3d7a4726263ee10e3cc00039418ddd5339061b6c Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 17:26:59 -0700 Subject: [PATCH 09/24] Print diff file contents Adding script to print out diff file contents, if there are failing tests --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index de98b18d..564f0a86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ script: - docker ps -a - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt + - docker exec client for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done + - docker exec client for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From e6d55ad632294440d351d291246e5ebc28f42d99 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 17:41:02 -0700 Subject: [PATCH 10/24] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 564f0a86..abacf657 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ script: - docker ps -a - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt - - docker exec client for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done - - docker exec client for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done + - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done' + - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done' - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From 7c3206ae786d4390ce867e259830c59a13d1836e Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:11:10 -0700 Subject: [PATCH 11/24] Fixing regex --- test/sqlsrv/sqlsrv_statement_cancel.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlsrv/sqlsrv_statement_cancel.phpt b/test/sqlsrv/sqlsrv_statement_cancel.phpt index 4efaed9e..48fee5f0 100644 --- a/test/sqlsrv/sqlsrv_statement_cancel.phpt +++ b/test/sqlsrv/sqlsrv_statement_cancel.phpt @@ -97,7 +97,7 @@ Repro(); --EXPECTREGEX--  ...Starting 'sqlsrv_statement_cancel' test... -\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])( Function sequence error|Associated statement is not prepared) +\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])(Function sequence error|Associated statement is not prepared) 0 (HY010|HY007) From 3d48ce5a7b454c278ede635afa0365b4c3968ece Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:12:34 -0700 Subject: [PATCH 12/24] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index abacf657..f1d18f3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ script: - docker ps -a - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt - - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done' - - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done' + - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done' + - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done' - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From 872584a5123c646fef819e32944b00f79918a4ce Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:21:48 -0700 Subject: [PATCH 13/24] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1d18f3a..abacf657 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ script: - docker ps -a - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt - - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done' - - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done' + - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done' + - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done' - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From 96237e1dcd536a0d061db8276a93ab099fb83f80 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:33:46 -0700 Subject: [PATCH 14/24] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index abacf657..14328503 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ script: - docker ps -a - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt - - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f; cat $f; done' - - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f; cat $f; done' + - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' + - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From 234b123fd795c1d0fde1e39811f6853a099f9531 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:42:58 -0700 Subject: [PATCH 15/24] Update sqlsrv_statement_cancel.phpt --- test/sqlsrv/sqlsrv_statement_cancel.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlsrv/sqlsrv_statement_cancel.phpt b/test/sqlsrv/sqlsrv_statement_cancel.phpt index 48fee5f0..4efaed9e 100644 --- a/test/sqlsrv/sqlsrv_statement_cancel.phpt +++ b/test/sqlsrv/sqlsrv_statement_cancel.phpt @@ -97,7 +97,7 @@ Repro(); --EXPECTREGEX--  ...Starting 'sqlsrv_statement_cancel' test... -\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])(Function sequence error|Associated statement is not prepared) +\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])( Function sequence error|Associated statement is not prepared) 0 (HY010|HY007) From c870f0803b6c4c3a1fcf491aef84829458329cc8 Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 27 Mar 2017 18:44:57 -0700 Subject: [PATCH 16/24] Remove buggy lines Removed $file.out. In case of failing tests, this would become failing_test.diff.out --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 98edf750..2d0c1566 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -167,9 +167,9 @@ after_test: - cd %APPVEYOR_BUILD_FOLDER%\test\ - python output.py - ps: $files = Get-ChildItem sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} + - ps: foreach($file in $files){ls $file; more $file"} - ps: $files = Get-ChildItem pdo_sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} + - ps: foreach($file in $files){ls $file; more $file"} - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult1.xml)) - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult2.xml)) - ps: >- @@ -181,4 +181,4 @@ after_test: { $host.SetShouldExit(1); Write-Host "Forcing build failure due to phpt unit test failure(s)"; - } \ No newline at end of file + } From 1b298389fef57e6d56abec8c3bfd1d941322626d Mon Sep 17 00:00:00 2001 From: ulvii Date: Tue, 28 Mar 2017 10:46:04 -0700 Subject: [PATCH 17/24] Update appveyor.yml --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2d0c1566..0c0d8fb4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -167,9 +167,9 @@ after_test: - cd %APPVEYOR_BUILD_FOLDER%\test\ - python output.py - ps: $files = Get-ChildItem sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file"} + - ps: foreach($file in $files){ls $file; more $file} - ps: $files = Get-ChildItem pdo_sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file"} + - ps: foreach($file in $files){ls $file; more $file} - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult1.xml)) - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult2.xml)) - ps: >- From 80cc2f8675fce6e7a0846f3e68738e9957de4dad Mon Sep 17 00:00:00 2001 From: ulvii Date: Thu, 30 Mar 2017 10:18:15 -0700 Subject: [PATCH 18/24] Update sqlsrv_statement_cancel.phpt On Linux, the message returned by unixODBC does not have a space after [ODBC Driver Manager] --- test/sqlsrv/sqlsrv_statement_cancel.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlsrv/sqlsrv_statement_cancel.phpt b/test/sqlsrv/sqlsrv_statement_cancel.phpt index 4efaed9e..21fc4fea 100644 --- a/test/sqlsrv/sqlsrv_statement_cancel.phpt +++ b/test/sqlsrv/sqlsrv_statement_cancel.phpt @@ -97,7 +97,7 @@ Repro(); --EXPECTREGEX--  ...Starting 'sqlsrv_statement_cancel' test... -\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])( Function sequence error|Associated statement is not prepared) +\[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])([ ]{0,1}Function sequence error) 0 (HY010|HY007) From 0fd7337b9e33fab03aeb7903aba4ecd7ca941f24 Mon Sep 17 00:00:00 2001 From: ulvii Date: Thu, 30 Mar 2017 10:29:08 -0700 Subject: [PATCH 19/24] Undoing changes to appveyor.yml Undoing changes, because there is another pull request that fixes the issue --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0c0d8fb4..358ebb0a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -167,9 +167,9 @@ after_test: - cd %APPVEYOR_BUILD_FOLDER%\test\ - python output.py - ps: $files = Get-ChildItem sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file} + - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} - ps: $files = Get-ChildItem pdo_sqlsrv\*.diff - - ps: foreach($file in $files){ls $file; more $file} + - ps: foreach($file in $files){ls $file; more $file; more "$file.out"} - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult1.xml)) - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult2.xml)) - ps: >- From 8dbdf890a1a77faedc7cff98022c85da732b0658 Mon Sep 17 00:00:00 2001 From: ulvii Date: Thu, 30 Mar 2017 11:01:29 -0700 Subject: [PATCH 20/24] Travis : print .out files too --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 14328503..9051dc43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,9 @@ script: - docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt - docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt - docker exec client bash -c 'for f in ./test/sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' + - docker exec client bash -c 'for f in ./test/sqlsrv/*.out; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' + - docker exec client bash -c 'for f in ./test/pdo_sqlsrv/*.out; do ls $f 2>/dev/null; cat $f 2>/dev/null; done || true' - docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp' - docker stop client - docker ps -a From a7cd638b87003a4232eabdc0e957fb40132acc1c Mon Sep 17 00:00:00 2001 From: ulvii Date: Thu, 30 Mar 2017 11:16:16 -0700 Subject: [PATCH 22/24] Update sqlsrv_statement_cancel.phpt --- test/sqlsrv/sqlsrv_statement_cancel.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlsrv/sqlsrv_statement_cancel.phpt b/test/sqlsrv/sqlsrv_statement_cancel.phpt index 21fc4fea..a8edd256 100644 --- a/test/sqlsrv/sqlsrv_statement_cancel.phpt +++ b/test/sqlsrv/sqlsrv_statement_cancel.phpt @@ -99,7 +99,7 @@ Repro(); ...Starting 'sqlsrv_statement_cancel' test... \[Microsoft\](\[ODBC Driver 13 for SQL Server\]|\[ODBC Driver Manager\])([ ]{0,1}Function sequence error) 0 -(HY010|HY007) +(HY010) Done ...Test 'sqlsrv_statement_cancel' completed successfully. From b003b0156dfd769d09ec7896ed1e400fe61f8337 Mon Sep 17 00:00:00 2001 From: ulvii Date: Thu, 30 Mar 2017 12:27:32 -0700 Subject: [PATCH 23/24] Update appveyor.yml --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 358ebb0a..3c9eba19 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -182,3 +182,4 @@ after_test: $host.SetShouldExit(1); Write-Host "Forcing build failure due to phpt unit test failure(s)"; } +