Skip to content

Commit b2dde91

Browse files
committed
Skip Linux, not affected
1 parent 0bf5f06 commit b2dde91

File tree

7 files changed

+23
-16
lines changed

7 files changed

+23
-16
lines changed

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ build_script:
101101
- copy %APPVEYOR_BUILD_FOLDER%\buildscripts\*.py c:\projects
102102
- cd c:\projects
103103
- python -V
104+
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
104105
- python builddrivers.py --PHPVER=%PHP_VERSION% --ARCH=%BUILD_PLATFORM% --THREAD=%THREAD% --SOURCE=%APPVEYOR_BUILD_FOLDER%\source --TESTING --NO_RENAME
105106
- cd c:\projects\php-sdk\phpdev\%PHP_VC%\%BUILD_PLATFORM%\php-%PHP_VERSION%-src\
106107
- set PHP_SRC_DIR=%CD%\ext

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ jobs:
217217
for f in pdo_sqlsrv/*.diff; do ls $f 2>/dev/null; cat $f 2>/dev/null; echo ''; done || true
218218
python output.py
219219
ls -l *.xml
220+
more *.diff | cat
220221
displayName: 'Processing test results'
221222
222223
- task: PublishTestResults@2

buildscripts/builddrivers.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,11 @@ def build(self):
197197
ext_dir = self.build_extensions(root_dir, logfile)
198198
print('Build Completed')
199199
except:
200-
print('Something went wrong, launching log file', logfile)
201-
# display log file only when not testing
202-
if not self.testing:
203-
logfile_path = os.path.join(root_dir, 'php-sdk', logfile)
204-
with open(logfile_path, 'r') as f:
205-
print(f.read())
200+
print('Something went wrong, Print logfile to terminal', logfile)
201+
# logfile_path = os.path.join(root_dir, 'php-sdk', logfile)
202+
with open("C:\\projects\\php-sdk\\" + logfile, 'r') as f:
203+
f.seek(0)
204+
print(f.read())
206205
os.chdir(work_dir)
207206
exit(1)
208207
if not self.testing:

source/pdo_sqlsrv/config.w32

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ if( PHP_PDO_SQLSRV != "no" ) {
2727
if (CHECK_LIB("odbc32.lib", "pdo_sqlsrv") && CHECK_LIB("odbccp32.lib", "pdo_sqlsrv") &&
2828
CHECK_LIB("version.lib", "pdo_sqlsrv") && CHECK_LIB("psapi.lib", "pdo_sqlsrv")&&
2929
CHECK_HEADER_ADD_INCLUDE( "core_sqlsrv.h", "CFLAGS_PDO_SQLSRV", configure_module_dirname + "\\shared")) {
30-
CHECK_HEADER_ADD_INCLUDE("sql.h", "CFLAGS_PDO_SQLSRV_ODBC");
31-
CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_PDO_SQLSRV_ODBC");
3230
CHECK_HEADER_ADD_INCLUDE("php_pdo_sqlsrv_int.h", "CFLAGS_PDO_SQLSRV", configure_module_dirname);
3331
CHECK_HEADER_ADD_INCLUDE("php_pdo_sqlsrv.h", "CFLAGS_PDO_SQLSRV", configure_module_dirname);
32+
CHECK_HEADER_ADD_INCLUDE("sql.h", "CFLAGS_PDO_SQLSRV_ODBC");
33+
CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_PDO_SQLSRV_ODBC");
3434
ADD_SOURCES( configure_module_dirname + "\\shared", shared_src_class, "pdo_sqlsrv" );
3535
ADD_FLAG( "LDFLAGS_PDO_SQLSRV", "/NXCOMPAT /DYNAMICBASE /debug /guard:cf" );
3636
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/EHsc" );

source/pdo_sqlsrv/pdo_init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ PHP_RSHUTDOWN_FUNCTION(pdo_sqlsrv)
249249
{
250250
// SQLSRV_UNUSED( module_number );
251251
// SQLSRV_UNUSED( type );
252-
252+
#ifdef _WIN32
253253
for (size_t current_token = 0; current_token < PDO_SQLSRV_G(access_tokens_size); current_token++) {
254254
if (PDO_SQLSRV_G(access_tokens)[current_token]) {
255255
memset(PDO_SQLSRV_G(access_tokens)[current_token]->data, 0, PDO_SQLSRV_G(access_tokens)[current_token]->dataSize);
256256
sqlsrv_free(PDO_SQLSRV_G(access_tokens)[current_token]);
257257
}
258258
}
259259
sqlsrv_free(PDO_SQLSRV_G(access_tokens));
260-
260+
#endif
261261
PDO_LOG_NOTICE("pdo_sqlsrv: entering rshutdown");
262262

263263
return SUCCESS;

source/pdo_sqlsrv/php_pdo_sqlsrv.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
//---------------------------------------------------------------------------------------------------------------------------------
2222

2323
#include "php.h"
24+
25+
#ifdef _WIN32
2426
#include "msodbcsql.h"
27+
#endif
2528
//*********************************************************************************************************************************
2629
// Global variables
2730
//*********************************************************************************************************************************
@@ -32,11 +35,12 @@ ZEND_BEGIN_MODULE_GLOBALS(pdo_sqlsrv)
3235
unsigned int pdo_log_severity;
3336
zend_long client_buffer_max_size;
3437
short report_additional_errors;
35-
ACCESSTOKEN** access_tokens;
36-
unsigned int access_tokens_size = 0;
3738

3839
#ifndef _WIN32
3940
zend_long set_locale_info;
41+
#else
42+
ACCESSTOKEN** access_tokens;
43+
unsigned int access_tokens_size = 0;
4044
#endif
4145

4246
ZEND_END_MODULE_GLOBALS(pdo_sqlsrv)

source/shared/core_conn.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
#ifndef _WIN32
3333
#include <sys/utsname.h>
3434
#include <odbcinst.h>
35-
#endif
36-
35+
#else
3736
extern "C" {
3837
#include "php_pdo_sqlsrv.h"
3938
}
4039
#include "php_pdo_sqlsrv_int.h"
40+
#endif
4141

4242
// *** internal variables and constants ***
4343

@@ -1187,7 +1187,7 @@ void access_token_set_func::func( _In_ connection_option const* option, _In_ zva
11871187
// similar to a UCS-2 string containing only ASCII characters
11881188
//
11891189
// See https://docs.microsoft.com/sql/connect/odbc/using-azure-active-directory#authenticating-with-an-access-token
1190-
1190+
#ifdef _WIN32
11911191
size_t next_token_position = 0;
11921192
bool same_token_used = false;
11931193

@@ -1205,6 +1205,7 @@ void access_token_set_func::func( _In_ connection_option const* option, _In_ zva
12051205
break;
12061206
}
12071207
}
1208+
#endif
12081209

12091210
size_t dataSize = 2 * value_len;
12101211

@@ -1227,11 +1228,12 @@ void access_token_set_func::func( _In_ connection_option const* option, _In_ zva
12271228
// Save the pointer because SQLDriverConnect() will use it to make connection to the server
12281229
conn->azure_ad_access_token = pAccToken;
12291230
accToken.transferred();
1230-
1231+
#ifdef _WIN32
12311232
if (!same_token_used) {
12321233
next_token_position = PDO_SQLSRV_G(access_tokens_size);
12331234
PDO_SQLSRV_G(access_tokens_size)++;
12341235
PDO_SQLSRV_G(access_tokens) = reinterpret_cast<ACCESSTOKEN**>(sqlsrv_realloc(PDO_SQLSRV_G(access_tokens), PDO_SQLSRV_G(access_tokens_size) * sizeof(ACCESSTOKEN)));
12351236
}
12361237
PDO_SQLSRV_G(access_tokens)[next_token_position] = conn->azure_ad_access_token;
1238+
#endif
12371239
}

0 commit comments

Comments
 (0)