modified ifdef __linux__

This commit is contained in:
yitam 2017-02-01 12:41:13 -08:00
parent 1b35af7c8b
commit 3280d76682
4 changed files with 11 additions and 11 deletions

View file

@ -45,11 +45,11 @@
#include "sal_def.h" #include "sal_def.h"
#endif #endif
#ifdef __linux__ #ifndef _WIN32
#define PTR_IS_INT64 1 #define PTR_IS_INT64 1
#else #else
#define PTR_IS_INT64 0 #define PTR_IS_INT64 0
#endif #endif // !_WIN32
#ifndef _MSC_VER #ifndef _MSC_VER
// SQL Server does not have a long double type // SQL Server does not have a long double type

View file

@ -2089,10 +2089,10 @@ namespace core {
// unixODBC: 2.3.1 // unixODBC: 2.3.1
// r = ::SQLRowCount( stmt->handle(), &rows_affected ); // r = ::SQLRowCount( stmt->handle(), &rows_affected );
// returns r=-1 for an empty result set. // returns r=-1 for an empty result set.
#ifdef __linux__ #ifndef _WIN32
if( r == -1 && rows_affected == -1 ) if( r == -1 && rows_affected == -1 )
return 0; return 0;
#endif #endif // !_WIN32
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) { CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
throw CoreException(); throw CoreException();

View file

@ -54,11 +54,11 @@ DWORD FormatMessageW(
va_list *Arguments va_list *Arguments
); );
#ifdef __linux__ #ifndef _WIN32
#define FormatMessage FormatMessageA #define FormatMessage FormatMessageA
#else #else
#define FormatMessage FormatMessageW #define FormatMessage FormatMessageW
#endif #endif // !_WIN32
#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100 #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
#define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200 #define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200

View file

@ -21,7 +21,7 @@
#include "php_sqlsrv.h" #include "php_sqlsrv.h"
#ifdef _WIN32 #ifdef _WIN32
#include <sal.h> #include <sal.h>
#endif #endif // _WIN32
// //
// *** internal variables and constants *** // *** internal variables and constants ***
@ -1825,10 +1825,10 @@ void fetch_fields_common( _Inout_ ss_sqlsrv_stmt* stmt, zend_long fetch_type, _O
for( int i = 0; i < num_cols; ++i ) { for( int i = 0; i < num_cols; ++i ) {
core::SQLColAttributeW ( stmt, i + 1, SQL_DESC_NAME, field_name_w, ( SS_MAXCOLNAMELEN + 1 ) * 2, &field_name_len_w, NULL TSRMLS_CC ); core::SQLColAttributeW ( stmt, i + 1, SQL_DESC_NAME, field_name_w, ( SS_MAXCOLNAMELEN + 1 ) * 2, &field_name_len_w, NULL TSRMLS_CC );
#ifdef __linux__ #ifndef _WIN32
//Conversion function in Linux expects size in characters. //Conversion function in Linux expects size in characters.
field_name_len_w = field_name_len_w / sizeof ( SQLWCHAR ); field_name_len_w = field_name_len_w / sizeof ( SQLWCHAR );
#endif #endif // !_WIN32
bool converted = convert_string_from_utf16( encoding, field_name_w, bool converted = convert_string_from_utf16( encoding, field_name_w,
field_name_len_w, ( char** ) &field_name, field_name_len ); field_name_len_w, ( char** ) &field_name, field_name_len );
@ -2169,11 +2169,11 @@ void type_and_size_calc( INTERNAL_FUNCTION_PARAMETERS, int type )
size = SQLSRV_SIZE_MAX_TYPE; size = SQLSRV_SIZE_MAX_TYPE;
} }
else { else {
#ifdef __linux__ #ifndef _WIN32
errno = 0; errno = 0;
#else #else
_set_errno(0); // reset errno for atol _set_errno(0); // reset errno for atol
#endif #endif // !_WIN32
size = atol( size_p ); size = atol( size_p );
if( errno != 0 ) { if( errno != 0 ) {
size = SQLSRV_INVALID_SIZE; size = SQLSRV_INVALID_SIZE;