only change encoding if it is invalid
This commit is contained in:
parent
b73539c311
commit
f4c736a073
|
@ -177,6 +177,7 @@ test_script:
|
|||
- copy %APPVEYOR_BUILD_FOLDER%\test\functional\setup\*.dll %APPVEYOR_BUILD_FOLDER%\test\functional\pdo_sqlsrv\
|
||||
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\run_ksp.py -server %TEST_PHP_SQL_SERVER% -dbname %SQLSRV_DBNAME% -uid %TEST_PHP_SQL_UID% -pwd %TEST_PHP_SQL_PWD%
|
||||
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\run_ksp.py -server %TEST_PHP_SQL_SERVER% -dbname %PDOSQLSRV_DBNAME% -uid %TEST_PHP_SQL_UID% -pwd %TEST_PHP_SQL_PWD%
|
||||
- OpenCppCoverage.exe --sources %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv --sources %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv --modules *sqlsrv*.dll --export_type=cobertura:.\coverage.xml --cover_children --quiet --continue_after_cpp_exception --optimized_build -- .\php.exe .\run-tests.php -P %APPVEYOR_BUILD_FOLDER%\test\functional\
|
||||
- php run-tests.php -p php.exe %APPVEYOR_BUILD_FOLDER%\test\functional\sqlsrv\*.phpt > %APPVEYOR_BUILD_FOLDER%\test\functional\sqlsrv.log 2>&1
|
||||
- type %APPVEYOR_BUILD_FOLDER%\test\functional\sqlsrv.log
|
||||
- php run-tests.php -p php.exe %APPVEYOR_BUILD_FOLDER%\test\functional\pdo_sqlsrv\*.phpt > %APPVEYOR_BUILD_FOLDER%\test\functional\pdo_sqlsrv.log 2>&1
|
||||
|
@ -191,7 +192,6 @@ test_script:
|
|||
- ps: foreach($file in $difffiles){ls $file; more $file}
|
||||
- ps: foreach($file in $outfiles){ls $file; more $file}
|
||||
- cd %PHP_INSTALL_DIR%
|
||||
- OpenCppCoverage.exe --sources %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv --sources %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv --modules *sqlsrv*.dll --export_type=cobertura:.\coverage.xml --cover_children --quiet --continue_after_cpp_exception --optimized_build -- .\php.exe .\run-tests.php -P %APPVEYOR_BUILD_FOLDER%\test\functional\
|
||||
- ls
|
||||
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\cleanup_dbs.py -dbname %SQLSRV_DBNAME%
|
||||
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\cleanup_dbs.py -dbname %PDOSQLSRV_DBNAME%
|
||||
|
|
|
@ -386,6 +386,8 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
|
|||
}
|
||||
if( zval_was_long ){
|
||||
convert_to_string( param_z );
|
||||
if ( encoding != SQLSRV_ENCODING_SYSTEM && encoding != SQLSRV_ENCODING_UTF8 && encoding != SQLSRV_ENCODING_BINARY )
|
||||
encoding = SQLSRV_ENCODING_UTF8;
|
||||
match = Z_TYPE_P( param_z ) == IS_STRING;
|
||||
}
|
||||
else {
|
||||
|
@ -424,6 +426,8 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
|
|||
case SQLSRV_PHPTYPE_INT:
|
||||
if( zval_was_long ){
|
||||
convert_to_string( param_z );
|
||||
if ( encoding != SQLSRV_ENCODING_SYSTEM && encoding != SQLSRV_ENCODING_UTF8 && encoding != SQLSRV_ENCODING_BINARY )
|
||||
encoding = SQLSRV_ENCODING_UTF8;
|
||||
}
|
||||
else {
|
||||
convert_to_long( param_z );
|
||||
|
@ -2091,16 +2095,7 @@ void finalize_output_parameters( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC )
|
|||
ZVAL_NULL( value_z );
|
||||
continue;
|
||||
}
|
||||
if ( output_param->is_long ) {
|
||||
zval* value_z_temp = ( zval * )sqlsrv_malloc( sizeof( zval ));
|
||||
ZVAL_COPY( value_z_temp, value_z );
|
||||
convert_to_double( value_z_temp );
|
||||
if ( Z_DVAL_P( value_z_temp ) > INT_MIN && Z_DVAL_P( value_z_temp ) < INT_MAX ) {
|
||||
convert_to_long( value_z );
|
||||
}
|
||||
sqlsrv_free( value_z_temp );
|
||||
}
|
||||
else {
|
||||
|
||||
// if there was more to output than buffer size to hold it, then throw a truncation error
|
||||
int null_size = 0;
|
||||
switch( output_param->encoding ) {
|
||||
|
@ -2148,6 +2143,14 @@ void finalize_output_parameters( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC )
|
|||
else {
|
||||
core::sqlsrv_zval_stringl(value_z, str, str_len);
|
||||
}
|
||||
if ( output_param->is_long ) {
|
||||
zval* value_z_temp = ( zval * )sqlsrv_malloc( sizeof( zval ));
|
||||
ZVAL_COPY( value_z_temp, value_z );
|
||||
convert_to_double( value_z_temp );
|
||||
if ( Z_DVAL_P( value_z_temp ) > INT_MIN && Z_DVAL_P( value_z_temp ) < INT_MAX ) {
|
||||
convert_to_long( value_z );
|
||||
}
|
||||
sqlsrv_free( value_z_temp );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue