detect appveyor problem

This commit is contained in:
v-kaywon 2017-10-17 15:13:29 -07:00
parent acee5c4686
commit 8397f7b8bf
2 changed files with 8 additions and 33 deletions

View file

@ -1322,11 +1322,10 @@ struct sqlsrv_output_param {
SQLUSMALLINT param_num; // used to index into the ind_or_len of the statement SQLUSMALLINT param_num; // used to index into the ind_or_len of the statement
SQLLEN original_buffer_len; // used to make sure the returned length didn't overflow the buffer SQLLEN original_buffer_len; // used to make sure the returned length didn't overflow the buffer
bool is_bool; bool is_bool;
bool is_long;
// string output param constructor // string output param constructor
sqlsrv_output_param( _In_ zval* p_z, _In_ SQLSRV_ENCODING enc, _In_ int num, _In_ SQLUINTEGER buffer_len, _In_ bool is_long ) : sqlsrv_output_param( _In_ zval* p_z, _In_ SQLSRV_ENCODING enc, _In_ int num, _In_ SQLUINTEGER buffer_len ) :
param_z( p_z ), encoding( enc ), param_num( num ), original_buffer_len( buffer_len ), is_bool( false ), is_long( is_long ) param_z( p_z ), encoding( enc ), param_num( num ), original_buffer_len( buffer_len ), is_bool( false )
{ {
} }
@ -1336,8 +1335,7 @@ struct sqlsrv_output_param {
encoding( SQLSRV_ENCODING_INVALID ), encoding( SQLSRV_ENCODING_INVALID ),
param_num( num ), param_num( num ),
original_buffer_len( -1 ), original_buffer_len( -1 ),
is_bool( is_bool ), is_bool( is_bool )
is_long( false )
{ {
} }
}; };
@ -1433,7 +1431,7 @@ typedef sqlsrv_stmt* (*driver_stmt_factory)( sqlsrv_conn* conn, SQLHANDLE h, err
sqlsrv_stmt* core_sqlsrv_create_stmt( _Inout_ sqlsrv_conn* conn, _In_ driver_stmt_factory stmt_factory, _In_opt_ HashTable* options_ht, sqlsrv_stmt* core_sqlsrv_create_stmt( _Inout_ sqlsrv_conn* conn, _In_ driver_stmt_factory stmt_factory, _In_opt_ HashTable* options_ht,
_In_opt_ const stmt_option valid_stmt_opts[], _In_ error_callback const err, _In_opt_ void* driver TSRMLS_DC ); _In_opt_ const stmt_option valid_stmt_opts[], _In_ error_callback const err, _In_opt_ void* driver TSRMLS_DC );
void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_num, _In_ SQLSMALLINT direction, _Inout_ zval* param_z, void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_num, _In_ SQLSMALLINT direction, _Inout_ zval* param_z,
_In_ SQLSRV_PHPTYPE php_out_type, _Inout_ SQLSRV_ENCODING encoding, _Inout_ SQLSMALLINT sql_type, _Inout_ SQLULEN column_size, _In_ SQLSRV_PHPTYPE php_out_type, _In_ SQLSRV_ENCODING encoding, _Inout_ SQLSMALLINT sql_type, _Inout_ SQLULEN column_size,
_Inout_ SQLSMALLINT decimal_digits TSRMLS_DC ); _Inout_ SQLSMALLINT decimal_digits TSRMLS_DC );
SQLRETURN core_sqlsrv_execute( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC, _In_reads_bytes_(sql_len) const char* sql = NULL, _In_ int sql_len = 0 ); SQLRETURN core_sqlsrv_execute( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC, _In_reads_bytes_(sql_len) const char* sql = NULL, _In_ int sql_len = 0 );
field_meta_data* core_sqlsrv_field_metadata( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT colno TSRMLS_DC ); field_meta_data* core_sqlsrv_field_metadata( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT colno TSRMLS_DC );

View file

@ -342,7 +342,7 @@ sqlsrv_stmt* core_sqlsrv_create_stmt( _Inout_ sqlsrv_conn* conn, _In_ driver_stm
// The sql type is given as a hint if the driver provides it. // The sql type is given as a hint if the driver provides it.
void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_num, _In_ SQLSMALLINT direction, _Inout_ zval* param_z, void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_num, _In_ SQLSMALLINT direction, _Inout_ zval* param_z,
_In_ SQLSRV_PHPTYPE php_out_type, _Inout_ SQLSRV_ENCODING encoding, _Inout_ SQLSMALLINT sql_type, _Inout_ SQLULEN column_size, _In_ SQLSRV_PHPTYPE php_out_type, _In_ SQLSRV_ENCODING encoding, _Inout_ SQLSMALLINT sql_type, _Inout_ SQLULEN column_size,
_Inout_ SQLSMALLINT decimal_digits TSRMLS_DC ) _Inout_ SQLSMALLINT decimal_digits TSRMLS_DC )
{ {
SQLSMALLINT c_type; SQLSMALLINT c_type;
@ -373,7 +373,6 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
} }
bool zval_was_null = ( Z_TYPE_P( param_z ) == IS_NULL ); bool zval_was_null = ( Z_TYPE_P( param_z ) == IS_NULL );
bool zval_was_bool = ( Z_TYPE_P( param_z ) == IS_TRUE || Z_TYPE_P( param_z ) == IS_FALSE ); bool zval_was_bool = ( Z_TYPE_P( param_z ) == IS_TRUE || Z_TYPE_P( param_z ) == IS_FALSE );
bool zval_was_long = ( Z_TYPE_P( param_z ) == IS_LONG && php_out_type == SQLSRV_PHPTYPE_INT && (sql_type == SQL_BIGINT || sql_type == SQL_UNKNOWN_TYPE ));
// if the user asks for for a specific type for input and output, make sure the data type we send matches the data we // if the user asks for for a specific type for input and output, make sure the data type we send matches the data we
// type we expect back, since we can only send and receive the same type. Anything can be converted to a string, so // type we expect back, since we can only send and receive the same type. Anything can be converted to a string, so
// we always let that match if they want a string back. // we always let that match if they want a string back.
@ -384,14 +383,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
if( zval_was_null || zval_was_bool ) { if( zval_was_null || zval_was_bool ) {
convert_to_long( param_z ); convert_to_long( param_z );
} }
if( zval_was_long ){ match = Z_TYPE_P( param_z ) == IS_LONG;
convert_to_string( param_z );
encoding = SQLSRV_ENCODING_SYSTEM;
match = Z_TYPE_P( param_z ) == IS_STRING;
}
else {
match = Z_TYPE_P(param_z) == IS_LONG;
}
break; break;
case SQLSRV_PHPTYPE_FLOAT: case SQLSRV_PHPTYPE_FLOAT:
if( zval_was_null ) { if( zval_was_null ) {
@ -423,13 +415,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
if( direction == SQL_PARAM_OUTPUT ) { if( direction == SQL_PARAM_OUTPUT ) {
switch( php_out_type ) { switch( php_out_type ) {
case SQLSRV_PHPTYPE_INT: case SQLSRV_PHPTYPE_INT:
if( zval_was_long ){ convert_to_long( param_z );
convert_to_string( param_z );
encoding = SQLSRV_ENCODING_SYSTEM;
}
else {
convert_to_long( param_z );
}
break; break;
case SQLSRV_PHPTYPE_FLOAT: case SQLSRV_PHPTYPE_FLOAT:
convert_to_double( param_z ); convert_to_double( param_z );
@ -565,7 +551,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
buffer, buffer_len TSRMLS_CC ); buffer, buffer_len TSRMLS_CC );
// save the parameter to be adjusted and/or converted after the results are processed // save the parameter to be adjusted and/or converted after the results are processed
sqlsrv_output_param output_param( param_ref, encoding, param_num, static_cast<SQLUINTEGER>( buffer_len ), zval_was_long ); sqlsrv_output_param output_param( param_ref, encoding, param_num, static_cast<SQLUINTEGER>( buffer_len ));
save_output_param_for_later( stmt, output_param TSRMLS_CC ); save_output_param_for_later( stmt, output_param TSRMLS_CC );
@ -2141,15 +2127,6 @@ void finalize_output_parameters( _Inout_ sqlsrv_stmt* stmt TSRMLS_DC )
else { else {
core::sqlsrv_zval_stringl(value_z, str, str_len); 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; break;
case IS_LONG: case IS_LONG: