Compare commits
39 commits
debian/lat
...
v5.11.1
Author | SHA1 | Date | |
---|---|---|---|
|
c097a06bb8 | ||
|
a7156c72f1 | ||
|
91a916ed8e | ||
|
62beb28932 | ||
|
0bc36bf84f | ||
|
b1df4089cb | ||
|
f6f76d4ac1 | ||
|
3cd248fba8 | ||
|
4ca08e5ca2 | ||
|
11509df4d3 | ||
|
e1eb5aa56b | ||
|
cf661d16fb | ||
|
d1980d3570 | ||
|
afdc9b6e8d | ||
|
ee5baccde4 | ||
|
d35c2b0f1b | ||
|
04266af58c | ||
|
ef10e75db8 | ||
|
86e3fbf466 | ||
|
cea2e8cc69 | ||
|
ffafa43095 | ||
|
2c606fe5d2 | ||
|
35bf2a6bbd | ||
|
c72e0eb166 | ||
|
e120fbc422 | ||
|
36b48f02c1 | ||
|
a5c7069b2e | ||
|
fd8457cd55 | ||
|
f764dc80ce | ||
|
93802526c0 | ||
|
efd594b8cf | ||
|
3a630fa8b0 | ||
|
9ffcb9cb2e | ||
|
15d25ceb76 | ||
|
4974fe4334 | ||
|
ed96718152 | ||
|
e2c15977ef | ||
|
25c8a200a5 | ||
|
b5f7469b02 |
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
.vs
|
||||||
|
.vscode
|
||||||
|
__pycache__
|
||||||
|
*.diff
|
||||||
|
*.exp
|
||||||
|
*.log
|
||||||
|
*.sh
|
||||||
|
*.out
|
||||||
|
test/**/**/*.php
|
81
CHANGELOG.md
81
CHANGELOG.md
|
@ -3,6 +3,87 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
|
## 5.11.1 - 2023-08-31
|
||||||
|
Updated PECL release packages. Here is the list of updates:
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Reset type after bind param (#1452)
|
||||||
|
- Fixed error when using PDO::ATTR_STRINGIFY_FETCHES (#1468) by SakiTakamachi
|
||||||
|
- Change connection options to case insensitive (#1460)
|
||||||
|
- Bugfix for 1465 Adding a NULL check (#1471)
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
- No support for inout / output params when using sql_variant type
|
||||||
|
- No support for inout / output params when formatting decimal values
|
||||||
|
- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work
|
||||||
|
- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server)
|
||||||
|
- Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported
|
||||||
|
- Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported
|
||||||
|
- Issue [#1050](https://github.com/microsoft/msphpsql/issues/1050) - With Always Encrypted enabled, insertion requires the column list for any tables with identity columns
|
||||||
|
- [Always Encrypted limitations](https://docs.microsoft.com/sql/connect/php/using-always-encrypted-php-drivers#limitations-of-the-php-drivers-when-using-always-encrypted)
|
||||||
|
|
||||||
|
### Known Issues
|
||||||
|
- This release requires ODBC Driver 17.4.2 or above. Otherwise, a warning about failing to set an attribute may be suppressed when using an older ODBC driver.
|
||||||
|
- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.7
|
||||||
|
- When pooling is enabled in Linux or macOS
|
||||||
|
- unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
|
||||||
|
- due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples [here](https://github.com/Microsoft/msphpsql/wiki/Features#pooling)
|
||||||
|
|
||||||
|
|
||||||
|
## 5.11.0 - 2023-02-28
|
||||||
|
Updated PECL release packages. Here is the list of updates:
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Support for PHP 8.2
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Support for PHP 7.4
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
- No support for inout / output params when using sql_variant type
|
||||||
|
- No support for inout / output params when formatting decimal values
|
||||||
|
- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work
|
||||||
|
- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server)
|
||||||
|
- Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported
|
||||||
|
- Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported
|
||||||
|
- Issue [#1050](https://github.com/microsoft/msphpsql/issues/1050) - With Always Encrypted enabled, insertion requires the column list for any tables with identity columns
|
||||||
|
- [Always Encrypted limitations](https://docs.microsoft.com/sql/connect/php/using-always-encrypted-php-drivers#limitations-of-the-php-drivers-when-using-always-encrypted)
|
||||||
|
|
||||||
|
### Known Issues
|
||||||
|
- This release requires ODBC Driver 17.4.2 or above. Otherwise, a warning about failing to set an attribute may be suppressed when using an older ODBC driver.
|
||||||
|
- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.7
|
||||||
|
- When pooling is enabled in Linux or macOS
|
||||||
|
- unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
|
||||||
|
- due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples [here](https://github.com/Microsoft/msphpsql/wiki/Features#pooling)
|
||||||
|
|
||||||
|
|
||||||
|
## 5.11.0-beta1 - 2023-01-25
|
||||||
|
Updated PECL release packages. Here is the list of updates:
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Support for PHP 8.2
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Pull request [#1408](https://github.com/microsoft/msphpsql/pull/1408) - Fixed right truncation issue, unit test added by talkinnl
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
- No support for inout / output params when using sql_variant type
|
||||||
|
- No support for inout / output params when formatting decimal values
|
||||||
|
- In Linux and macOS, setlocale() only takes effect if it is invoked before the first connection. Attempting to set the locale after connecting will not work
|
||||||
|
- Always Encrypted requires [MS ODBC Driver 17+](https://docs.microsoft.com/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server)
|
||||||
|
- Only Windows Certificate Store and Azure Key Vault are supported. Custom Keystores are not yet supported
|
||||||
|
- Issue [#716](https://github.com/Microsoft/msphpsql/issues/716) - With Always Encrypted enabled, named parameters in subqueries are not supported
|
||||||
|
- Issue [#1050](https://github.com/microsoft/msphpsql/issues/1050) - With Always Encrypted enabled, insertion requires the column list for any tables with identity columns
|
||||||
|
- [Always Encrypted limitations](https://docs.microsoft.com/sql/connect/php/using-always-encrypted-php-drivers#limitations-of-the-php-drivers-when-using-always-encrypted)
|
||||||
|
|
||||||
|
### Known Issues
|
||||||
|
- This release requires ODBC Driver 17.4.2 or above. Otherwise, a warning about failing to set an attribute may be suppressed when using an older ODBC driver.
|
||||||
|
- Connection pooling on Linux or macOS is not recommended with [unixODBC](http://www.unixodbc.org/) < 2.3.7
|
||||||
|
- When pooling is enabled in Linux or macOS
|
||||||
|
- unixODBC <= 2.3.4 (Linux and macOS) might not return proper diagnostic information, such as error messages, warnings and informative messages
|
||||||
|
- due to this unixODBC bug, fetch large data (such as xml, binary) as streams as a workaround. See the examples [here](https://github.com/Microsoft/msphpsql/wiki/Features#pooling)
|
||||||
|
|
||||||
|
|
||||||
## 5.10.1 - 2022-05-12
|
## 5.10.1 - 2022-05-12
|
||||||
Updated PECL release packages. Here is the list of updates:
|
Updated PECL release packages. Here is the list of updates:
|
||||||
|
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright(c) 2022 Microsoft Corporation
|
Copyright(c) 2023 Microsoft Corporation
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
10
README.md
10
README.md
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
The [Microsoft Drivers for PHP for Microsoft SQL Server][phpdoc] are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PHP Data Objects (PDO) for accessing data in all editions of SQL Server 2012 and later (including Azure SQL DB). These drivers rely on the [Microsoft ODBC Driver for SQL Server][odbcdoc] to handle the low-level communication with SQL Server.
|
The [Microsoft Drivers for PHP for Microsoft SQL Server][phpdoc] are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PHP Data Objects (PDO) for accessing data in all editions of SQL Server 2012 and later (including Azure SQL DB). These drivers rely on the [Microsoft ODBC Driver for SQL Server][odbcdoc] to handle the low-level communication with SQL Server.
|
||||||
|
|
||||||
This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 7.3+ with improvements on both drivers and some limitations. Upcoming [releases][releases] will contain additional functionalities, bug fixes, and more.
|
This release contains the SQLSRV and PDO_SQLSRV drivers for PHP 8.0+ with improvements on both drivers and some limitations. Upcoming [releases][releases] will contain additional functionalities, bug fixes, and more.
|
||||||
|
|
||||||
## Take our survey
|
## Take our survey
|
||||||
|
|
||||||
Thank you for taking the time to participate in the [sentiment survey](https://github.com/microsoft/msphpsql/wiki/Survey-Results). You can continue to help us improve by letting us know how we are doing and how you use [PHP][phpweb]:
|
Thank you for taking the time to participate in the [sentiment survey](https://github.com/microsoft/msphpsql/wiki/Survey-Results). You can continue to help us improve by letting us know how we are doing and how you use [PHP][phpweb]:
|
||||||
|
|
||||||
<a href="https://aka.ms/mssqlphpsurvey"><img style="float: right;" height="67" width="156" src="https://sqlchoice.blob.core.windows.net/sqlchoice/static/images/survey.png"></a>
|
[**Click here to start the PHP survey**](https://aka.ms/mssqlphpsurvey)
|
||||||
|
|
||||||
### Status of Most Recent Builds
|
### Status of Most Recent Builds
|
||||||
| Azure Pipelines (Linux) | AppVeyor (Windows) | Coverage (Windows) |
|
| Azure Pipelines (Linux) | AppVeyor (Windows) | Coverage (Windows) |
|
||||||
|
@ -37,8 +37,8 @@ Please follow the [Getting started](https://docs.microsoft.com/sql/connect/php/g
|
||||||
For full details on the system requirements for the drivers, see the [system requirements](https://docs.microsoft.com/sql/connect/php/system-requirements-for-the-php-sql-driver) on Microsoft Docs.
|
For full details on the system requirements for the drivers, see the [system requirements](https://docs.microsoft.com/sql/connect/php/system-requirements-for-the-php-sql-driver) on Microsoft Docs.
|
||||||
|
|
||||||
On the client machine:
|
On the client machine:
|
||||||
- 7.4.x, 8.0.x, 8.1.x
|
- 8.0.x, 8.1.x, 8.2.x
|
||||||
- [Microsoft ODBC Driver 17 or Microsoft ODBC Driver 13][odbcdoc]
|
- [Microsoft ODBC Driver 18, 17 or 13][odbcdoc]
|
||||||
- If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP
|
- If using a Web server such as Internet Information Services (IIS) or Apache, it must be configured to run PHP
|
||||||
|
|
||||||
On the server side, Microsoft SQL Server 2012 and above on Windows are supported, as are Microsoft SQL Server 2016 and above on Linux.
|
On the server side, Microsoft SQL Server 2012 and above on Windows are supported, as are Microsoft SQL Server 2016 and above on Linux.
|
||||||
|
@ -47,7 +47,7 @@ On the server side, Microsoft SQL Server 2012 and above on Windows are supported
|
||||||
|
|
||||||
The drivers are distributed as pre-compiled extensions for PHP found on the [releases page][releases]. They are available in thread-safe and non-thread-safe versions, and in 32-bit (Windows only) and 64-bit versions. The source code for the drivers is also available, and you can compile them as thread safe or non-thread-safe versions. The thread safety configuration of your web server will determine which version you need.
|
The drivers are distributed as pre-compiled extensions for PHP found on the [releases page][releases]. They are available in thread-safe and non-thread-safe versions, and in 32-bit (Windows only) and 64-bit versions. The source code for the drivers is also available, and you can compile them as thread safe or non-thread-safe versions. The thread safety configuration of your web server will determine which version you need.
|
||||||
|
|
||||||
If you choose to build the drivers, you must be able to build PHP 7.* or 8.* without including these extensions. For help building PHP on Windows, see the [official PHP website][phpbuild]. For details on compiling the drivers, see the [documentation](https://github.com/microsoft/msphpsql/blob/master/buildscripts/README.md) -- an example buildscript is provided, but you can also compile the drivers manually.
|
If you choose to build the drivers, you must be able to build PHP 8.* without including these extensions. For help building PHP on Windows, see the [official PHP website][phpbuild]. For details on compiling the drivers, see the [documentation](https://github.com/microsoft/msphpsql/blob/master/buildscripts/README.md) -- an example buildscript is provided, but you can also compile the drivers manually.
|
||||||
|
|
||||||
To load the drivers, make sure that the driver is in your PHP extension directory and enable it in your PHP installation's php.ini file by adding `extension=php_sqlsrv.dll` and/or `extension=php_pdo_sqlsrv.dll` to the ini file. If necessary, specify the extension directory using `extension_dir`, for example: `extension_dir = "C:\PHP\ext"`. Note that the precompiled binaries have different names -- substitute accordingly in php.ini. For more details on loading the drivers, see [Loading the PHP SQL Driver](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver) on Microsoft Docs.
|
To load the drivers, make sure that the driver is in your PHP extension directory and enable it in your PHP installation's php.ini file by adding `extension=php_sqlsrv.dll` and/or `extension=php_pdo_sqlsrv.dll` to the ini file. If necessary, specify the extension directory using `extension_dir`, for example: `extension_dir = "C:\PHP\ext"`. Note that the precompiled binaries have different names -- substitute accordingly in php.ini. For more details on loading the drivers, see [Loading the PHP SQL Driver](https://docs.microsoft.com/sql/connect/php/loading-the-php-sql-driver) on Microsoft Docs.
|
||||||
|
|
||||||
|
|
41
SECURITY.md
Normal file
41
SECURITY.md
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||||
|
|
||||||
|
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
||||||
|
|
||||||
|
## Reporting Security Issues
|
||||||
|
|
||||||
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||||
|
|
||||||
|
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
||||||
|
|
||||||
|
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
||||||
|
|
||||||
|
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
||||||
|
|
||||||
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
|
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||||
|
* Full paths of source file(s) related to the manifestation of the issue
|
||||||
|
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||||
|
* Any special configuration required to reproduce the issue
|
||||||
|
* Step-by-step instructions to reproduce the issue
|
||||||
|
* Proof-of-concept or exploit code (if possible)
|
||||||
|
* Impact of the issue, including how an attacker might exploit the issue
|
||||||
|
|
||||||
|
This information will help us triage your report more quickly.
|
||||||
|
|
||||||
|
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
||||||
|
|
||||||
|
## Preferred Languages
|
||||||
|
|
||||||
|
We prefer all communications to be in English.
|
||||||
|
|
||||||
|
## Policy
|
||||||
|
|
||||||
|
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
||||||
|
|
||||||
|
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
|
@ -12,6 +12,7 @@ environment:
|
||||||
SQLSRV_DBNAME: msphpsql_sqlsrv
|
SQLSRV_DBNAME: msphpsql_sqlsrv
|
||||||
PDOSQLSRV_DBNAME: msphpsql_pdosqlsrv
|
PDOSQLSRV_DBNAME: msphpsql_pdosqlsrv
|
||||||
PYTHON: c:\Python36
|
PYTHON: c:\Python36
|
||||||
|
APPVEYOR: true
|
||||||
# For details about Appveyor build worker images (VM template): https://www.appveyor.com/docs/build-environment/#build-worker-images
|
# For details about Appveyor build worker images (VM template): https://www.appveyor.com/docs/build-environment/#build-worker-images
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
|
|
@ -11,6 +11,7 @@ variables:
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- dev
|
- dev
|
||||||
|
- fix/*
|
||||||
|
|
||||||
pr:
|
pr:
|
||||||
- dev
|
- dev
|
||||||
|
@ -18,7 +19,7 @@ pr:
|
||||||
jobs:
|
jobs:
|
||||||
- job: macOS
|
- job: macOS
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'macOS-10.15'
|
vmImage: 'macos-latest'
|
||||||
steps:
|
steps:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
clean: true
|
clean: true
|
||||||
|
|
|
@ -200,7 +200,11 @@ class BuildDriver(object):
|
||||||
print('Something went wrong, launching log file', logfile)
|
print('Something went wrong, launching log file', logfile)
|
||||||
# display log file only when not testing
|
# display log file only when not testing
|
||||||
if not self.testing:
|
if not self.testing:
|
||||||
os.startfile(os.path.join(root_dir, 'php-sdk', logfile))
|
logfile_path = os.path.join(root_dir, 'php-sdk', logfile)
|
||||||
|
if os.path.isfile(logfile_path):
|
||||||
|
with open(logfile_path, 'r') as f:
|
||||||
|
f.seek(0)
|
||||||
|
print(f.read())
|
||||||
os.chdir(work_dir)
|
os.chdir(work_dir)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ class BuildUtil(object):
|
||||||
else: # pdo_sqlsrv
|
else: # pdo_sqlsrv
|
||||||
cmd_line = ' --enable-pdo --with-pdo-sqlsrv=shared ' + cmd_line
|
cmd_line = ' --enable-pdo --with-pdo-sqlsrv=shared ' + cmd_line
|
||||||
|
|
||||||
cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed' + cmd_line
|
cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed --enable-mbstring --enable-ctype' + cmd_line
|
||||||
if self.thread == 'nts':
|
if self.thread == 'nts':
|
||||||
cmd_line = cmd_line + ' --disable-zts'
|
cmd_line = cmd_line + ' --disable-zts'
|
||||||
return cmd_line
|
return cmd_line
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 91 KiB |
Binary file not shown.
Before Width: | Height: | Size: 107 KiB |
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
Binary file not shown.
Before Width: | Height: | Size: 67 KiB |
|
@ -4,7 +4,7 @@ dnl
|
||||||
dnl Contents: the code that will go into the configure script, indicating options,
|
dnl Contents: the code that will go into the configure script, indicating options,
|
||||||
dnl external libraries and includes, and what source files are to be compiled.
|
dnl external libraries and includes, and what source files are to be compiled.
|
||||||
dnl
|
dnl
|
||||||
dnl Microsoft Drivers 5.10 for PHP for SQL Server
|
dnl Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
dnl Copyright(c) Microsoft Corporation
|
dnl Copyright(c) Microsoft Corporation
|
||||||
dnl All rights reserved.
|
dnl All rights reserved.
|
||||||
dnl MIT License
|
dnl MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: JScript build configuration used by buildconf.bat
|
// Contents: JScript build configuration used by buildconf.bat
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Implements the PDO object for PDO_SQLSRV
|
// Contents: Implements the PDO object for PDO_SQLSRV
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -155,6 +155,7 @@ struct pdo_encrypt_set_func
|
||||||
const char TRUE_VALUE_2[] = "1";
|
const char TRUE_VALUE_2[] = "1";
|
||||||
const char FALSE_VALUE_1[] = "false";
|
const char FALSE_VALUE_1[] = "false";
|
||||||
const char FALSE_VALUE_2[] = "0";
|
const char FALSE_VALUE_2[] = "0";
|
||||||
|
transform(val_str.begin(), val_str.end(), val_str.begin(), ::tolower);
|
||||||
|
|
||||||
// For backward compatibility, convert true/1 to yes and false/0 to no
|
// For backward compatibility, convert true/1 to yes and false/0 to no
|
||||||
std::string attr;
|
std::string attr;
|
||||||
|
@ -1260,7 +1261,7 @@ bool pdo_sqlsrv_dbh_set_attr(_Inout_ pdo_dbh_t *dbh, _In_ zend_long attr, _Inout
|
||||||
case SQLSRV_ATTR_QUERY_TIMEOUT:
|
case SQLSRV_ATTR_QUERY_TIMEOUT:
|
||||||
if( Z_TYPE_P( val ) != IS_LONG || Z_LVAL_P( val ) < 0 ) {
|
if( Z_TYPE_P( val ) != IS_LONG || Z_LVAL_P( val ) < 0 ) {
|
||||||
convert_to_string( val );
|
convert_to_string( val );
|
||||||
THROW_PDO_ERROR( driver_dbh, SQLSRV_ERROR_INVALID_QUERY_TIMEOUT_VALUE, Z_STRVAL_P( val ));
|
THROW_PDO_ERROR( driver_dbh, SQLSRV_ERROR_INVALID_QUERY_TIMEOUT_VALUE, Z_STRVAL_P( val ), NULL);
|
||||||
}
|
}
|
||||||
driver_dbh->query_timeout = static_cast<long>( Z_LVAL_P( val ) );
|
driver_dbh->query_timeout = static_cast<long>( Z_LVAL_P( val ) );
|
||||||
break;
|
break;
|
||||||
|
@ -1268,7 +1269,7 @@ bool pdo_sqlsrv_dbh_set_attr(_Inout_ pdo_dbh_t *dbh, _In_ zend_long attr, _Inout
|
||||||
case SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE:
|
case SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE:
|
||||||
if( Z_TYPE_P( val ) != IS_LONG || Z_LVAL_P( val ) <= 0 ) {
|
if( Z_TYPE_P( val ) != IS_LONG || Z_LVAL_P( val ) <= 0 ) {
|
||||||
convert_to_string( val );
|
convert_to_string( val );
|
||||||
THROW_PDO_ERROR( driver_dbh, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, Z_STRVAL_P( val ));
|
THROW_PDO_ERROR( driver_dbh, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, Z_STRVAL_P( val ), NULL);
|
||||||
}
|
}
|
||||||
driver_dbh->client_buffer_max_size = Z_LVAL_P( val );
|
driver_dbh->client_buffer_max_size = Z_LVAL_P( val );
|
||||||
break;
|
break;
|
||||||
|
@ -1323,6 +1324,12 @@ bool pdo_sqlsrv_dbh_set_attr(_Inout_ pdo_dbh_t *dbh, _In_ zend_long attr, _Inout
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
case PDO_ATTR_STRINGIFY_FETCHES:
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// Not supported
|
// Not supported
|
||||||
case PDO_ATTR_FETCH_TABLE_NAMES:
|
case PDO_ATTR_FETCH_TABLE_NAMES:
|
||||||
case PDO_ATTR_FETCH_CATALOG_NAMES:
|
case PDO_ATTR_FETCH_CATALOG_NAMES:
|
||||||
|
@ -1629,7 +1636,7 @@ zend_string * pdo_sqlsrv_dbh_last_id(_Inout_ pdo_dbh_t *dbh, _In_ const zend_str
|
||||||
#endif
|
#endif
|
||||||
wsql_string = utf16_string_from_mbcs_string(SQLSRV_ENCODING_CHAR, buffer, sizeof(buffer), &wsql_len);
|
wsql_string = utf16_string_from_mbcs_string(SQLSRV_ENCODING_CHAR, buffer, sizeof(buffer), &wsql_len);
|
||||||
}
|
}
|
||||||
CHECK_CUSTOM_ERROR(wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1907,7 +1914,7 @@ pdo_sqlsrv_function_entry *pdo_sqlsrv_get_driver_methods( _Inout_ pdo_dbh_t *dbh
|
||||||
// As per documentation, simply return false if the method does not exist
|
// As per documentation, simply return false if the method does not exist
|
||||||
// https://www.php.net/manual/en/function.is-callable.php
|
// https://www.php.net/manual/en/function.is-callable.php
|
||||||
// But user can call PDO::errorInfo() to check the error message if necessary
|
// But user can call PDO::errorInfo() to check the error message if necessary
|
||||||
CHECK_CUSTOM_WARNING_AS_ERROR(true, driver_conn, PDO_SQLSRV_ERROR_FUNCTION_NOT_IMPLEMENTED);
|
CHECK_CUSTOM_WARNING_AS_ERROR(true, driver_conn, PDO_SQLSRV_ERROR_FUNCTION_NOT_IMPLEMENTED, NULL);
|
||||||
|
|
||||||
return NULL; // return NULL for PDO to take care of the rest
|
return NULL; // return NULL for PDO to take care of the rest
|
||||||
}
|
}
|
||||||
|
@ -2088,7 +2095,7 @@ void pdo_txn_isolation_conn_attr_func::func( connection_option const* /*option*/
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( true, conn, PDO_SQLSRV_ERROR_INVALID_DSN_VALUE, PDOConnOptionNames::TransactionIsolation ) {
|
CHECK_CUSTOM_ERROR( true, conn, PDO_SQLSRV_ERROR_INVALID_DSN_VALUE, PDOConnOptionNames::TransactionIsolation, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: initialization routines for PDO_SQLSRV
|
// Contents: initialization routines for PDO_SQLSRV
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//
|
//
|
||||||
// Copyright Microsoft Corporation
|
// Copyright Microsoft Corporation
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -170,7 +170,7 @@ void conn_string_parser::validate_key( _In_reads_(key_len) const char *key, _Ino
|
||||||
|
|
||||||
key_name[new_len] = '\0';
|
key_name[new_len] = '\0';
|
||||||
|
|
||||||
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_INVALID_DSN_KEY, static_cast<char*>( key_name ) );
|
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_INVALID_DSN_KEY, static_cast<char*>( key_name ), NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sql_string_parser::is_placeholder_char( char c )
|
inline bool sql_string_parser::is_placeholder_char( char c )
|
||||||
|
@ -272,7 +272,7 @@ void conn_string_parser:: parse_conn_string( void )
|
||||||
|
|
||||||
if ( ! next() ) {
|
if ( ! next() ) {
|
||||||
|
|
||||||
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_RCB_MISSING_IN_DSN_VALUE, this->current_key_name );
|
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_RCB_MISSING_IN_DSN_VALUE, this->current_key_name, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void conn_string_parser:: parse_conn_string( void )
|
||||||
if( !next() ) {
|
if( !next() ) {
|
||||||
|
|
||||||
// EOS after a second RCB is error
|
// EOS after a second RCB is error
|
||||||
THROW_PDO_ERROR( this->ctx, SQLSRV_ERROR_UNESCAPED_RIGHT_BRACE_IN_DSN, this->current_key_name );
|
THROW_PDO_ERROR( this->ctx, SQLSRV_ERROR_UNESCAPED_RIGHT_BRACE_IN_DSN, this->current_key_name, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
state = ValueContent1;
|
state = ValueContent1;
|
||||||
|
@ -354,7 +354,7 @@ void conn_string_parser:: parse_conn_string( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non - (RCB, SP*, SC, EOS) character. Any other character after an RCB is an error.
|
// Non - (RCB, SP*, SC, EOS) character. Any other character after an RCB is an error.
|
||||||
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_INVALID_DSN_VALUE, this->current_key_name );
|
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_INVALID_DSN_VALUE, this->current_key_name, NULL );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NextKeyValuePair:
|
case NextKeyValuePair:
|
||||||
|
@ -372,7 +372,7 @@ void conn_string_parser:: parse_conn_string( void )
|
||||||
if( this->orig_str[pos] == ';' ) {
|
if( this->orig_str[pos] == ';' ) {
|
||||||
|
|
||||||
// a second semi-colon is error case.
|
// a second semi-colon is error case.
|
||||||
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_EXTRA_SEMI_COLON_IN_DSN_STRING, this->pos );
|
THROW_PDO_ERROR( this->ctx, PDO_SQLSRV_ERROR_EXTRA_SEMI_COLON_IN_DSN_STRING, this->pos, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Implements the PDOStatement object for the PDO_SQLSRV
|
// Contents: Implements the PDOStatement object for the PDO_SQLSRV
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -822,13 +822,13 @@ int pdo_sqlsrv_stmt_get_col_data(_Inout_ pdo_stmt_t *stmt, _In_ int colno, _Inou
|
||||||
if (bind_data != NULL && !Z_ISUNDEF(bind_data->driver_params)) {
|
if (bind_data != NULL && !Z_ISUNDEF(bind_data->driver_params)) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(Z_TYPE(bind_data->driver_params) != IS_LONG, driver_stmt,
|
CHECK_CUSTOM_ERROR(Z_TYPE(bind_data->driver_params) != IS_LONG, driver_stmt,
|
||||||
PDO_SQLSRV_ERROR_INVALID_COLUMN_DRIVER_DATA, colno + 1) {
|
PDO_SQLSRV_ERROR_INVALID_COLUMN_DRIVER_DATA, colno + 1, NULL) {
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(driver_stmt->bound_column_param_types[colno] != PDO_PARAM_STR
|
CHECK_CUSTOM_ERROR(driver_stmt->bound_column_param_types[colno] != PDO_PARAM_STR
|
||||||
&& driver_stmt->bound_column_param_types[colno] != PDO_PARAM_LOB, driver_stmt,
|
&& driver_stmt->bound_column_param_types[colno] != PDO_PARAM_LOB, driver_stmt,
|
||||||
PDO_SQLSRV_ERROR_COLUMN_TYPE_DOES_NOT_SUPPORT_ENCODING, colno + 1) {
|
PDO_SQLSRV_ERROR_COLUMN_TYPE_DOES_NOT_SUPPORT_ENCODING, colno + 1, NULL) {
|
||||||
|
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ int pdo_sqlsrv_stmt_get_col_data(_Inout_ pdo_stmt_t *stmt, _In_ int colno, _Inou
|
||||||
case SQLSRV_ENCODING_UTF8:
|
case SQLSRV_ENCODING_UTF8:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW_PDO_ERROR(driver_stmt, PDO_SQLSRV_ERROR_INVALID_DRIVER_COLUMN_ENCODING, colno);
|
THROW_PDO_ERROR(driver_stmt, PDO_SQLSRV_ERROR_INVALID_DRIVER_COLUMN_ENCODING, colno, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1310,7 +1310,7 @@ int pdo_sqlsrv_stmt_param_hook( _Inout_ pdo_stmt_t *stmt,
|
||||||
// that means they want output, and if they include the flag, then it's input/output.
|
// that means they want output, and if they include the flag, then it's input/output.
|
||||||
// It's invalid to specify the input/output flag but not specify a length
|
// It's invalid to specify the input/output flag but not specify a length
|
||||||
CHECK_CUSTOM_ERROR( (param->param_type & PDO_PARAM_INPUT_OUTPUT) && (param->max_value_len == 0),
|
CHECK_CUSTOM_ERROR( (param->param_type & PDO_PARAM_INPUT_OUTPUT) && (param->max_value_len == 0),
|
||||||
driver_stmt, PDO_SQLSRV_ERROR_INVALID_PARAM_DIRECTION, param->paramno + 1 ) {
|
driver_stmt, PDO_SQLSRV_ERROR_INVALID_PARAM_DIRECTION, param->paramno + 1, NULL) {
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
// if the parameter is output or input/output, translate the type between the PDO::PARAM_* constant
|
// if the parameter is output or input/output, translate the type between the PDO::PARAM_* constant
|
||||||
|
@ -1397,7 +1397,7 @@ int pdo_sqlsrv_stmt_param_hook( _Inout_ pdo_stmt_t *stmt,
|
||||||
case SQLSRV_PHPTYPE_STRING:
|
case SQLSRV_PHPTYPE_STRING:
|
||||||
{
|
{
|
||||||
CHECK_CUSTOM_ERROR( param->max_value_len <= 0, driver_stmt,
|
CHECK_CUSTOM_ERROR( param->max_value_len <= 0, driver_stmt,
|
||||||
PDO_SQLSRV_ERROR_INVALID_OUTPUT_STRING_SIZE, param->paramno + 1 ) {
|
PDO_SQLSRV_ERROR_INVALID_OUTPUT_STRING_SIZE, param->paramno + 1, NULL) {
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
column_size = param->max_value_len;
|
column_size = param->max_value_len;
|
||||||
|
@ -1416,7 +1416,7 @@ int pdo_sqlsrv_stmt_param_hook( _Inout_ pdo_stmt_t *stmt,
|
||||||
// 2.0 driver. To be consistent and avoid surprises of one object type working and others
|
// 2.0 driver. To be consistent and avoid surprises of one object type working and others
|
||||||
// not, we block all objects here.
|
// not, we block all objects here.
|
||||||
CHECK_CUSTOM_ERROR( direction != SQL_PARAM_OUTPUT && Z_TYPE( param->parameter ) == IS_OBJECT,
|
CHECK_CUSTOM_ERROR( direction != SQL_PARAM_OUTPUT && Z_TYPE( param->parameter ) == IS_OBJECT,
|
||||||
driver_stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param->paramno + 1 ) {
|
driver_stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param->paramno + 1, NULL) {
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1436,7 +1436,7 @@ int pdo_sqlsrv_stmt_param_hook( _Inout_ pdo_stmt_t *stmt,
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
CHECK_CUSTOM_ERROR( pdo_type != PDO_PARAM_STR && pdo_type != PDO_PARAM_LOB, driver_stmt,
|
CHECK_CUSTOM_ERROR( pdo_type != PDO_PARAM_STR && pdo_type != PDO_PARAM_LOB, driver_stmt,
|
||||||
PDO_SQLSRV_ERROR_INVALID_DRIVER_PARAM_TYPE, param->paramno + 1 ) {
|
PDO_SQLSRV_ERROR_INVALID_DRIVER_PARAM_TYPE, param->paramno + 1, NULL) {
|
||||||
throw pdo::PDOException();
|
throw pdo::PDOException();
|
||||||
}
|
}
|
||||||
encoding = static_cast<SQLSRV_ENCODING>( Z_LVAL( param->driver_params ));
|
encoding = static_cast<SQLSRV_ENCODING>( Z_LVAL( param->driver_params ));
|
||||||
|
@ -1448,7 +1448,7 @@ int pdo_sqlsrv_stmt_param_hook( _Inout_ pdo_stmt_t *stmt,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW_PDO_ERROR( driver_stmt, PDO_SQLSRV_ERROR_INVALID_DRIVER_PARAM_ENCODING,
|
THROW_PDO_ERROR( driver_stmt, PDO_SQLSRV_ERROR_INVALID_DRIVER_PARAM_ENCODING,
|
||||||
param->paramno + 1 );
|
param->paramno + 1, NULL );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Utility functions used by both connection or statement functions
|
// Contents: Utility functions used by both connection or statement functions
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Declarations for the extension
|
// Contents: Declarations for the extension
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Internal declarations for the extension
|
// Contents: Internal declarations for the extension
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Version resource
|
// Contents: Version resource
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// Contents: Contains functions for handling Windows format strings
|
// Contents: Contains functions for handling Windows format strings
|
||||||
// and UTF-16 on non-Windows platforms
|
// and UTF-16 on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: Contains functions for handling Windows format strings
|
// Contents: Contains functions for handling Windows format strings
|
||||||
// and UTF-16 on non-Windows platforms
|
// and UTF-16 on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains functions for handling UTF-16 on non-Windows platforms
|
// Contents: Contains functions for handling UTF-16 on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains functions for handling UTF-16 on non-Windows platforms
|
// Contents: Contains functions for handling UTF-16 on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Core routines that use connection handles shared between sqlsrv and pdo_sqlsrv
|
// Contents: Core routines that use connection handles shared between sqlsrv and pdo_sqlsrv
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -160,7 +160,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
|
||||||
// In Windows, we try to connect with ODBC driver first and rely on the returned error code to try connecting with other supported ODBC drivers
|
// In Windows, we try to connect with ODBC driver first and rely on the returned error code to try connecting with other supported ODBC drivers
|
||||||
if (conn->driver_version != ODBC_DRIVER::VER_UNKNOWN) {
|
if (conn->driver_version != ODBC_DRIVER::VER_UNKNOWN) {
|
||||||
// if column encryption is enabled, must use ODBC driver 17 or above
|
// if column encryption is enabled, must use ODBC driver 17 or above
|
||||||
CHECK_CUSTOM_ERROR(conn->ce_option.enabled && conn->driver_version == ODBC_DRIVER::VER_13, conn, SQLSRV_ERROR_CE_DRIVER_REQUIRED, get_processor_arch()) {
|
CHECK_CUSTOM_ERROR(conn->ce_option.enabled && conn->driver_version == ODBC_DRIVER::VER_13, conn, SQLSRV_ERROR_CE_DRIVER_REQUIRED, get_processor_arch(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,12 +208,12 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
|
||||||
#endif
|
#endif
|
||||||
else if (d == last_version) {
|
else if (d == last_version) {
|
||||||
// if column encryption is enabled, throw the exception related to column encryption
|
// if column encryption is enabled, throw the exception related to column encryption
|
||||||
CHECK_CUSTOM_ERROR(conn->ce_option.enabled, conn, SQLSRV_ERROR_CE_DRIVER_REQUIRED, get_processor_arch()) {
|
CHECK_CUSTOM_ERROR(conn->ce_option.enabled, conn, SQLSRV_ERROR_CE_DRIVER_REQUIRED, get_processor_arch(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// here it means that none of the supported ODBC drivers is found
|
// here it means that none of the supported ODBC drivers is found
|
||||||
CHECK_CUSTOM_ERROR(true, conn, SQLSRV_ERROR_DRIVER_NOT_INSTALLED, get_processor_arch()) {
|
CHECK_CUSTOM_ERROR(true, conn, SQLSRV_ERROR_DRIVER_NOT_INSTALLED, get_processor_arch(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_SQL_WARNING_AS_ERROR( r, conn ) {
|
CHECK_SQL_WARNING_AS_ERROR( r, conn, NULL ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ SQLRETURN core_odbc_connect( _Inout_ sqlsrv_conn* conn, _Inout_ std::string& con
|
||||||
// Convert our UTF-8 connection string to UTF-16 before connecting with SQLDriverConnnectW
|
// Convert our UTF-8 connection string to UTF-16 before connecting with SQLDriverConnnectW
|
||||||
wconn_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_UTF8, conn_str.c_str(), static_cast<unsigned int>( conn_str.length() ), &wconn_len, true );
|
wconn_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_UTF8, conn_str.c_str(), static_cast<unsigned int>( conn_str.length() ), &wconn_len, true );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( wconn_string == 0, conn, SQLSRV_ERROR_CONNECT_STRING_ENCODING_TRANSLATE, get_last_error_message())
|
CHECK_CUSTOM_ERROR( wconn_string == 0, conn, SQLSRV_ERROR_CONNECT_STRING_ENCODING_TRANSLATE, get_last_error_message(), NULL)
|
||||||
{
|
{
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ void core_sqlsrv_prepare( _Inout_ sqlsrv_stmt* stmt, _In_reads_bytes_(sql_len) c
|
||||||
|
|
||||||
SQLSRV_ENCODING encoding = (( stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() : stmt->encoding() );
|
SQLSRV_ENCODING encoding = (( stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() : stmt->encoding() );
|
||||||
wsql_string = utf16_string_from_mbcs_string( encoding, reinterpret_cast<const char*>( sql ), static_cast<int>( sql_len ), &wsql_len );
|
wsql_string = utf16_string_from_mbcs_string( encoding, reinterpret_cast<const char*>( sql ), static_cast<int>( sql_len ), &wsql_len );
|
||||||
CHECK_CUSTOM_ERROR( wsql_string == 0, stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message() ) {
|
CHECK_CUSTOM_ERROR( wsql_string == 0, stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ void build_connection_string_and_set_conn_attr( _Inout_ sqlsrv_conn* conn, _Inou
|
||||||
DEBUG_SQLSRV_ASSERT(( type == HASH_KEY_IS_LONG ), "build_connection_string_and_set_conn_attr: invalid connection option key type." );
|
DEBUG_SQLSRV_ASSERT(( type == HASH_KEY_IS_LONG ), "build_connection_string_and_set_conn_attr: invalid connection option key type." );
|
||||||
|
|
||||||
conn_opt = get_connection_option( conn, index, valid_conn_opts );
|
conn_opt = get_connection_option( conn, index, valid_conn_opts );
|
||||||
|
if (conn_opt == NULL) throw;
|
||||||
if( index == SQLSRV_CONN_OPTION_MARS ) {
|
if( index == SQLSRV_CONN_OPTION_MARS ) {
|
||||||
mars_mentioned = true;
|
mars_mentioned = true;
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1051,7 @@ void driver_set_func::func(_In_ connection_option const* option, _In_ zval* valu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(conn->driver_version == ODBC_DRIVER::VER_UNKNOWN, conn, SQLSRV_ERROR_CONNECT_INVALID_DRIVER, Z_STRVAL_P(value)) {
|
CHECK_CUSTOM_ERROR(conn->driver_version == ODBC_DRIVER::VER_UNKNOWN, conn, SQLSRV_ERROR_CONNECT_INVALID_DRIVER, Z_STRVAL_P(value), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,6 +1147,7 @@ size_t core_str_zval_is_true(_Inout_ zval* value_z)
|
||||||
|
|
||||||
const char TRUE_VALUE_1[] = "true";
|
const char TRUE_VALUE_1[] = "true";
|
||||||
const char TRUE_VALUE_2[] = "1";
|
const char TRUE_VALUE_2[] = "1";
|
||||||
|
transform(val_str.begin(), val_str.end(), val_str.begin(), ::tolower);
|
||||||
if (!val_str.compare(TRUE_VALUE_1) || !val_str.compare(TRUE_VALUE_2)) {
|
if (!val_str.compare(TRUE_VALUE_1) || !val_str.compare(TRUE_VALUE_2)) {
|
||||||
return 1; // true
|
return 1; // true
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: common initialization routines shared by PDO and sqlsrv
|
// Contents: common initialization routines shared by PDO and sqlsrv
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Result sets
|
// Contents: Result sets
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -611,7 +611,7 @@ sqlsrv_buffered_result_set::sqlsrv_buffered_result_set( _Inout_ sqlsrv_stmt* stm
|
||||||
|
|
||||||
mem_used += meta[i].length;
|
mem_used += meta[i].length;
|
||||||
CHECK_CUSTOM_ERROR( mem_used > stmt->buffered_query_limit * 1024, stmt,
|
CHECK_CUSTOM_ERROR( mem_used > stmt->buffered_query_limit * 1024, stmt,
|
||||||
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit ) {
|
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ sqlsrv_buffered_result_set::sqlsrv_buffered_result_set( _Inout_ sqlsrv_stmt* stm
|
||||||
{
|
{
|
||||||
mem_used += meta[i].length;
|
mem_used += meta[i].length;
|
||||||
CHECK_CUSTOM_ERROR( mem_used > stmt->buffered_query_limit * 1024, stmt,
|
CHECK_CUSTOM_ERROR( mem_used > stmt->buffered_query_limit * 1024, stmt,
|
||||||
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit ) {
|
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1516,7 @@ SQLPOINTER read_lob_field( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_in
|
||||||
if( r == SQL_SUCCESS ) {
|
if( r == SQL_SUCCESS ) {
|
||||||
// check to make sure we haven't overflown our memory limit
|
// check to make sure we haven't overflown our memory limit
|
||||||
CHECK_CUSTOM_ERROR( mem_used + last_field_len > stmt->buffered_query_limit * 1024, stmt,
|
CHECK_CUSTOM_ERROR( mem_used + last_field_len > stmt->buffered_query_limit * 1024, stmt,
|
||||||
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit ) {
|
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1540,7 @@ SQLPOINTER read_lob_field( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_in
|
||||||
if( last_field_len != SQL_NO_TOTAL ) {
|
if( last_field_len != SQL_NO_TOTAL ) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( mem_used + last_field_len > stmt->buffered_query_limit * 1024, stmt,
|
CHECK_CUSTOM_ERROR( mem_used + last_field_len > stmt->buffered_query_limit * 1024, stmt,
|
||||||
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit ) {
|
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -1555,7 +1555,7 @@ SQLPOINTER read_lob_field( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_in
|
||||||
else {
|
else {
|
||||||
to_read *= 2;
|
to_read *= 2;
|
||||||
CHECK_CUSTOM_ERROR( mem_used + to_read > stmt->buffered_query_limit * 1024, stmt,
|
CHECK_CUSTOM_ERROR( mem_used + to_read > stmt->buffered_query_limit * 1024, stmt,
|
||||||
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit ) {
|
SQLSRV_ERROR_BUFFER_LIMIT_EXCEEDED, stmt->buffered_query_limit, NULL) {
|
||||||
|
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Core routines and constants shared by the Microsoft Drivers for PHP for SQL Server
|
// Contents: Core routines and constants shared by the Microsoft Drivers for PHP for SQL Server
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -2208,7 +2208,7 @@ namespace core {
|
||||||
// regular error handling
|
// regular error handling
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CHECK_SQL_ERROR_OR_WARNING( rtemp, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( rtemp, stmt, NULL ) {
|
||||||
|
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
@ -2239,7 +2239,7 @@ namespace core {
|
||||||
SQLRETURN r = ::SQLGetDiagField( ctx->handle_type(), ctx->handle(), record_number, diag_identifier,
|
SQLRETURN r = ::SQLGetDiagField( ctx->handle_type(), ctx->handle(), record_number, diag_identifier,
|
||||||
diag_info_buffer, buffer_length, out_buffer_length );
|
diag_info_buffer, buffer_length, out_buffer_length );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, ctx ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, ctx, NULL) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2251,7 +2251,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLAllocHandle( HandleType, InputHandle.handle(), OutputHandlePtr );
|
r = ::SQLAllocHandle( HandleType, InputHandle.handle(), OutputHandlePtr );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, InputHandle ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, InputHandle, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2272,7 +2272,7 @@ namespace core {
|
||||||
r = ::SQLBindParameter( stmt->handle(), ParameterNumber, InputOutputType, ValueType, ParameterType, ColumnSize,
|
r = ::SQLBindParameter( stmt->handle(), ParameterNumber, InputOutputType, ValueType, ParameterType, ColumnSize,
|
||||||
DecimalDigits, ParameterValuePtr, BufferLength, StrLen_Or_IndPtr );
|
DecimalDigits, ParameterValuePtr, BufferLength, StrLen_Or_IndPtr );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2281,7 +2281,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLCloseCursor( stmt->handle() );
|
SQLRETURN r = ::SQLCloseCursor( stmt->handle() );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2293,7 +2293,7 @@ namespace core {
|
||||||
SQLRETURN r = ::SQLColAttribute( stmt->handle(), field_index, field_identifier, field_type_char,
|
SQLRETURN r = ::SQLColAttribute( stmt->handle(), field_index, field_identifier, field_type_char,
|
||||||
buffer_length, out_buffer_length, field_type_num );
|
buffer_length, out_buffer_length, field_type_num );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2305,7 +2305,7 @@ namespace core {
|
||||||
SQLRETURN r = ::SQLColAttributeW( stmt->handle(), field_index, field_identifier, field_type_char,
|
SQLRETURN r = ::SQLColAttributeW( stmt->handle(), field_index, field_identifier, field_type_char,
|
||||||
buffer_length, out_buffer_length, field_type_num );
|
buffer_length, out_buffer_length, field_type_num );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2318,7 +2318,7 @@ namespace core {
|
||||||
r = ::SQLDescribeCol( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
r = ::SQLDescribeCol( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
||||||
data_type, col_size, decimal_digits, nullable);
|
data_type, col_size, decimal_digits, nullable);
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2331,7 +2331,7 @@ namespace core {
|
||||||
r = ::SQLDescribeColW( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
r = ::SQLDescribeColW( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
||||||
data_type, col_size, decimal_digits, nullable );
|
data_type, col_size, decimal_digits, nullable );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2342,7 +2342,7 @@ namespace core {
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLDescribeParam( stmt->handle(), paramno, data_type, col_size, decimal_digits, nullable );
|
r = ::SQLDescribeParam( stmt->handle(), paramno, data_type, col_size, decimal_digits, nullable );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2352,7 +2352,7 @@ namespace core {
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLNumParams( stmt->handle(), num_params );
|
r = ::SQLNumParams( stmt->handle(), num_params );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2361,7 +2361,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLEndTran( handleType, conn->handle(), completionType );
|
SQLRETURN r = ::SQLEndTran( handleType, conn->handle(), completionType );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, conn ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, conn, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2373,7 +2373,7 @@ namespace core {
|
||||||
|
|
||||||
check_for_mars_error( stmt, r );
|
check_for_mars_error( stmt, r );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
|
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
@ -2387,7 +2387,7 @@ namespace core {
|
||||||
|
|
||||||
check_for_mars_error( stmt, r );
|
check_for_mars_error( stmt, r );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -2401,7 +2401,7 @@ namespace core {
|
||||||
|
|
||||||
check_for_mars_error( stmt, r );
|
check_for_mars_error( stmt, r );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2412,7 +2412,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLFetchScroll( stmt->handle(), fetch_orientation, fetch_offset );
|
SQLRETURN r = ::SQLFetchScroll( stmt->handle(), fetch_orientation, fetch_offset );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -2424,14 +2424,14 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLFreeHandle( ctx.handle_type(), ctx.handle() );
|
r = ::SQLFreeHandle( ctx.handle_type(), ctx.handle() );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, ctx ) {}
|
CHECK_SQL_ERROR_OR_WARNING( r, ctx, NULL ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SQLGetStmtAttr( _Inout_ sqlsrv_stmt* stmt, _In_ SQLINTEGER attr, _Out_writes_opt_(buf_len) void* value_ptr, _In_ SQLINTEGER buf_len, _Out_opt_ SQLINTEGER* str_len)
|
inline void SQLGetStmtAttr( _Inout_ sqlsrv_stmt* stmt, _In_ SQLINTEGER attr, _Out_writes_opt_(buf_len) void* value_ptr, _In_ SQLINTEGER buf_len, _Out_opt_ SQLINTEGER* str_len)
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLGetStmtAttr( stmt->handle(), attr, value_ptr, buf_len, str_len );
|
r = ::SQLGetStmtAttr( stmt->handle(), attr, value_ptr, buf_len, str_len );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2450,7 +2450,7 @@ namespace core {
|
||||||
}
|
}
|
||||||
|
|
||||||
if( handle_warning ) {
|
if( handle_warning ) {
|
||||||
CHECK_SQL_WARNING_AS_ERROR( r, stmt ) {
|
CHECK_SQL_WARNING_AS_ERROR( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2465,7 +2465,7 @@ namespace core {
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLGetInfo( conn->handle(), info_type, info_value, buffer_len, str_len );
|
r = ::SQLGetInfo( conn->handle(), info_type, info_value, buffer_len, str_len );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, conn ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, conn, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2476,7 +2476,7 @@ namespace core {
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLGetTypeInfo( stmt->handle(), data_type );
|
r = ::SQLGetTypeInfo( stmt->handle(), data_type );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,7 +2487,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLMoreResults( stmt->handle() );
|
SQLRETURN r = ::SQLMoreResults( stmt->handle() );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2500,7 +2500,7 @@ namespace core {
|
||||||
SQLSMALLINT num_cols;
|
SQLSMALLINT num_cols;
|
||||||
r = ::SQLNumResultCols( stmt->handle(), &num_cols );
|
r = ::SQLNumResultCols( stmt->handle(), &num_cols );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2513,7 +2513,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLParamData( stmt->handle(), value_ptr_ptr );
|
r = ::SQLParamData( stmt->handle(), value_ptr_ptr );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -2523,7 +2523,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLPrepareW( stmt->handle(), sql, sql_len );
|
r = ::SQLPrepareW( stmt->handle(), sql, sql_len );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2533,7 +2533,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLPutData( stmt->handle(), data_ptr, strlen_or_ind );
|
r = ::SQLPutData( stmt->handle(), data_ptr, strlen_or_ind );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2558,7 +2558,7 @@ namespace core {
|
||||||
return 0;
|
return 0;
|
||||||
#endif // !_WIN32
|
#endif // !_WIN32
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2571,7 +2571,7 @@ namespace core {
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLSetConnectAttr( ctx.handle(), attr, value_ptr, str_len );
|
r = ::SQLSetConnectAttr( ctx.handle(), attr, value_ptr, str_len );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, ctx ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, ctx, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2583,7 +2583,7 @@ namespace core {
|
||||||
core::SQLGetStmtAttr( stmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0 );
|
core::SQLGetStmtAttr( stmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0 );
|
||||||
if( value_ptr ) {
|
if( value_ptr ) {
|
||||||
r = ::SQLSetDescField( hIpd, rec_num, fld_id, value_ptr, str_len );
|
r = ::SQLSetDescField( hIpd, rec_num, fld_id, value_ptr, str_len );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2593,7 +2593,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLSetEnvAttr( ctx.handle(), attr, value_ptr, str_len );
|
r = ::SQLSetEnvAttr( ctx.handle(), attr, value_ptr, str_len );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, ctx ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, ctx, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2602,7 +2602,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLSetConnectAttr( conn->handle(), attribute, value_ptr, value_len );
|
SQLRETURN r = ::SQLSetConnectAttr( conn->handle(), attribute, value_ptr, value_len );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, conn ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, conn, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2611,7 +2611,7 @@ namespace core {
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLSetStmtAttr( stmt->handle(), attr, value_ptr, str_len );
|
r = ::SQLSetStmtAttr( stmt->handle(), attr, value_ptr, str_len );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Core routines that use statement handles shared between sqlsrv and pdo_sqlsrv
|
// Contents: Core routines that use statement handles shared between sqlsrv and pdo_sqlsrv
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -366,7 +366,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
|
||||||
_Inout_ SQLSMALLINT decimal_digits)
|
_Inout_ SQLSMALLINT decimal_digits)
|
||||||
{
|
{
|
||||||
// check is only < because params are 0 based
|
// check is only < because params are 0 based
|
||||||
CHECK_CUSTOM_ERROR(param_num >= SQL_SERVER_MAX_PARAMS, stmt, SQLSRV_ERROR_MAX_PARAMS_EXCEEDED, param_num + 1) {
|
CHECK_CUSTOM_ERROR(param_num >= SQL_SERVER_MAX_PARAMS, stmt, SQLSRV_ERROR_MAX_PARAMS_EXCEEDED, param_num + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,17 +408,30 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
|
||||||
|
|
||||||
bool result = param_ptr->prepare_param(param_ref, param_z);
|
bool result = param_ptr->prepare_param(param_ref, param_z);
|
||||||
if (!result && direction == SQL_PARAM_INPUT_OUTPUT) {
|
if (!result && direction == SQL_PARAM_INPUT_OUTPUT) {
|
||||||
CHECK_CUSTOM_ERROR(!result, stmt, SQLSRV_ERROR_INPUT_OUTPUT_PARAM_TYPE_MATCH, param_num + 1) {
|
CHECK_CUSTOM_ERROR(!result, stmt, SQLSRV_ERROR_INPUT_OUTPUT_PARAM_TYPE_MATCH, param_num + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If Always Encrypted is enabled, transfer the known param meta data if applicable, which might alter param_z for decimal types
|
// If Always Encrypted is enabled, transfer the known param meta data if applicable, which might alter param_z for decimal types
|
||||||
if (stmt->conn->ce_option.enabled) {
|
if (stmt->conn->ce_option.enabled
|
||||||
if (param_ptr->sql_data_type == SQL_UNKNOWN_TYPE || param_ptr->column_size == SQLSRV_UNKNOWN_SIZE) {
|
&& (param_ptr->sql_data_type == SQL_UNKNOWN_TYPE || param_ptr->column_size == SQLSRV_UNKNOWN_SIZE)) {
|
||||||
// meta data parameters are always sorted based on parameter number
|
// meta data parameters are always sorted based on parameter number
|
||||||
param_ptr->copy_param_meta_ae(param_z, stmt->params_container.params_meta_ae[param_num]);
|
param_ptr->copy_param_meta_ae(param_z, stmt->params_container.params_meta_ae[param_num]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (Z_TYPE_P(param_z) == IS_STRING && column_size == SQLSRV_UNKNOWN_SIZE) {
|
||||||
|
size_t char_size = (encoding == SQLSRV_ENCODING_UTF8) ? sizeof(SQLWCHAR) : sizeof(char);
|
||||||
|
SQLULEN byte_len = Z_STRLEN_P(param_z) * char_size;
|
||||||
|
if (byte_len > SQL_SERVER_MAX_FIELD_SIZE) {
|
||||||
|
param_ptr->column_size = SQL_SERVER_MAX_TYPE_SIZE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (param_ptr->column_size == SQLSRV_UNKNOWN_SIZE) {
|
||||||
|
param_ptr->column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all necessary values to prepare for SQLBindParameter
|
// Get all necessary values to prepare for SQLBindParameter
|
||||||
|
@ -476,7 +489,7 @@ SQLRETURN core_sqlsrv_execute( _Inout_ sqlsrv_stmt* stmt, _In_reads_bytes_(sql_l
|
||||||
wsql_string = utf16_string_from_mbcs_string( encoding, reinterpret_cast<const char*>( sql ),
|
wsql_string = utf16_string_from_mbcs_string( encoding, reinterpret_cast<const char*>( sql ),
|
||||||
sql_len, &wsql_len );
|
sql_len, &wsql_len );
|
||||||
CHECK_CUSTOM_ERROR( wsql_string == 0, stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE,
|
CHECK_CUSTOM_ERROR( wsql_string == 0, stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE,
|
||||||
get_last_error_message() ) {
|
get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -633,7 +646,7 @@ field_meta_data* core_sqlsrv_field_metadata( _Inout_ sqlsrv_stmt* stmt, _In_ SQL
|
||||||
|
|
||||||
bool converted = convert_string_from_utf16( encoding, field_name_temp, field_len_temp, ( char** ) &( meta_data->field_name ), field_name_len );
|
bool converted = convert_string_from_utf16( encoding, field_name_temp, field_len_temp, ( char** ) &( meta_data->field_name ), field_name_len );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() ) {
|
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,7 +724,7 @@ void core_sqlsrv_sensitivity_metadata( _Inout_ sqlsrv_stmt* stmt )
|
||||||
// To retrieve sensitivity classfication data, the first step is to retrieve the IRD(Implementation Row Descriptor) handle by
|
// To retrieve sensitivity classfication data, the first step is to retrieve the IRD(Implementation Row Descriptor) handle by
|
||||||
// calling SQLGetStmtAttr with SQL_ATTR_IMP_ROW_DESC statement attribute
|
// calling SQLGetStmtAttr with SQL_ATTR_IMP_ROW_DESC statement attribute
|
||||||
r = ::SQLGetStmtAttr(stmt->handle(), SQL_ATTR_IMP_ROW_DESC, reinterpret_cast<SQLPOINTER*>(&ird), SQL_IS_POINTER, 0);
|
r = ::SQLGetStmtAttr(stmt->handle(), SQL_ATTR_IMP_ROW_DESC, reinterpret_cast<SQLPOINTER*>(&ird), SQL_IS_POINTER, 0);
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
LOG(SEV_ERROR, "core_sqlsrv_sensitivity_metadata: failed in getting Implementation Row Descriptor handle." );
|
LOG(SEV_ERROR, "core_sqlsrv_sensitivity_metadata: failed in getting Implementation Row Descriptor handle." );
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
@ -728,7 +741,7 @@ void core_sqlsrv_sensitivity_metadata( _Inout_ sqlsrv_stmt* stmt )
|
||||||
SQLSMALLINT len;
|
SQLSMALLINT len;
|
||||||
rc = ::SQLGetDiagField(SQL_HANDLE_DESC, ird, 1, SQL_DIAG_SQLSTATE, state, SQL_SQLSTATE_BUFSIZE, &len);
|
rc = ::SQLGetDiagField(SQL_HANDLE_DESC, ird, 1, SQL_DIAG_SQLSTATE, state, SQL_SQLSTATE_BUFSIZE, &len);
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING(rc, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(rc, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +749,7 @@ void core_sqlsrv_sensitivity_metadata( _Inout_ sqlsrv_stmt* stmt )
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(true, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "Check if ODBC driver or the server supports the Data Classification feature.") {
|
CHECK_CUSTOM_ERROR(true, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "Check if ODBC driver or the server supports the Data Classification feature.", NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -748,7 +761,7 @@ void core_sqlsrv_sensitivity_metadata( _Inout_ sqlsrv_stmt* stmt )
|
||||||
if (r != SQL_SUCCESS) {
|
if (r != SQL_SUCCESS) {
|
||||||
LOG(SEV_ERROR, "core_sqlsrv_sensitivity_metadata: failed in calling SQLGetDescFieldW again." );
|
LOG(SEV_ERROR, "core_sqlsrv_sensitivity_metadata: failed in calling SQLGetDescFieldW again." );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(true, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "SQLGetDescFieldW failed unexpectedly") {
|
CHECK_CUSTOM_ERROR(true, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "SQLGetDescFieldW failed unexpectedly", NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,7 +793,7 @@ void core_sqlsrv_sensitivity_metadata( _Inout_ sqlsrv_stmt* stmt )
|
||||||
unsigned char *dcend = dcbuf;
|
unsigned char *dcend = dcbuf;
|
||||||
dcend += dclen;
|
dcend += dclen;
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(dcptr != dcend, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "Metadata parsing ends unexpectedly") {
|
CHECK_CUSTOM_ERROR(dcptr != dcend, stmt, SQLSRV_ERROR_DATA_CLASSIFICATION_FAILED, "Metadata parsing ends unexpectedly", NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,7 +1084,7 @@ void core_sqlsrv_set_query_timeout( _Inout_ sqlsrv_stmt* stmt, _Inout_ zval* val
|
||||||
if( Z_TYPE_P( value_z ) != IS_LONG || Z_LVAL_P( value_z ) < 0 ) {
|
if( Z_TYPE_P( value_z ) != IS_LONG || Z_LVAL_P( value_z ) < 0 ) {
|
||||||
|
|
||||||
convert_to_string( value_z );
|
convert_to_string( value_z );
|
||||||
THROW_CORE_ERROR( stmt, SQLSRV_ERROR_INVALID_QUERY_TIMEOUT_VALUE, Z_STRVAL_P( value_z ) );
|
THROW_CORE_ERROR( stmt, SQLSRV_ERROR_INVALID_QUERY_TIMEOUT_VALUE, Z_STRVAL_P( value_z ), NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the query timeout setting for processing later
|
// Save the query timeout setting for processing later
|
||||||
|
@ -1354,7 +1367,7 @@ size_t calc_utf8_missing( _Inout_ sqlsrv_stmt* stmt, _In_reads_(buffer_end) cons
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW_CORE_ERROR( stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE,
|
THROW_CORE_ERROR( stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE,
|
||||||
get_last_error_message( ERROR_NO_UNICODE_TRANSLATION ));
|
get_last_error_message( ERROR_NO_UNICODE_TRANSLATION ), NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,7 +1392,7 @@ void core_get_field_common( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_i
|
||||||
|
|
||||||
// make sure that fields are not retrieved incorrectly.
|
// make sure that fields are not retrieved incorrectly.
|
||||||
CHECK_CUSTOM_ERROR( stmt->last_field_index > field_index, stmt, SQLSRV_ERROR_FIELD_INDEX_ERROR, field_index,
|
CHECK_CUSTOM_ERROR( stmt->last_field_index > field_index, stmt, SQLSRV_ERROR_FIELD_INDEX_ERROR, field_index,
|
||||||
stmt->last_field_index ) {
|
stmt->last_field_index, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,11 +1407,11 @@ void core_get_field_common( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_i
|
||||||
SQLRETURN r = stmt->current_results->get_data( field_index + 1, SQL_C_LONG, field_value_temp, sizeof( SQLLEN ),
|
SQLRETURN r = stmt->current_results->get_data( field_index + 1, SQL_C_LONG, field_value_temp, sizeof( SQLLEN ),
|
||||||
field_len, true /*handle_warning*/ );
|
field_len, true /*handle_warning*/ );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( r == SQL_NO_DATA ), stmt, SQLSRV_ERROR_NO_DATA, field_index ) {
|
CHECK_CUSTOM_ERROR(( r == SQL_NO_DATA ), stmt, SQLSRV_ERROR_NO_DATA, field_index, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,11 +1434,11 @@ void core_get_field_common( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_i
|
||||||
SQLRETURN r = stmt->current_results->get_data( field_index + 1, SQL_C_DOUBLE, field_value_temp, sizeof( double ),
|
SQLRETURN r = stmt->current_results->get_data( field_index + 1, SQL_C_DOUBLE, field_value_temp, sizeof( double ),
|
||||||
field_len, true /*handle_warning*/ );
|
field_len, true /*handle_warning*/ );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( r == SQL_NO_DATA ), stmt, SQLSRV_ERROR_NO_DATA, field_index ) {
|
CHECK_CUSTOM_ERROR(( r == SQL_NO_DATA ), stmt, SQLSRV_ERROR_NO_DATA, field_index, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1464,7 +1477,7 @@ void core_get_field_common( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_i
|
||||||
field_len_temp = 0;
|
field_len_temp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR((r == SQL_NO_DATA), stmt, SQLSRV_ERROR_NO_DATA, field_index) {
|
CHECK_CUSTOM_ERROR((r == SQL_NO_DATA), stmt, SQLSRV_ERROR_NO_DATA, field_index, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1700,7 +1713,7 @@ void get_field_as_string(_Inout_ sqlsrv_stmt *stmt, _In_ SQLUSMALLINT field_inde
|
||||||
r = stmt->current_results->get_data(field_index + 1, c_type, field_value_temp, sql_display_size + extra, &field_len_temp, false /*handle_warning*/);
|
r = stmt->current_results->get_data(field_index + 1, c_type, field_value_temp, sql_display_size + extra, &field_len_temp, false /*handle_warning*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR((r == SQL_NO_DATA), stmt, SQLSRV_ERROR_NO_DATA, field_index) {
|
CHECK_CUSTOM_ERROR((r == SQL_NO_DATA), stmt, SQLSRV_ERROR_NO_DATA, field_index, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1775,7 @@ void get_field_as_string(_Inout_ sqlsrv_stmt *stmt, _In_ SQLUSMALLINT field_inde
|
||||||
field_len_temp + buffer_len, &chunk_field_len, false /*handle_warning*/);
|
field_len_temp + buffer_len, &chunk_field_len, false /*handle_warning*/);
|
||||||
field_len_temp = initial_field_len + chunk_field_len;
|
field_len_temp = initial_field_len + chunk_field_len;
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1772,7 +1785,7 @@ void get_field_as_string(_Inout_ sqlsrv_stmt *stmt, _In_ SQLUSMALLINT field_inde
|
||||||
} // if (is_truncated_warning(state))
|
} // if (is_truncated_warning(state))
|
||||||
} // if (r == SQL_SUCCESS_WITH_INFO)
|
} // if (r == SQL_SUCCESS_WITH_INFO)
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1780,7 +1793,7 @@ void get_field_as_string(_Inout_ sqlsrv_stmt *stmt, _In_ SQLUSMALLINT field_inde
|
||||||
bool converted = convert_string_from_utf16_inplace(static_cast<SQLSRV_ENCODING>(sqlsrv_php_type.typeinfo.encoding),
|
bool converted = convert_string_from_utf16_inplace(static_cast<SQLSRV_ENCODING>(sqlsrv_php_type.typeinfo.encoding),
|
||||||
&field_value_temp, field_len_temp);
|
&field_value_temp, field_len_temp);
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2145,7 +2158,7 @@ void sqlsrv_param::process_param(_Inout_ sqlsrv_stmt* stmt, _Inout_ zval* param_
|
||||||
break;
|
break;
|
||||||
case IS_ARRAY:
|
case IS_ARRAY:
|
||||||
default:
|
default:
|
||||||
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1);
|
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2272,18 +2285,6 @@ bool sqlsrv_param::derive_string_types_sizes(_In_ zval* param_z)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive the column size also only if it is unknown
|
|
||||||
if (column_size == SQLSRV_UNKNOWN_SIZE) {
|
|
||||||
size_t char_size = (encoding == SQLSRV_ENCODING_UTF8) ? sizeof(SQLWCHAR) : sizeof(char);
|
|
||||||
SQLULEN byte_len = Z_STRLEN_P(param_z) * char_size;
|
|
||||||
|
|
||||||
if (byte_len > SQL_SERVER_MAX_FIELD_SIZE) {
|
|
||||||
column_size = SQL_SERVER_MAX_TYPE_SIZE;
|
|
||||||
} else {
|
|
||||||
column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_numeric;
|
return is_numeric;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2331,7 +2332,7 @@ void sqlsrv_param::process_string_param(_Inout_ sqlsrv_stmt* stmt, _Inout_ zval*
|
||||||
}
|
}
|
||||||
// This changes the member placeholder_z to hold the wide string
|
// This changes the member placeholder_z to hold the wide string
|
||||||
bool converted = convert_input_str_to_utf16(stmt, param_z);
|
bool converted = convert_input_str_to_utf16(stmt, param_z);
|
||||||
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_INPUT_PARAM_ENCODING_TRANSLATE, param_pos + 1, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_INPUT_PARAM_ENCODING_TRANSLATE, param_pos + 1, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2491,7 +2492,7 @@ void sqlsrv_param::process_object_param(_Inout_ sqlsrv_stmt* stmt, _Inout_ zval*
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
succeeded = convert_datetime_to_string(stmt, param_z);
|
succeeded = convert_datetime_to_string(stmt, param_z);
|
||||||
}
|
}
|
||||||
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2507,6 +2508,9 @@ void sqlsrv_param::bind_param(_Inout_ sqlsrv_stmt* stmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
core::SQLBindParameter(stmt, param_pos + 1, direction, c_data_type, sql_data_type, column_size, decimal_digits, buffer, buffer_length, &strlen_or_indptr);
|
core::SQLBindParameter(stmt, param_pos + 1, direction, c_data_type, sql_data_type, column_size, decimal_digits, buffer, buffer_length, &strlen_or_indptr);
|
||||||
|
if (!stmt->conn->ce_option.enabled && !stmt->format_decimals) {
|
||||||
|
sql_data_type = SQL_UNKNOWN_TYPE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sqlsrv_param::init_data_from_zval(_Inout_ sqlsrv_stmt* stmt)
|
void sqlsrv_param::init_data_from_zval(_Inout_ sqlsrv_stmt* stmt)
|
||||||
|
@ -2576,7 +2580,7 @@ bool sqlsrv_param::send_data_packet(_Inout_ sqlsrv_stmt* stmt)
|
||||||
// read the missing bytes
|
// read the missing bytes
|
||||||
size_t new_read = php_stream_read(param_stream, static_cast<char*>(buffer) + read, need_to_read);
|
size_t new_read = php_stream_read(param_stream, static_cast<char*>(buffer) + read, need_to_read);
|
||||||
// if the bytes couldn't be read, then we return an error
|
// if the bytes couldn't be read, then we return an error
|
||||||
CHECK_CUSTOM_ERROR(new_read != need_to_read, stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE, get_last_error_message(ERROR_NO_UNICODE_TRANSLATION)) {
|
CHECK_CUSTOM_ERROR(new_read != need_to_read, stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE, get_last_error_message(ERROR_NO_UNICODE_TRANSLATION), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2587,7 +2591,7 @@ bool sqlsrv_param::send_data_packet(_Inout_ sqlsrv_stmt* stmt)
|
||||||
wsize = MultiByteToWideChar(encoding, MB_ERR_INVALID_CHARS, buffer, static_cast<int>(read + new_read), wbuffer, static_cast<int>(sizeof(wbuffer) / sizeof(wchar_t)));
|
wsize = MultiByteToWideChar(encoding, MB_ERR_INVALID_CHARS, buffer, static_cast<int>(read + new_read), wbuffer, static_cast<int>(sizeof(wbuffer) / sizeof(wchar_t)));
|
||||||
#endif //!_WIN32
|
#endif //!_WIN32
|
||||||
// something else must be wrong if it failed
|
// something else must be wrong if it failed
|
||||||
CHECK_CUSTOM_ERROR(wsize == 0, stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE, get_last_error_message(ERROR_NO_UNICODE_TRANSLATION)) {
|
CHECK_CUSTOM_ERROR(wsize == 0, stmt, SQLSRV_ERROR_INPUT_STREAM_ENCODING_TRANSLATE, get_last_error_message(ERROR_NO_UNICODE_TRANSLATION), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2690,7 +2694,7 @@ void sqlsrv_param_inout::process_param(_Inout_ sqlsrv_stmt* stmt, zval* param_z)
|
||||||
process_string_param(stmt, param_z);
|
process_string_param(stmt, param_z);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1);
|
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, param_pos + 1, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2728,7 +2732,7 @@ void sqlsrv_param_inout::process_string_param(_Inout_ sqlsrv_stmt* stmt, _Inout_
|
||||||
unsigned int wchar_size = 0;
|
unsigned int wchar_size = 0;
|
||||||
|
|
||||||
wide_buffer = utf16_string_from_mbcs_string(SQLSRV_ENCODING_UTF8, reinterpret_cast<const char*>(buffer), static_cast<int>(buffer_length), &wchar_size);
|
wide_buffer = utf16_string_from_mbcs_string(SQLSRV_ENCODING_UTF8, reinterpret_cast<const char*>(buffer), static_cast<int>(buffer_length), &wchar_size);
|
||||||
CHECK_CUSTOM_ERROR(wide_buffer == 0, stmt, SQLSRV_ERROR_INPUT_PARAM_ENCODING_TRANSLATE, param_pos + 1, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(wide_buffer == 0, stmt, SQLSRV_ERROR_INPUT_PARAM_ENCODING_TRANSLATE, param_pos + 1, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
wide_buffer[wchar_size] = L'\0';
|
wide_buffer[wchar_size] = L'\0';
|
||||||
|
@ -2857,7 +2861,7 @@ void sqlsrv_param_inout::finalize_output_string()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(str_len > (buffer_length - null_size), stmt, SQLSRV_ERROR_OUTPUT_PARAM_TRUNCATED, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(str_len > (buffer_length - null_size), stmt, SQLSRV_ERROR_OUTPUT_PARAM_TRUNCATED, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2884,7 +2888,7 @@ void sqlsrv_param_inout::finalize_output_string()
|
||||||
SQLLEN outLen = 0;
|
SQLLEN outLen = 0;
|
||||||
|
|
||||||
bool result = convert_string_from_utf16(encoding, reinterpret_cast<const SQLWCHAR*>(str), int(str_len / sizeof(SQLWCHAR)), &outString, outLen);
|
bool result = convert_string_from_utf16(encoding, reinterpret_cast<const SQLWCHAR*>(str), int(str_len / sizeof(SQLWCHAR)), &outString, outLen);
|
||||||
CHECK_CUSTOM_ERROR(!result, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(!result, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3028,7 +3032,7 @@ void sqlsrv_param_tvp::get_tvp_metadata(_In_ sqlsrv_stmt* stmt, _In_ zend_string
|
||||||
core::SQLAllocHandle(SQL_HANDLE_STMT, *(stmt->conn), &chstmt);
|
core::SQLAllocHandle(SQL_HANDLE_STMT, *(stmt->conn), &chstmt);
|
||||||
|
|
||||||
rc = SQLSetStmtAttr(chstmt, SQL_SOPT_SS_NAME_SCOPE, (SQLPOINTER)SQL_SS_NAME_SCOPE_TABLE_TYPE, SQL_IS_UINTEGER);
|
rc = SQLSetStmtAttr(chstmt, SQL_SOPT_SS_NAME_SCOPE, (SQLPOINTER)SQL_SS_NAME_SCOPE_TABLE_TYPE, SQL_IS_UINTEGER);
|
||||||
CHECK_CUSTOM_ERROR(!SQL_SUCCEEDED(rc), stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(!SQL_SUCCEEDED(rc), stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3040,7 +3044,7 @@ void sqlsrv_param_tvp::get_tvp_metadata(_In_ sqlsrv_stmt* stmt, _In_ zend_string
|
||||||
rc = SQLColumns(chstmt, NULL, 0, NULL, SQL_NTS, reinterpret_cast<SQLCHAR*>(table_type), SQL_NTS, NULL, 0);
|
rc = SQLColumns(chstmt, NULL, 0, NULL, SQL_NTS, reinterpret_cast<SQLCHAR*>(table_type), SQL_NTS, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(!SQL_SUCCEEDED(rc), stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(!SQL_SUCCEEDED(rc), stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3055,7 +3059,7 @@ void sqlsrv_param_tvp::get_tvp_metadata(_In_ sqlsrv_stmt* stmt, _In_ zend_string
|
||||||
while (SQL_SUCCESS == rc) {
|
while (SQL_SUCCESS == rc) {
|
||||||
rc = SQLFetch(chstmt);
|
rc = SQLFetch(chstmt);
|
||||||
if (rc == SQL_NO_DATA) {
|
if (rc == SQL_NO_DATA) {
|
||||||
CHECK_CUSTOM_ERROR(tvp_columns.size() == 0, stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(tvp_columns.size() == 0, stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3076,7 +3080,7 @@ void sqlsrv_param_tvp::get_tvp_metadata(_In_ sqlsrv_stmt* stmt, _In_ zend_string
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1);
|
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_TVP_FETCH_METADATA, param_pos + 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLCloseCursor(chstmt);
|
SQLCloseCursor(chstmt);
|
||||||
|
@ -3150,13 +3154,13 @@ int sqlsrv_param_tvp::parse_tv_param_arrays(_Inout_ sqlsrv_stmt* stmt, _Inout_ z
|
||||||
tvp_data_z = zend_hash_get_current_data_ex(inputs_ht, &pos);
|
tvp_data_z = zend_hash_get_current_data_ex(inputs_ht, &pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR((key_type == HASH_KEY_IS_LONG || key_len == 0), stmt, SQLSRV_ERROR_TVP_INVALID_TABLE_TYPE_NAME, param_pos + 1) {
|
CHECK_CUSTOM_ERROR((key_type == HASH_KEY_IS_LONG || key_len == 0), stmt, SQLSRV_ERROR_TVP_INVALID_TABLE_TYPE_NAME, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Find the docs page somewhere that says a TVP can not be null but it may have null columns??
|
// TODO: Find the docs page somewhere that says a TVP can not be null but it may have null columns??
|
||||||
CHECK_CUSTOM_ERROR(tvp_data_z == NULL || Z_TYPE_P(tvp_data_z) == IS_NULL || Z_TYPE_P(tvp_data_z) != IS_ARRAY, stmt, SQLSRV_ERROR_TVP_INVALID_INPUTS, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(tvp_data_z == NULL || Z_TYPE_P(tvp_data_z) == IS_NULL || Z_TYPE_P(tvp_data_z) != IS_ARRAY, stmt, SQLSRV_ERROR_TVP_INVALID_INPUTS, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3203,7 +3207,7 @@ int sqlsrv_param_tvp::parse_tv_param_arrays(_Inout_ sqlsrv_stmt* stmt, _Inout_ z
|
||||||
// Loop through the rows to check the number of columns
|
// Loop through the rows to check the number of columns
|
||||||
ZEND_HASH_FOREACH_KEY_VAL(rows_ht, id, key, row_z) {
|
ZEND_HASH_FOREACH_KEY_VAL(rows_ht, id, key, row_z) {
|
||||||
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
||||||
CHECK_CUSTOM_ERROR(type == HASH_KEY_IS_STRING, stmt, SQLSRV_ERROR_TVP_STRING_KEYS, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(type == HASH_KEY_IS_STRING, stmt, SQLSRV_ERROR_TVP_STRING_KEYS, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3212,13 +3216,13 @@ int sqlsrv_param_tvp::parse_tv_param_arrays(_Inout_ sqlsrv_stmt* stmt, _Inout_ z
|
||||||
}
|
}
|
||||||
|
|
||||||
// Individual row must be an array
|
// Individual row must be an array
|
||||||
CHECK_CUSTOM_ERROR(Z_TYPE_P(row_z) != IS_ARRAY, stmt, SQLSRV_ERROR_TVP_ROW_NOT_ARRAY, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(Z_TYPE_P(row_z) != IS_ARRAY, stmt, SQLSRV_ERROR_TVP_ROW_NOT_ARRAY, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are all the TVP's rows the same size
|
// Are all the TVP's rows the same size
|
||||||
num_columns = zend_hash_num_elements(Z_ARRVAL_P(row_z));
|
num_columns = zend_hash_num_elements(Z_ARRVAL_P(row_z));
|
||||||
CHECK_CUSTOM_ERROR(num_columns != total_num_columns, stmt, SQLSRV_ERROR_TVP_ROWS_UNEXPECTED_SIZE, param_pos + 1, total_num_columns) {
|
CHECK_CUSTOM_ERROR(num_columns != total_num_columns, stmt, SQLSRV_ERROR_TVP_ROWS_UNEXPECTED_SIZE, param_pos + 1, total_num_columns, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
@ -3253,7 +3257,7 @@ void sqlsrv_param_tvp::process_param_column_value(_Inout_ sqlsrv_stmt* stmt)
|
||||||
} else {
|
} else {
|
||||||
// If preprocessing a datetime object fails, throw an error of invalid php type
|
// If preprocessing a datetime object fails, throw an error of invalid php type
|
||||||
bool succeeded = preprocess_datetime_object(stmt, data_z);
|
bool succeeded = preprocess_datetime_object(stmt, data_z);
|
||||||
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3265,7 +3269,7 @@ void sqlsrv_param_tvp::process_param_column_value(_Inout_ sqlsrv_stmt* stmt)
|
||||||
process_null_param_value(stmt);
|
process_null_param_value(stmt);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1);
|
THROW_CORE_ERROR(stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3329,7 +3333,7 @@ void sqlsrv_param_tvp::bind_param(_Inout_ sqlsrv_stmt* stmt)
|
||||||
// server to determine the type of the table-valued parameter.
|
// server to determine the type of the table-valued parameter.
|
||||||
char *tvp_name = reinterpret_cast<char *>(buffer);
|
char *tvp_name = reinterpret_cast<char *>(buffer);
|
||||||
SQLRETURN r = ::SQLSetDescField(hIpd, param_pos + 1, SQL_CA_SS_TYPE_NAME, reinterpret_cast<SQLCHAR*>(tvp_name), SQL_NTS);
|
SQLRETURN r = ::SQLSetDescField(hIpd, param_pos + 1, SQL_CA_SS_TYPE_NAME, reinterpret_cast<SQLCHAR*>(tvp_name), SQL_NTS);
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3339,7 +3343,7 @@ void sqlsrv_param_tvp::bind_param(_Inout_ sqlsrv_stmt* stmt)
|
||||||
// the server will not be able to determine the type of the table-valued parameter.
|
// the server will not be able to determine the type of the table-valued parameter.
|
||||||
char * schema_name = Z_STRVAL(placeholder_z);
|
char * schema_name = Z_STRVAL(placeholder_z);
|
||||||
SQLRETURN r = ::SQLSetDescField(hIpd, param_pos + 1, SQL_CA_SS_SCHEMA_NAME, reinterpret_cast<SQLCHAR*>(schema_name), SQL_NTS);
|
SQLRETURN r = ::SQLSetDescField(hIpd, param_pos + 1, SQL_CA_SS_SCHEMA_NAME, reinterpret_cast<SQLCHAR*>(schema_name), SQL_NTS);
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
// Free and reset the placeholder_z
|
// Free and reset the placeholder_z
|
||||||
|
@ -3352,7 +3356,7 @@ void sqlsrv_param_tvp::bind_param(_Inout_ sqlsrv_stmt* stmt)
|
||||||
SQLHDESC desc;
|
SQLHDESC desc;
|
||||||
core::SQLGetStmtAttr(stmt, SQL_ATTR_APP_PARAM_DESC, &desc, 0, 0);
|
core::SQLGetStmtAttr(stmt, SQL_ATTR_APP_PARAM_DESC, &desc, 0, 0);
|
||||||
SQLRETURN r = ::SQLSetDescField(desc, param_pos + 1, SQL_DESC_DATA_PTR, reinterpret_cast<SQLPOINTER>(this), 0);
|
SQLRETURN r = ::SQLSetDescField(desc, param_pos + 1, SQL_DESC_DATA_PTR, reinterpret_cast<SQLPOINTER>(this), 0);
|
||||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
CHECK_SQL_ERROR_OR_WARNING(r, stmt, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3378,7 +3382,7 @@ void sqlsrv_param_tvp::bind_param(_Inout_ sqlsrv_stmt* stmt)
|
||||||
// through the entire first row of column values using the Zend macros.
|
// through the entire first row of column values using the Zend macros.
|
||||||
ZEND_HASH_FOREACH_KEY_VAL(cols_ht, id, key, data_z) {
|
ZEND_HASH_FOREACH_KEY_VAL(cols_ht, id, key, data_z) {
|
||||||
int type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
int type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
||||||
CHECK_CUSTOM_ERROR(type == HASH_KEY_IS_STRING, stmt, SQLSRV_ERROR_TVP_STRING_KEYS, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(type == HASH_KEY_IS_STRING, stmt, SQLSRV_ERROR_TVP_STRING_KEYS, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3514,7 +3518,7 @@ bool sqlsrv_param_tvp::send_data_packet(_Inout_ sqlsrv_stmt* stmt)
|
||||||
bool succeeded = convert_datetime_to_string(stmt, value_z);
|
bool succeeded = convert_datetime_to_string(stmt, value_z);
|
||||||
|
|
||||||
// Conversion failed so assume the input was an invalid PHP type
|
// Conversion failed so assume the input was an invalid PHP type
|
||||||
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1) {
|
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_INVALID_COLUMN_PHPTYPE, parent_tvp->param_pos + 1, param_pos + 1, NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3540,7 +3544,7 @@ bool sqlsrv_param_tvp::send_data_packet(_Inout_ sqlsrv_stmt* stmt)
|
||||||
}
|
}
|
||||||
// This method would change the member placeholder_z
|
// This method would change the member placeholder_z
|
||||||
bool succeeded = convert_input_str_to_utf16(stmt, value_z);
|
bool succeeded = convert_input_str_to_utf16(stmt, value_z);
|
||||||
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_STRING_ENCODING_TRANSLATE, parent_tvp->param_pos + 1, param_pos + 1, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(!succeeded, stmt, SQLSRV_ERROR_TVP_STRING_ENCODING_TRANSLATE, parent_tvp->param_pos + 1, param_pos + 1, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Implementation of PHP streams for reading SQL Server data
|
// Contents: Implementation of PHP streams for reading SQL Server data
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -168,7 +168,7 @@ size_t sqlsrv_stream_read(_Inout_ php_stream* stream, _Out_writes_bytes_(count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CHECK_SQL_WARNING( r, ss->stmt );
|
CHECK_SQL_WARNING( r, ss->stmt, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ size_t sqlsrv_stream_read(_Inout_ php_stream* stream, _Out_writes_bytes_(count)
|
||||||
if( enc_len == 0 ) {
|
if( enc_len == 0 ) {
|
||||||
|
|
||||||
stream->eof = 1;
|
stream->eof = 1;
|
||||||
THROW_CORE_ERROR( ss->stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() );
|
THROW_CORE_ERROR( ss->stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message(), NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
read = enc_len;
|
read = enc_len;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//
|
//
|
||||||
// Comments: Mostly error handling and some type handling
|
// Comments: Mostly error handling and some type handling
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -509,7 +509,7 @@ namespace data_classification {
|
||||||
|
|
||||||
bool converted = convert_string_from_utf16(encoding, temp_field_name, len, field_name, field_name_len);
|
bool converted = convert_string_from_utf16(encoding, temp_field_name, len, field_name, field_name_len);
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message()) {
|
CHECK_CUSTOM_ERROR(!converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: Contains functions for handling Windows format strings
|
// Contents: Contains functions for handling Windows format strings
|
||||||
// and UTF-16 on non-Windows platforms
|
// and UTF-16 on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: Contains a portable abstraction for interlocked, atomic
|
// Contents: Contains a portable abstraction for interlocked, atomic
|
||||||
// operations on int32_t and pointer types.
|
// operations on int32_t and pointer types.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: Contains a portable abstraction for interlocked, atomic
|
// Contents: Contains a portable abstraction for interlocked, atomic
|
||||||
// operations on int32_t and pointer types.
|
// operations on int32_t and pointer types.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: Contains a portable abstraction for interlocked, singly
|
// Contents: Contains a portable abstraction for interlocked, singly
|
||||||
// linked list.
|
// linked list.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains portable classes for localization
|
// Contents: Contains portable classes for localization
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// Must be included in one c/cpp file per binary
|
// Must be included in one c/cpp file per binary
|
||||||
// A build error will occur if this inclusion policy is not followed
|
// A build error will occur if this inclusion policy is not followed
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// pecuniary loss) arising out of the use of or inability to use
|
// pecuniary loss) arising out of the use of or inability to use
|
||||||
// this SDK, even if Microsoft has been advised of the possibility
|
// this SDK, even if Microsoft has been advised of the possibility
|
||||||
// of such damages.
|
// of such damages.
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------------------
|
||||||
// File: typedefs_for_linux.h
|
// File: typedefs_for_linux.h
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// File: version.h
|
// File: version.h
|
||||||
// Contents: Version number constants
|
// Contents: Version number constants
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
// Increase Minor with backward compatible new functionalities and API changes.
|
// Increase Minor with backward compatible new functionalities and API changes.
|
||||||
// Increase Patch for backward compatible fixes.
|
// Increase Patch for backward compatible fixes.
|
||||||
#define SQLVERSION_MAJOR 5
|
#define SQLVERSION_MAJOR 5
|
||||||
#define SQLVERSION_MINOR 10
|
#define SQLVERSION_MINOR 11
|
||||||
#define SQLVERSION_PATCH 1
|
#define SQLVERSION_PATCH 1
|
||||||
#define SQLVERSION_BUILD 0
|
#define SQLVERSION_BUILD 0
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD
|
#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD
|
||||||
|
|
||||||
// PECL package version ('-' or '+' is not allowed) - to support Pickle do not use macros below
|
// PECL package version ('-' or '+' is not allowed) - to support Pickle do not use macros below
|
||||||
#define PHP_SQLSRV_VERSION "5.10.1"
|
#define PHP_SQLSRV_VERSION "5.11.1"
|
||||||
#define PHP_PDO_SQLSRV_VERSION "5.10.1"
|
#define PHP_PDO_SQLSRV_VERSION "5.11.1"
|
||||||
|
|
||||||
#endif // VERSION_H
|
#endif // VERSION_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: include for definition of Windows types for non-Windows platforms
|
// Contents: include for definition of Windows types for non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Contents: This module defines helper functions to prevent
|
// Contents: This module defines helper functions to prevent
|
||||||
// integer overflow bugs.
|
// integer overflow bugs.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
// Contents: Contains the minimal definitions to build on non-Windows platforms
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -4,7 +4,7 @@ dnl
|
||||||
dnl Contents: the code that will go into the configure script, indicating options,
|
dnl Contents: the code that will go into the configure script, indicating options,
|
||||||
dnl external libraries and includes, and what source files are to be compiled.
|
dnl external libraries and includes, and what source files are to be compiled.
|
||||||
dnl
|
dnl
|
||||||
dnl Microsoft Drivers 5.10 for PHP for SQL Server
|
dnl Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
dnl Copyright(c) Microsoft Corporation
|
dnl Copyright(c) Microsoft Corporation
|
||||||
dnl All rights reserved.
|
dnl All rights reserved.
|
||||||
dnl MIT License
|
dnl MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: JScript build configuration used by buildconf.bat
|
// Contents: JScript build configuration used by buildconf.bat
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Routines that use connection handles
|
// Contents: Routines that use connection handles
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -117,7 +117,7 @@ struct conn_char_set_func {
|
||||||
if (!strnicmp( encoding, ss_encoding->iana, encoding_len )) {
|
if (!strnicmp( encoding, ss_encoding->iana, encoding_len )) {
|
||||||
|
|
||||||
if ( ss_encoding->not_for_connection ) {
|
if ( ss_encoding->not_for_connection ) {
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_CONNECT_ILLEGAL_ENCODING, encoding );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_CONNECT_ILLEGAL_ENCODING, encoding, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->set_encoding( static_cast<SQLSRV_ENCODING>(ss_encoding->code_page ));
|
conn->set_encoding( static_cast<SQLSRV_ENCODING>(ss_encoding->code_page ));
|
||||||
|
@ -125,7 +125,7 @@ struct conn_char_set_func {
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_CONNECT_ILLEGAL_ENCODING, encoding );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_CONNECT_ILLEGAL_ENCODING, encoding, NULL );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,7 +135,16 @@ struct bool_conn_str_func {
|
||||||
{
|
{
|
||||||
char temp_str[MAX_CONN_VALSTRING_LEN];
|
char temp_str[MAX_CONN_VALSTRING_LEN];
|
||||||
|
|
||||||
snprintf(temp_str, MAX_CONN_VALSTRING_LEN, "%s={%s};", option->odbc_name, (zend_is_true(value) ? "yes" : "no"));
|
if (Z_TYPE_P(value) != IS_STRING) {
|
||||||
|
convert_to_string(value);
|
||||||
|
}
|
||||||
|
const char *value_str = Z_STRVAL_P(value);
|
||||||
|
|
||||||
|
snprintf(temp_str,
|
||||||
|
MAX_CONN_VALSTRING_LEN,
|
||||||
|
"%s={%s};",
|
||||||
|
option->odbc_name,
|
||||||
|
((stricmp(value_str, "true") == 0 || stricmp(value_str, "1") == 0) ? "yes" : "no"));
|
||||||
conn_str += temp_str;
|
conn_str += temp_str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -665,7 +674,7 @@ PHP_FUNCTION ( sqlsrv_connect )
|
||||||
// get the server name and connection options
|
// get the server name and connection options
|
||||||
int result = zend_parse_parameters( ZEND_NUM_ARGS(), "s|a", &server, &server_len, &options_z );
|
int result = zend_parse_parameters( ZEND_NUM_ARGS(), "s|a", &server, &server_len, &options_z );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( result == FAILURE ), *g_ss_henv_cp, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, "sqlsrv_connect" ) {
|
CHECK_CUSTOM_ERROR(( result == FAILURE ), *g_ss_henv_cp, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, "sqlsrv_connect", NULL) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +819,7 @@ PHP_FUNCTION( sqlsrv_close )
|
||||||
|
|
||||||
// Check if it was a zval
|
// Check if it was a zval
|
||||||
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "z", &conn_r );
|
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "z", &conn_r );
|
||||||
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ , NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +828,7 @@ PHP_FUNCTION( sqlsrv_close )
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SQLSRV_ASSERT( conn_r != NULL, "sqlsrv_close: conn_r was null" );
|
SQLSRV_ASSERT( conn_r != NULL, "sqlsrv_close: conn_r was null" );
|
||||||
|
@ -830,7 +839,7 @@ PHP_FUNCTION( sqlsrv_close )
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( conn == NULL ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( conn == NULL ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1106,7 @@ PHP_FUNCTION( sqlsrv_prepare )
|
||||||
zval stmt_z;
|
zval stmt_z;
|
||||||
ZVAL_UNDEF(&stmt_z);
|
ZVAL_UNDEF(&stmt_z);
|
||||||
|
|
||||||
PROCESS_PARAMS( conn, "rs|a!a!", _FN_, 4, &sql, &sql_len, ¶ms_z, &options_z );
|
PROCESS_PARAMS( conn, "rs|a!a!", _FN_, 4, &sql, &sql_len, ¶ms_z, &options_z, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1113,11 +1122,11 @@ PHP_FUNCTION( sqlsrv_prepare )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( params_z && Z_TYPE_P( params_z ) != IS_ARRAY ) {
|
if( params_z && Z_TYPE_P( params_z ) != IS_ARRAY ) {
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( options_z && Z_TYPE_P( options_z ) != IS_ARRAY ) {
|
if( options_z && Z_TYPE_P( options_z ) != IS_ARRAY ) {
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sql == NULL ) {
|
if( sql == NULL ) {
|
||||||
|
@ -1219,7 +1228,7 @@ PHP_FUNCTION( sqlsrv_query )
|
||||||
zval stmt_z;
|
zval stmt_z;
|
||||||
ZVAL_UNDEF(&stmt_z);
|
ZVAL_UNDEF(&stmt_z);
|
||||||
|
|
||||||
PROCESS_PARAMS( conn, "rs|a!a!", _FN_, 4, &sql, &sql_len, ¶ms_z, &options_z );
|
PROCESS_PARAMS( conn, "rs|a!a!", _FN_, 4, &sql, &sql_len, ¶ms_z, &options_z, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1235,11 +1244,11 @@ PHP_FUNCTION( sqlsrv_query )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( params_z && Z_TYPE_P( params_z ) != IS_ARRAY ) {
|
if( params_z && Z_TYPE_P( params_z ) != IS_ARRAY ) {
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( options_z && Z_TYPE_P( options_z ) != IS_ARRAY ) {
|
if( options_z && Z_TYPE_P( options_z ) != IS_ARRAY ) {
|
||||||
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( conn, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sql == NULL ) {
|
if( sql == NULL ) {
|
||||||
|
@ -1388,7 +1397,7 @@ int get_conn_option_key( _Inout_ sqlsrv_context& ctx, _In_ zend_string* key, _In
|
||||||
case CONN_ATTR_INT:
|
case CONN_ATTR_INT:
|
||||||
{
|
{
|
||||||
CHECK_CUSTOM_ERROR( (Z_TYPE_P( value_z ) != IS_LONG ), ctx, SQLSRV_ERROR_INVALID_OPTION_TYPE_INT,
|
CHECK_CUSTOM_ERROR( (Z_TYPE_P( value_z ) != IS_LONG ), ctx, SQLSRV_ERROR_INVALID_OPTION_TYPE_INT,
|
||||||
SS_CONN_OPTS[i].sqlsrv_name )
|
SS_CONN_OPTS[i].sqlsrv_name, NULL)
|
||||||
{
|
{
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1397,7 +1406,7 @@ int get_conn_option_key( _Inout_ sqlsrv_context& ctx, _In_ zend_string* key, _In
|
||||||
case CONN_ATTR_STRING:
|
case CONN_ATTR_STRING:
|
||||||
{
|
{
|
||||||
CHECK_CUSTOM_ERROR( Z_TYPE_P( value_z ) != IS_STRING, ctx, SQLSRV_ERROR_INVALID_OPTION_TYPE_STRING,
|
CHECK_CUSTOM_ERROR( Z_TYPE_P( value_z ) != IS_STRING, ctx, SQLSRV_ERROR_INVALID_OPTION_TYPE_STRING,
|
||||||
SS_CONN_OPTS[i].sqlsrv_name ) {
|
SS_CONN_OPTS[i].sqlsrv_name, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1406,7 +1415,7 @@ int get_conn_option_key( _Inout_ sqlsrv_context& ctx, _In_ zend_string* key, _In
|
||||||
size_t value_len = Z_STRLEN_P( value_z );
|
size_t value_len = Z_STRLEN_P( value_z );
|
||||||
bool escaped = core_is_conn_opt_value_escaped( value, value_len );
|
bool escaped = core_is_conn_opt_value_escaped( value, value_len );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( !escaped, ctx, SS_SQLSRV_ERROR_CONNECT_BRACES_NOT_ESCAPED, SS_CONN_OPTS[i].sqlsrv_name ) {
|
CHECK_CUSTOM_ERROR( !escaped, ctx, SS_SQLSRV_ERROR_CONNECT_BRACES_NOT_ESCAPED, SS_CONN_OPTS[i].sqlsrv_name, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1449,7 @@ void add_stmt_option_key( _Inout_ sqlsrv_context& ctx, _In_ zend_string* key, _I
|
||||||
{
|
{
|
||||||
int option_key = ::get_stmt_option_key( key, key_len );
|
int option_key = ::get_stmt_option_key( key, key_len );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR((option_key == SQLSRV_STMT_OPTION_INVALID ), ctx, SQLSRV_ERROR_INVALID_OPTION_KEY, ZSTR_VAL( key ) ) {
|
CHECK_CUSTOM_ERROR((option_key == SQLSRV_STMT_OPTION_INVALID ), ctx, SQLSRV_ERROR_INVALID_OPTION_KEY, ZSTR_VAL( key ), NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1453,7 +1462,7 @@ void add_conn_option_key( _Inout_ sqlsrv_context& ctx, _In_ zend_string* key, _I
|
||||||
_Inout_ HashTable* options_ht, _Inout_ zval* data )
|
_Inout_ HashTable* options_ht, _Inout_ zval* data )
|
||||||
{
|
{
|
||||||
int option_key = ::get_conn_option_key( ctx, key, key_len, data );
|
int option_key = ::get_conn_option_key( ctx, key, key_len, data );
|
||||||
CHECK_CUSTOM_ERROR((option_key == SQLSRV_STMT_OPTION_INVALID ), ctx, SS_SQLSRV_ERROR_INVALID_OPTION, ZSTR_VAL( key ) ) {
|
CHECK_CUSTOM_ERROR((option_key == SQLSRV_STMT_OPTION_INVALID ), ctx, SS_SQLSRV_ERROR_INVALID_OPTION, ZSTR_VAL( key ), NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1491,7 @@ void validate_stmt_options( _Inout_ sqlsrv_context& ctx, _Inout_ zval* stmt_opti
|
||||||
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
||||||
|
|
||||||
if (type != HASH_KEY_IS_STRING) {
|
if (type != HASH_KEY_IS_STRING) {
|
||||||
CHECK_CUSTOM_ERROR(true, ctx, SQLSRV_ERROR_INVALID_OPTION_KEY, std::to_string( int_key ).c_str() ) {
|
CHECK_CUSTOM_ERROR(true, ctx, SQLSRV_ERROR_INVALID_OPTION_KEY, std::to_string( int_key ).c_str(), NULL) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1520,7 +1529,7 @@ void validate_conn_options( _Inout_ sqlsrv_context& ctx, _In_ zval* user_options
|
||||||
int type = HASH_KEY_NON_EXISTENT;
|
int type = HASH_KEY_NON_EXISTENT;
|
||||||
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
type = key ? HASH_KEY_IS_STRING : HASH_KEY_IS_LONG;
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( Z_TYPE_P( data ) == IS_NULL || Z_TYPE_P( data ) == IS_UNDEF ), ctx, SS_SQLSRV_ERROR_INVALID_OPTION, key) {
|
CHECK_CUSTOM_ERROR(( Z_TYPE_P( data ) == IS_NULL || Z_TYPE_P( data ) == IS_UNDEF ), ctx, SS_SQLSRV_ERROR_INVALID_OPTION, key, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// File: init.cpp
|
// File: init.cpp
|
||||||
// Contents: initialization routines for the extension
|
// Contents: initialization routines for the extension
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//
|
//
|
||||||
// Comments: Also contains "internal" declarations shared across source files.
|
// Comments: Also contains "internal" declarations shared across source files.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//
|
//
|
||||||
// Comments: Also contains "internal" declarations shared across source files.
|
// Comments: Also contains "internal" declarations shared across source files.
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -342,7 +342,7 @@ namespace ss {
|
||||||
{
|
{
|
||||||
int zr = (NULL != (Z_RES(rsrc_result) = ::zend_register_resource(rsrc_pointer, rsrc_type)) ? SUCCESS : FAILURE);
|
int zr = (NULL != (Z_RES(rsrc_result) = ::zend_register_resource(rsrc_pointer, rsrc_type)) ? SUCCESS : FAILURE);
|
||||||
CHECK_CUSTOM_ERROR(( zr == FAILURE ), reinterpret_cast<sqlsrv_context*>( rsrc_pointer ), SS_SQLSRV_ERROR_REGISTER_RESOURCE,
|
CHECK_CUSTOM_ERROR(( zr == FAILURE ), reinterpret_cast<sqlsrv_context*>( rsrc_pointer ), SS_SQLSRV_ERROR_REGISTER_RESOURCE,
|
||||||
rsrc_name ) {
|
rsrc_name, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
Z_TYPE_INFO(rsrc_result) = IS_RESOURCE_EX;
|
Z_TYPE_INFO(rsrc_result) = IS_RESOURCE_EX;
|
||||||
|
@ -433,12 +433,12 @@ inline H* process_params( INTERNAL_FUNCTION_PARAMETERS, _In_ char const* param_s
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func, NULL );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( result == FAILURE ), &error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func ) {
|
CHECK_CUSTOM_ERROR(( result == FAILURE ), &error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ inline H* process_params( INTERNAL_FUNCTION_PARAMETERS, _In_ char const* param_s
|
||||||
// get the resource registered
|
// get the resource registered
|
||||||
h = static_cast<H*>( zend_fetch_resource(Z_RES_P(rsrc), H::resource_name, H::descriptor ));
|
h = static_cast<H*>( zend_fetch_resource(Z_RES_P(rsrc), H::resource_name, H::descriptor ));
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( h == NULL ), &error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func ) {
|
CHECK_CUSTOM_ERROR(( h == NULL ), &error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, calling_func, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Routines that use statement handles
|
// Contents: Routines that use statement handles
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -341,7 +341,7 @@ PHP_FUNCTION( sqlsrv_fetch )
|
||||||
zend_long fetch_offset = 0; // default value for parameter if one isn't supplied
|
zend_long fetch_offset = 0; // default value for parameter if one isn't supplied
|
||||||
|
|
||||||
// take only the statement resource
|
// take only the statement resource
|
||||||
PROCESS_PARAMS( stmt, "r|ll", _FN_, 2, &fetch_style, &fetch_offset );
|
PROCESS_PARAMS( stmt, "r|ll", _FN_, 2, &fetch_style, &fetch_offset, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ PHP_FUNCTION( sqlsrv_fetch_array )
|
||||||
|
|
||||||
// retrieve the statement resource and optional fetch type (see enum SQLSRV_FETCH_TYPE),
|
// retrieve the statement resource and optional fetch type (see enum SQLSRV_FETCH_TYPE),
|
||||||
// fetch style (see SQLSRV_SCROLL_* constants) and fetch offset
|
// fetch style (see SQLSRV_SCROLL_* constants) and fetch offset
|
||||||
PROCESS_PARAMS( stmt, "r|lll", _FN_, 3, &fetch_type, &fetch_style, &fetch_offset );
|
PROCESS_PARAMS( stmt, "r|lll", _FN_, 3, &fetch_type, &fetch_style, &fetch_offset, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
// fetch style (see SQLSRV_SCROLL_* constants) and fetch offset
|
// fetch style (see SQLSRV_SCROLL_* constants) and fetch offset
|
||||||
// we also use z! instead of s and a so that null may be passed in as valid values for
|
// we also use z! instead of s and a so that null may be passed in as valid values for
|
||||||
// the class name and ctor params
|
// the class name and ctor params
|
||||||
PROCESS_PARAMS( stmt, "r|z!z!ll", _FN_, 4, &class_name_z, &ctor_params_z, &fetch_style, &fetch_offset );
|
PROCESS_PARAMS( stmt, "r|z!z!ll", _FN_, 4, &class_name_z, &ctor_params_z, &fetch_style, &fetch_offset, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
|
|
||||||
if( class_name_z ) {
|
if( class_name_z ) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( Z_TYPE_P( class_name_z ) != IS_STRING ), stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( Z_TYPE_P( class_name_z ) != IS_STRING ), stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
class_name = Z_STRVAL( *class_name_z );
|
class_name = Z_STRVAL( *class_name_z );
|
||||||
|
@ -805,7 +805,7 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ctor_params_z && Z_TYPE_P( ctor_params_z ) != IS_ARRAY ) {
|
if( ctor_params_z && Z_TYPE_P( ctor_params_z ) != IS_ARRAY ) {
|
||||||
THROW_SS_ERROR( stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch the data
|
// fetch the data
|
||||||
|
@ -822,14 +822,14 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
zend_string* class_name_str_z = zend_string_init( class_name, class_name_len, 0 );
|
zend_string* class_name_str_z = zend_string_init( class_name, class_name_len, 0 );
|
||||||
int zr = ( NULL != ( class_entry = zend_lookup_class( class_name_str_z ))) ? SUCCESS : FAILURE;
|
int zr = ( NULL != ( class_entry = zend_lookup_class( class_name_str_z ))) ? SUCCESS : FAILURE;
|
||||||
zend_string_release( class_name_str_z );
|
zend_string_release( class_name_str_z );
|
||||||
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_BAD_CLASS, class_name ) {
|
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_BAD_CLASS, class_name, NULL ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// create an instance of the object with its default properties
|
// create an instance of the object with its default properties
|
||||||
// we pass NULL for the properties so that the object will be populated by its default properties
|
// we pass NULL for the properties so that the object will be populated by its default properties
|
||||||
zr = object_and_properties_init( &retval_z, class_entry, NULL /*properties*/ );
|
zr = object_and_properties_init( &retval_z, class_entry, NULL /*properties*/ );
|
||||||
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name ) {
|
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name, NULL ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -872,7 +872,7 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
zval* value_z = NULL;
|
zval* value_z = NULL;
|
||||||
ZEND_HASH_FOREACH_VAL( ctor_params_ht, value_z ) {
|
ZEND_HASH_FOREACH_VAL( ctor_params_ht, value_z ) {
|
||||||
zr = ( value_z ) ? SUCCESS : FAILURE;
|
zr = ( value_z ) ? SUCCESS : FAILURE;
|
||||||
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name ) {
|
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name, NULL ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
ZVAL_COPY_VALUE(¶ms_m[i], value_z);
|
ZVAL_COPY_VALUE(¶ms_m[i], value_z);
|
||||||
|
@ -906,7 +906,7 @@ PHP_FUNCTION( sqlsrv_fetch_object )
|
||||||
fcic.object = Z_OBJ_P( &retval_z );
|
fcic.object = Z_OBJ_P( &retval_z );
|
||||||
|
|
||||||
zr = zend_call_function( &fci, &fcic );
|
zr = zend_call_function( &fci, &fcic );
|
||||||
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name ) {
|
CHECK_ZEND_ERROR( zr, stmt, SS_SQLSRV_ERROR_ZEND_OBJECT_FAILED, class_name, NULL ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,7 +1083,7 @@ PHP_FUNCTION( sqlsrv_get_field )
|
||||||
ZVAL_UNDEF(&retval_z);
|
ZVAL_UNDEF(&retval_z);
|
||||||
|
|
||||||
// get the statement, the field index and the optional type
|
// get the statement, the field index and the optional type
|
||||||
PROCESS_PARAMS( stmt, "rl|l", _FN_, 2, &field_index, &sqlsrv_php_type );
|
PROCESS_PARAMS( stmt, "rl|l", _FN_, 2, &field_index, &sqlsrv_php_type, NULL );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1091,7 +1091,7 @@ PHP_FUNCTION( sqlsrv_get_field )
|
||||||
SQLSMALLINT num_cols = get_resultset_meta_data(stmt);
|
SQLSMALLINT num_cols = get_resultset_meta_data(stmt);
|
||||||
|
|
||||||
if( field_index < 0 || field_index >= num_cols ) {
|
if( field_index < 0 || field_index >= num_cols ) {
|
||||||
THROW_SS_ERROR( stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_SS_ERROR( stmt, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
core_sqlsrv_get_field( stmt, static_cast<SQLUSMALLINT>( field_index ), sqlsrv_php_type, false, field_value, &field_len, false/*cache_field*/,
|
core_sqlsrv_get_field( stmt, static_cast<SQLUSMALLINT>( field_index ), sqlsrv_php_type, false, field_value, &field_len, false/*cache_field*/,
|
||||||
|
@ -1227,7 +1227,7 @@ void bind_params( _Inout_ ss_sqlsrv_stmt* stmt )
|
||||||
// Simply get the first variable and use the defaults
|
// Simply get the first variable and use the defaults
|
||||||
value_z = zend_hash_index_find(param_ht, 0);
|
value_z = zend_hash_index_find(param_ht, 0);
|
||||||
if (value_z == NULL) {
|
if (value_z == NULL) {
|
||||||
THROW_SS_ERROR(stmt, SS_SQLSRV_ERROR_VAR_REQUIRED, index + 1);
|
THROW_SS_ERROR(stmt, SS_SQLSRV_ERROR_VAR_REQUIRED, index + 1, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (core::CoreException&) {
|
} catch (core::CoreException&) {
|
||||||
|
@ -1300,7 +1300,7 @@ PHP_FUNCTION( sqlsrv_cancel )
|
||||||
close_active_stream( stmt );
|
close_active_stream( stmt );
|
||||||
|
|
||||||
SQLRETURN r = SQLCancel( stmt->handle() );
|
SQLRETURN r = SQLCancel( stmt->handle() );
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt, NULL ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ PHP_FUNCTION( sqlsrv_free_stmt )
|
||||||
|
|
||||||
// Check if it was a zval
|
// Check if it was a zval
|
||||||
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "z", &stmt_r );
|
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "z", &stmt_r );
|
||||||
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -1386,7 +1386,7 @@ PHP_FUNCTION( sqlsrv_free_stmt )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1402,7 +1402,7 @@ PHP_FUNCTION( sqlsrv_free_stmt )
|
||||||
|
|
||||||
if( stmt == NULL ) {
|
if( stmt == NULL ) {
|
||||||
|
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the resource from Zend's master list, which will trigger the statement's destructor
|
// delete the resource from Zend's master list, which will trigger the statement's destructor
|
||||||
|
@ -1774,7 +1774,7 @@ void determine_stmt_has_rows( _Inout_ ss_sqlsrv_stmt* stmt )
|
||||||
if( SQL_SUCCEEDED( r )) {
|
if( SQL_SUCCEEDED( r )) {
|
||||||
|
|
||||||
stmt->has_rows = true;
|
stmt->has_rows = true;
|
||||||
CHECK_SQL_WARNING( r, stmt );
|
CHECK_SQL_WARNING( r, stmt, NULL );
|
||||||
// restore the cursor to its original position.
|
// restore the cursor to its original position.
|
||||||
r = stmt->current_results->fetch( SQL_FETCH_ABSOLUTE, 0 );
|
r = stmt->current_results->fetch( SQL_FETCH_ABSOLUTE, 0 );
|
||||||
SQLSRV_ASSERT(( r == SQL_NO_DATA ), "core_sqlsrv_has_rows: Should have scrolled the cursor to the beginning "
|
SQLSRV_ASSERT(( r == SQL_NO_DATA ), "core_sqlsrv_has_rows: Should have scrolled the cursor to the beginning "
|
||||||
|
@ -1791,7 +1791,7 @@ void determine_stmt_has_rows( _Inout_ ss_sqlsrv_stmt* stmt )
|
||||||
if( SQL_SUCCEEDED( r )) {
|
if( SQL_SUCCEEDED( r )) {
|
||||||
|
|
||||||
stmt->has_rows = true;
|
stmt->has_rows = true;
|
||||||
CHECK_SQL_WARNING( r, stmt );
|
CHECK_SQL_WARNING( r, stmt, NULL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1841,7 +1841,7 @@ void fetch_fields_common( _Inout_ ss_sqlsrv_stmt* stmt, _In_ zend_long fetch_typ
|
||||||
SQLSRV_PHPTYPE sqlsrv_php_type_out = SQLSRV_PHPTYPE_INVALID;
|
SQLSRV_PHPTYPE sqlsrv_php_type_out = SQLSRV_PHPTYPE_INVALID;
|
||||||
|
|
||||||
// make sure that the fetch type is legal
|
// make sure that the fetch type is legal
|
||||||
CHECK_CUSTOM_ERROR((fetch_type < MIN_SQLSRV_FETCH || fetch_type > MAX_SQLSRV_FETCH), stmt, SS_SQLSRV_ERROR_INVALID_FETCH_TYPE, stmt->func()) {
|
CHECK_CUSTOM_ERROR((fetch_type < MIN_SQLSRV_FETCH || fetch_type > MAX_SQLSRV_FETCH), stmt, SS_SQLSRV_ERROR_INVALID_FETCH_TYPE, stmt->func(), NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,7 +1893,7 @@ void fetch_fields_common( _Inout_ ss_sqlsrv_stmt* stmt, _In_ zend_long fetch_typ
|
||||||
if( fetch_type & SQLSRV_FETCH_ASSOC ) {
|
if( fetch_type & SQLSRV_FETCH_ASSOC ) {
|
||||||
|
|
||||||
CHECK_CUSTOM_WARNING_AS_ERROR(( stmt->fetch_field_names[i].len == 0 && !allow_empty_field_names ), stmt,
|
CHECK_CUSTOM_WARNING_AS_ERROR(( stmt->fetch_field_names[i].len == 0 && !allow_empty_field_names ), stmt,
|
||||||
SS_SQLSRV_WARNING_FIELD_NAME_EMPTY) {
|
SS_SQLSRV_WARNING_FIELD_NAME_EMPTY, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1922,18 +1922,19 @@ zval* parse_param_array(_Inout_ ss_sqlsrv_stmt* stmt, _Inout_ HashTable* param_h
|
||||||
|
|
||||||
// Assumption: there are more than only the variable, parse the rest of the array
|
// Assumption: there are more than only the variable, parse the rest of the array
|
||||||
zval* dir = zend_hash_index_find(param_ht, 1);
|
zval* dir = zend_hash_index_find(param_ht, 1);
|
||||||
|
if(!dir) { throw ss::SSException(); }
|
||||||
if (Z_TYPE_P(dir) != IS_NULL) {
|
if (Z_TYPE_P(dir) != IS_NULL) {
|
||||||
// if param direction is specified, make sure it's valid
|
// if param direction is specified, make sure it's valid
|
||||||
CHECK_CUSTOM_ERROR(Z_TYPE_P(dir) != IS_LONG, stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_DIRECTION, index + 1) {
|
CHECK_CUSTOM_ERROR(Z_TYPE_P(dir) != IS_LONG, stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_DIRECTION, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
direction = static_cast<SQLSMALLINT>(Z_LVAL_P(dir));
|
direction = static_cast<SQLSMALLINT>(Z_LVAL_P(dir));
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(direction != SQL_PARAM_INPUT && direction != SQL_PARAM_OUTPUT && direction != SQL_PARAM_INPUT_OUTPUT,
|
CHECK_CUSTOM_ERROR(direction != SQL_PARAM_INPUT && direction != SQL_PARAM_OUTPUT && direction != SQL_PARAM_INPUT_OUTPUT,
|
||||||
stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_DIRECTION, index + 1) {
|
stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_DIRECTION, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
CHECK_CUSTOM_ERROR(direction != SQL_PARAM_INPUT && !Z_ISREF_P(var_or_val), stmt, SS_SQLSRV_ERROR_PARAM_VAR_NOT_REF, index + 1) {
|
CHECK_CUSTOM_ERROR(direction != SQL_PARAM_INPUT && !Z_ISREF_P(var_or_val), stmt, SS_SQLSRV_ERROR_PARAM_VAR_NOT_REF, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1953,13 +1954,13 @@ zval* parse_param_array(_Inout_ ss_sqlsrv_stmt* stmt, _Inout_ HashTable* param_h
|
||||||
php_out_type = zend_to_sqlsrv_phptype[Z_TYPE_P(var_or_val)];
|
php_out_type = zend_to_sqlsrv_phptype[Z_TYPE_P(var_or_val)];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CHECK_CUSTOM_ERROR(Z_TYPE_P(phptype_z) != IS_LONG, stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, index + 1) {
|
CHECK_CUSTOM_ERROR(Z_TYPE_P(phptype_z) != IS_LONG, stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlsrv_phptype srv_phptype;
|
sqlsrv_phptype srv_phptype;
|
||||||
srv_phptype.value = Z_LVAL_P(phptype_z);
|
srv_phptype.value = Z_LVAL_P(phptype_z);
|
||||||
CHECK_CUSTOM_ERROR(!is_valid_sqlsrv_phptype(srv_phptype), stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, index + 1) {
|
CHECK_CUSTOM_ERROR(!is_valid_sqlsrv_phptype(srv_phptype), stmt, SQLSRV_ERROR_INVALID_PARAMETER_PHPTYPE, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1978,19 +1979,19 @@ zval* parse_param_array(_Inout_ ss_sqlsrv_stmt* stmt, _Inout_ HashTable* param_h
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CHECK_CUSTOM_ERROR(Z_TYPE_P(sqltype_z) != IS_LONG, stmt, SQLSRV_ERROR_INVALID_PARAMETER_SQLTYPE, index + 1) {
|
CHECK_CUSTOM_ERROR(Z_TYPE_P(sqltype_z) != IS_LONG, stmt, SQLSRV_ERROR_INVALID_PARAMETER_SQLTYPE, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// since the user supplied this type, make sure it's valid
|
// since the user supplied this type, make sure it's valid
|
||||||
sqlsrv_sqltype sqlsrv_sql_type;
|
sqlsrv_sqltype sqlsrv_sql_type;
|
||||||
sqlsrv_sql_type.value = Z_LVAL_P(sqltype_z);
|
sqlsrv_sql_type.value = Z_LVAL_P(sqltype_z);
|
||||||
CHECK_CUSTOM_ERROR(!is_valid_sqlsrv_sqltype(sqlsrv_sql_type), stmt, SQLSRV_ERROR_INVALID_PARAMETER_SQLTYPE, index + 1) {
|
CHECK_CUSTOM_ERROR(!is_valid_sqlsrv_sqltype(sqlsrv_sql_type), stmt, SQLSRV_ERROR_INVALID_PARAMETER_SQLTYPE, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool size_okay = determine_column_size_or_precision(stmt, sqlsrv_sql_type, &column_size, &decimal_digits);
|
bool size_okay = determine_column_size_or_precision(stmt, sqlsrv_sql_type, &column_size, &decimal_digits);
|
||||||
CHECK_CUSTOM_ERROR(!size_okay, stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_PRECISION, index + 1) {
|
CHECK_CUSTOM_ERROR(!size_okay, stmt, SS_SQLSRV_ERROR_INVALID_PARAMETER_PRECISION, index + 1, NULL) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// Contents: Version resource
|
// Contents: Version resource
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//
|
//
|
||||||
// Comments: Mostly error handling and some type handling
|
// Comments: Mostly error handling and some type handling
|
||||||
//
|
//
|
||||||
// Microsoft Drivers 5.10 for PHP for SQL Server
|
// Microsoft Drivers 5.11 for PHP for SQL Server
|
||||||
// Copyright(c) Microsoft Corporation
|
// Copyright(c) Microsoft Corporation
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
// MIT License
|
// MIT License
|
||||||
|
@ -605,7 +605,7 @@ PHP_FUNCTION( sqlsrv_configure )
|
||||||
error_ctx->set_func(_FN_);
|
error_ctx->set_func(_FN_);
|
||||||
|
|
||||||
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "sz", &option, &option_len, &value_z );
|
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "sz", &option, &option_len, &value_z );
|
||||||
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,7 @@ PHP_FUNCTION( sqlsrv_configure )
|
||||||
// LogSeverity
|
// LogSeverity
|
||||||
else if( !stricmp( option, INI_LOG_SEVERITY )) {
|
else if( !stricmp( option, INI_LOG_SEVERITY )) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -641,7 +641,7 @@ PHP_FUNCTION( sqlsrv_configure )
|
||||||
// LogSubsystems
|
// LogSubsystems
|
||||||
else if( !stricmp( option, INI_LOG_SUBSYSTEMS )) {
|
else if( !stricmp( option, INI_LOG_SUBSYSTEMS )) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -659,14 +659,14 @@ PHP_FUNCTION( sqlsrv_configure )
|
||||||
|
|
||||||
else if( !stricmp( option, INI_BUFFERED_QUERY_LIMIT )) {
|
else if( !stricmp( option, INI_BUFFERED_QUERY_LIMIT )) {
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( Z_TYPE_P( value_z ) != IS_LONG ), error_ctx, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_long buffered_query_limit = Z_LVAL_P( value_z );
|
zend_long buffered_query_limit = Z_LVAL_P( value_z );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( buffered_query_limit <= 0, error_ctx, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, _FN_ ) {
|
CHECK_CUSTOM_ERROR( buffered_query_limit <= 0, error_ctx, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, _FN_, NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ PHP_FUNCTION( sqlsrv_configure )
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( core::CoreException& ) {
|
catch( core::CoreException& ) {
|
||||||
|
@ -725,7 +725,7 @@ PHP_FUNCTION( sqlsrv_get_config )
|
||||||
error_ctx->set_func(_FN_);
|
error_ctx->set_func(_FN_);
|
||||||
|
|
||||||
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "s", &option, &option_len );
|
int zr = zend_parse_parameters( ZEND_NUM_ARGS(), "s", &option, &option_len );
|
||||||
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ ) {
|
CHECK_CUSTOM_ERROR(( zr == FAILURE ), error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ , NULL) {
|
||||||
|
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ PHP_FUNCTION( sqlsrv_get_config )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_ );
|
THROW_CORE_ERROR( error_ctx, SS_SQLSRV_ERROR_INVALID_FUNCTION_PARAMETER, _FN_, NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( core::CoreException& ) {
|
catch( core::CoreException& ) {
|
||||||
|
|
|
@ -8,9 +8,13 @@ fetch with all fetch styles
|
||||||
$conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd");
|
$conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd");
|
||||||
|
|
||||||
print( "\n---------- PDO::FETCH_CLASS -------------\n" );
|
print( "\n---------- PDO::FETCH_CLASS -------------\n" );
|
||||||
$stmt = $conn->query( "select * from HumanResources.Department order by GroupName" );
|
$stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" );
|
||||||
|
|
||||||
class cc {
|
class cc {
|
||||||
|
public $DepartmentID;
|
||||||
|
public $Name;
|
||||||
|
public $GroupName;
|
||||||
|
|
||||||
function __construct( $arg ) {
|
function __construct( $arg ) {
|
||||||
echo "$arg";
|
echo "$arg";
|
||||||
}
|
}
|
||||||
|
@ -26,7 +30,7 @@ fetch with all fetch styles
|
||||||
}
|
}
|
||||||
|
|
||||||
print( "\n---------- PDO::FETCH_INTO -------------\n" );
|
print( "\n---------- PDO::FETCH_INTO -------------\n" );
|
||||||
$stmt = $conn->query( "select * from HumanResources.Department order by GroupName" );
|
$stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" );
|
||||||
$c_obj = new cc( '' );
|
$c_obj = new cc( '' );
|
||||||
|
|
||||||
$stmt->setFetchMode(PDO::FETCH_INTO, $c_obj);
|
$stmt->setFetchMode(PDO::FETCH_INTO, $c_obj);
|
||||||
|
|
|
@ -25,6 +25,10 @@ fetches the rows in a result set in an array
|
||||||
print "\n-----------\n";
|
print "\n-----------\n";
|
||||||
|
|
||||||
class cc {
|
class cc {
|
||||||
|
public $ContactTypeID;
|
||||||
|
public $Name;
|
||||||
|
public $ModifiedDate;
|
||||||
|
|
||||||
function __construct( $arg ) {
|
function __construct( $arg ) {
|
||||||
echo "$arg\n";
|
echo "$arg\n";
|
||||||
}
|
}
|
||||||
|
@ -34,7 +38,7 @@ fetches the rows in a result set in an array
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$stmt = $conn->query( 'SELECT TOP(2) * FROM Person.ContactType' );
|
$stmt = $conn->query( 'SELECT TOP(2) ContactTypeID, Name, ModifiedDate FROM Person.ContactType' );
|
||||||
$all = $stmt->fetchAll( PDO::FETCH_CLASS, 'cc', array( 'Hi!' ));
|
$all = $stmt->fetchAll( PDO::FETCH_CLASS, 'cc', array( 'Hi!' ));
|
||||||
var_dump( $all );
|
var_dump( $all );
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,13 @@ while ( $row = $stmt->fetch() ){
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n........ query with a new class ............\n";
|
echo "\n........ query with a new class ............\n";
|
||||||
$query = 'select * from HumanResources.Department order by GroupName';
|
$query = 'select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName';
|
||||||
// query with a class
|
// query with a class
|
||||||
class cc {
|
class cc {
|
||||||
|
public $DepartmentID;
|
||||||
|
public $Name;
|
||||||
|
public $GroupName;
|
||||||
|
|
||||||
function __construct( $arg ) {
|
function __construct( $arg ) {
|
||||||
echo "$arg";
|
echo "$arg";
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ $tsql1 = "UPDATE Production.ProductReview
|
||||||
//
|
//
|
||||||
$reviewID = 3;
|
$reviewID = 3;
|
||||||
|
|
||||||
$comments = utf8_encode("testing 1, 2, 3, 4. Testing.");
|
$comments = mb_convert_encoding("testing 1, 2, 3, 4. Testing.", 'ISO-8859-1', 'UTF-8');
|
||||||
$params1 = array(
|
$params1 = array(
|
||||||
array( $comments, null ),
|
array( $comments, null ),
|
||||||
array( $reviewID, null )
|
array( $reviewID, null )
|
||||||
|
|
|
@ -7,6 +7,8 @@ retrieves each row of a result set as an instance of the Product class defined i
|
||||||
/* Define the Product class. */
|
/* Define the Product class. */
|
||||||
class Product
|
class Product
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
public function ProductConstruct($ID)
|
public function ProductConstruct($ID)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +19,8 @@ class Product
|
||||||
public $StockedQty;
|
public $StockedQty;
|
||||||
public $SafetyStockLevel;
|
public $SafetyStockLevel;
|
||||||
private $UnitPrice;
|
private $UnitPrice;
|
||||||
|
public $Name;
|
||||||
|
public $Color;
|
||||||
function getPrice()
|
function getPrice()
|
||||||
{
|
{
|
||||||
return $this->UnitPrice;
|
return $this->UnitPrice;
|
||||||
|
|
|
@ -27,7 +27,7 @@ $tsql1 = "UPDATE Production.ProductReview
|
||||||
// utf8_encode to simulate an application that uses UTF-8 encoded data.
|
// utf8_encode to simulate an application that uses UTF-8 encoded data.
|
||||||
//
|
//
|
||||||
$reviewID = 3;
|
$reviewID = 3;
|
||||||
$comments = utf8_encode("testing");
|
$comments = mb_convert_encoding("testing", 'ISO-8859-1', 'UTF-8');
|
||||||
$params1 = array(
|
$params1 = array(
|
||||||
array($comments,
|
array($comments,
|
||||||
SQLSRV_PARAM_IN,
|
SQLSRV_PARAM_IN,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
Common functions (shared by all tests).
|
Common functions (shared by all tests).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
error_reporting( ~E_DEPRECATED );
|
||||||
$tvpIncPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR;
|
$tvpIncPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
require_once($tvpIncPath. 'test_tvp_data.php');
|
require_once($tvpIncPath. 'test_tvp_data.php');
|
||||||
|
|
|
@ -59,6 +59,7 @@ function ExecStmt()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test
|
class Test
|
||||||
{
|
{
|
||||||
function __construct($name = 'N/A')
|
function __construct($name = 'N/A')
|
||||||
|
|
|
@ -48,6 +48,7 @@ function FetchMode()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test
|
class Test
|
||||||
{
|
{
|
||||||
function __construct($name = 'N/A')
|
function __construct($name = 'N/A')
|
||||||
|
|
|
@ -72,6 +72,7 @@ function FetchAll()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test1
|
class Test1
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -80,6 +81,7 @@ class Test1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test2
|
class Test2
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -88,6 +90,7 @@ class Test2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test3
|
class Test3
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
@ -64,6 +64,7 @@ function FetchAll()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class DerivedStatement extends PDOStatement
|
class DerivedStatement extends PDOStatement
|
||||||
{
|
{
|
||||||
private function __construct($name, $conn)
|
private function __construct($name, $conn)
|
||||||
|
@ -78,6 +79,7 @@ class DerivedStatement extends PDOStatement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Test1
|
class Test1
|
||||||
{
|
{
|
||||||
public function __construct($id, $val)
|
public function __construct($id, $val)
|
||||||
|
|
|
@ -10,6 +10,7 @@ PHPT_EXEC=true
|
||||||
<?php
|
<?php
|
||||||
include 'MsCommon.inc';
|
include 'MsCommon.inc';
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class TestClass
|
class TestClass
|
||||||
{
|
{
|
||||||
private $set_calls = 0;
|
private $set_calls = 0;
|
||||||
|
|
|
@ -48,6 +48,7 @@ function Extend()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class ExPDO extends PDO
|
class ExPDO extends PDO
|
||||||
{
|
{
|
||||||
public $test1 = 1;
|
public $test1 = 1;
|
||||||
|
@ -74,6 +75,7 @@ class ExPDO extends PDO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class ExPDOStatement extends PDOStatement
|
class ExPDOStatement extends PDOStatement
|
||||||
{
|
{
|
||||||
protected function __construct()
|
protected function __construct()
|
||||||
|
|
|
@ -46,27 +46,31 @@ function Extend()
|
||||||
EndTest($testName);
|
EndTest($testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class ExPDO extends PDO
|
class ExPDO extends PDO
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->protocol();
|
$this->protocol();
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return (call_user_func_array(array($this, 'parent::__construct'), $args));
|
$callable = parent::class . '::__construct';
|
||||||
|
return (call_user_func_array($callable, $args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exec(string $args1) : int|false
|
public function exec(string $args1) : int|false
|
||||||
{
|
{
|
||||||
$this->protocol();
|
$this->protocol();
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return (call_user_func_array(array($this, 'parent::exec'), $args));
|
$callable = parent::class . '::exec';
|
||||||
|
return (call_user_func_array($callable, $args));
|
||||||
}
|
}
|
||||||
|
|
||||||
function query(string $sql, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false
|
function query(string $sql, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false
|
||||||
{
|
{
|
||||||
$this->protocol();
|
$this->protocol();
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return (call_user_func_array(array($this, 'parent::query'), $args));
|
$callable = parent::class . '::query';
|
||||||
|
return (call_user_func_array($callable, $args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __call($method, $args)
|
public function __call($method, $args)
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
--TEST--
|
||||||
|
GitHub issue 1391 - string truncation error when binding some parameters as longer strings the second time
|
||||||
|
--DESCRIPTION--
|
||||||
|
The test shows the same parameters, though bound as short strings in the first insertion, can be bound as longer strings in the subsequent insertions.
|
||||||
|
--ENV--
|
||||||
|
PHPT_EXEC=true
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("MsSetup.inc");
|
||||||
|
|
||||||
|
function dropTable($conn, $tableName)
|
||||||
|
{
|
||||||
|
$drop = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'" . $tableName . "') AND type in (N'U')) DROP TABLE $tableName";
|
||||||
|
$conn->exec($drop);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$conn = new PDO("sqlsrv:server=$server; Database = $databaseName;", $uid, $pwd);
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
dropTable($conn, 'long_strings');
|
||||||
|
|
||||||
|
$tsql = <<<CREATESQL
|
||||||
|
CREATE TABLE long_strings (
|
||||||
|
id bigint IDENTITY(1,1) NOT NULL,
|
||||||
|
four_thousand varchar(4002) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||||
|
var_max varchar(max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||||
|
nvar_max varchar(max) NOT NULL,
|
||||||
|
CONSTRAINT PK__long_strings__1391E83F512B1391 PRIMARY KEY (id))
|
||||||
|
CREATESQL;
|
||||||
|
|
||||||
|
$conn->exec($tsql);
|
||||||
|
|
||||||
|
$tsql = <<<INSERTSQL
|
||||||
|
INSERT INTO long_strings (four_thousand, var_max, nvar_max) VALUES (?, ?, ?)
|
||||||
|
INSERTSQL;
|
||||||
|
|
||||||
|
$stmt = $conn->prepare($tsql);
|
||||||
|
|
||||||
|
// Bind and execute short string values first
|
||||||
|
$fourThousand = '4';
|
||||||
|
$varMax = 'v';
|
||||||
|
$nvarMax = 'n';
|
||||||
|
$stmt->bindParam(1, $fourThousand);
|
||||||
|
$stmt->bindParam(2, $varMax);
|
||||||
|
$stmt->bindParam(3, $nvarMax);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
// Bind and execute long string values second, on same $stmt
|
||||||
|
$fourThousand = str_repeat('4', 4001);
|
||||||
|
$varMax = str_repeat('v', 4001);
|
||||||
|
$nvarMax = str_repeat('n', 4001);
|
||||||
|
$stmt->bindParam(1, $fourThousand);
|
||||||
|
$stmt->bindParam(2, $varMax);
|
||||||
|
$stmt->bindParam(3, $nvarMax);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
// fetch the data
|
||||||
|
$stmt = $conn->prepare("SELECT COUNT(*) FROM long_strings");
|
||||||
|
$stmt->execute();
|
||||||
|
$row = $stmt->fetch(PDO::FETCH_NUM);
|
||||||
|
echo $row[0]."\n";
|
||||||
|
|
||||||
|
dropTable($conn, 'long_strings');
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
} catch (PdoException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
2
|
||||||
|
Done
|
|
@ -3,7 +3,11 @@ Test some error conditions of Azure AD Managed Identity support
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
This test expects certain exceptions to be thrown under some conditions.
|
This test expects certain exceptions to be thrown under some conditions.
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require('skipif.inc');?>
|
<?php
|
||||||
|
require('skipif.inc');
|
||||||
|
require('skipif_Appveyor.inc');
|
||||||
|
require('skipif_unix.inc');
|
||||||
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require_once("MsCommon_mid-refactor.inc");
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
|
@ -41,7 +45,9 @@ function connectInvalidServer()
|
||||||
$conn = new PDO("sqlsrv:server = invalidServer; $connectionInfo", null, null);
|
$conn = new PDO("sqlsrv:server = invalidServer; $connectionInfo", null, null);
|
||||||
echo $message . $testCase . PHP_EOL;
|
echo $message . $testCase . PHP_EOL;
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
// TODO: check the exception message here
|
echo "Failed to connect\n";
|
||||||
|
print_r($e->getMessage());
|
||||||
|
echo "\n";
|
||||||
}
|
}
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
print_r($e->getMessage());
|
print_r($e->getMessage());
|
||||||
|
@ -72,7 +78,9 @@ function connectInvalidServerWithUser()
|
||||||
$conn = new PDO("sqlsrv:server = invalidServer; $connectionInfo", $user, null);
|
$conn = new PDO("sqlsrv:server = invalidServer; $connectionInfo", $user, null);
|
||||||
echo $message . $testCase . PHP_EOL;
|
echo $message . $testCase . PHP_EOL;
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
// TODO: check the exception message here
|
echo "Failed to connect\n";
|
||||||
|
print_r($e->getMessage());
|
||||||
|
echo "\n";
|
||||||
}
|
}
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
print_r($e->getMessage());
|
print_r($e->getMessage());
|
||||||
|
@ -82,10 +90,15 @@ function connectInvalidServerWithUser()
|
||||||
require_once('MsSetup.inc');
|
require_once('MsSetup.inc');
|
||||||
|
|
||||||
// Make a connection to an invalid server
|
// Make a connection to an invalid server
|
||||||
|
// Expect to get two error messages
|
||||||
connectInvalidServer();
|
connectInvalidServer();
|
||||||
connectInvalidServerWithUser();
|
connectInvalidServerWithUser();
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
|
Failed to connect
|
||||||
|
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
|
||||||
|
Failed to connect
|
||||||
|
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
|
||||||
Done
|
Done
|
||||||
|
|
|
@ -22,7 +22,6 @@ $conn = null;
|
||||||
testValidValues();
|
testValidValues();
|
||||||
testInvalidValues();
|
testInvalidValues();
|
||||||
testEncryptedWithODBC();
|
testEncryptedWithODBC();
|
||||||
testWrongODBC();
|
|
||||||
echo "Done" . PHP_EOL;
|
echo "Done" . PHP_EOL;
|
||||||
// end test
|
// end test
|
||||||
|
|
||||||
|
@ -118,17 +117,6 @@ function testEncryptedWithODBC()
|
||||||
connectVerifyOutput($connectionOptions, "Using ODBC 13 for AE", $expected);
|
connectVerifyOutput($connectionOptions, "Using ODBC 13 for AE", $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testWrongODBC()
|
|
||||||
{
|
|
||||||
global $msodbcsqlMaj;
|
|
||||||
|
|
||||||
$value = "ODBC Driver 18 for SQL Server";
|
|
||||||
$connectionOptions = "Driver = $value;";
|
|
||||||
$expected = "The specified ODBC Driver is not found.";
|
|
||||||
|
|
||||||
connectVerifyOutput($connectionOptions, "Connect with ODBC 18", $expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Done
|
Done
|
||||||
|
|
|
@ -8,6 +8,8 @@ This test should not use temporary table as it might occasionally cause deadlock
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include 'MsCommon.inc';
|
include 'MsCommon.inc';
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class PdoTestClass
|
class PdoTestClass
|
||||||
{
|
{
|
||||||
function __construct ()
|
function __construct ()
|
||||||
|
@ -16,6 +18,7 @@ class PdoTestClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class PdoTestClass2
|
class PdoTestClass2
|
||||||
{
|
{
|
||||||
function __construct ($a1, $a2)
|
function __construct ($a1, $a2)
|
||||||
|
|
|
@ -20,7 +20,7 @@ try {
|
||||||
--EXPECTREGEX--
|
--EXPECTREGEX--
|
||||||
Array
|
Array
|
||||||
\(
|
\(
|
||||||
\[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib))
|
\[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib))
|
||||||
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
|
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
|
||||||
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
|
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
|
||||||
\[ExtensionVer\] => [0-9]\.[0-9]+\.[0-9](-(RC[1-9]?|beta[1-9]))?(\.[0-9]+)?(\+[0-9]+)?
|
\[ExtensionVer\] => [0-9]\.[0-9]+\.[0-9](-(RC[1-9]?|beta[1-9]))?(\.[0-9]+)?(\+[0-9]+)?
|
||||||
|
|
|
@ -125,7 +125,7 @@ SQLSTATE\[IMSSP\]: A read-only attribute was designated on the PDO object.
|
||||||
Get Result PDO::ATTR_CLIENT_VERSION :
|
Get Result PDO::ATTR_CLIENT_VERSION :
|
||||||
array\(4\) {
|
array\(4\) {
|
||||||
\[\"(DriverDllName|DriverName)\"\]=>
|
\[\"(DriverDllName|DriverName)\"\]=>
|
||||||
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
|
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
|
||||||
\["DriverODBCVer"\]=>
|
\["DriverODBCVer"\]=>
|
||||||
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
|
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
|
||||||
\["DriverVer"\]=>
|
\["DriverVer"\]=>
|
||||||
|
|
|
@ -8,6 +8,7 @@ ORDER BY should work with sql_variants
|
||||||
<?php
|
<?php
|
||||||
require_once("MsCommon_mid-refactor.inc");
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Food
|
class Food
|
||||||
{
|
{
|
||||||
public function getFood()
|
public function getFood()
|
||||||
|
|
|
@ -24,6 +24,6 @@ if ($c !== false) {
|
||||||
|
|
||||||
Fatal error: Uncaught PDOException: SQLSTATE\[(28000|08001|HYT00)\]: .*\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\](\[SQL Server\])?(Named Pipes Provider: Could not open a connection to SQL Server \[2\]\. |TCP Provider: Error code (0x2726|0x2AF9)|Login timeout expired|Login failed for user 'sa'\.) in .+(\/|\\)pdo_utf8_conn\.php:[0-9]+
|
Fatal error: Uncaught PDOException: SQLSTATE\[(28000|08001|HYT00)\]: .*\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\](\[SQL Server\])?(Named Pipes Provider: Could not open a connection to SQL Server \[2\]\. |TCP Provider: Error code (0x2726|0x2AF9)|Login timeout expired|Login failed for user 'sa'\.) in .+(\/|\\)pdo_utf8_conn\.php:[0-9]+
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 .+(\/|\\)pdo_utf8_conn\.php\([0-9]+\): PDO->__construct(\(\)|\('sqlsrv:Server=l\.\.\.', 'sa', 'Sunshine4u'\))
|
#0 .+(\/|\\)pdo_utf8_conn\.php\([0-9]+\): PDO->__construct(\(\)|\('sqlsrv:Server=l\.\.\.', 'sa', ('Sunshine4u'|Object\(SensitiveParameterValue\))\))
|
||||||
#1 {main}
|
#1 {main}
|
||||||
thrown in .+(\/|\\)pdo_utf8_conn\.php on line [0-9]+
|
thrown in .+(\/|\\)pdo_utf8_conn\.php on line [0-9]+
|
||||||
|
|
4
test/functional/pdo_sqlsrv/skipif_Appveyor.inc
Normal file
4
test/functional/pdo_sqlsrv/skipif_Appveyor.inc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
if (getenv('APPVEYOR')) {
|
||||||
|
die("skip Appveyor pipeline");
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ require('skipif_versions_old.inc');
|
||||||
<?php
|
<?php
|
||||||
require_once('MsCommon.inc');
|
require_once('MsCommon.inc');
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class TestClass
|
class TestClass
|
||||||
{
|
{
|
||||||
public function __construct($a1, $a2, $a3)
|
public function __construct($a1, $a2, $a3)
|
||||||
|
|
|
@ -15,7 +15,7 @@ var_dump( $client_info );
|
||||||
--EXPECTREGEX--
|
--EXPECTREGEX--
|
||||||
array\(4\) {
|
array\(4\) {
|
||||||
\[\"(DriverDllName|DriverName)\"\]=>
|
\[\"(DriverDllName|DriverName)\"\]=>
|
||||||
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
|
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]{1,2}\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
|
||||||
\[\"DriverODBCVer\"\]=>
|
\[\"DriverODBCVer\"\]=>
|
||||||
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
|
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
|
||||||
\[\"DriverVer\"\]=>
|
\[\"DriverVer\"\]=>
|
||||||
|
|
|
@ -20,7 +20,6 @@ sqlsrv_close($conn);
|
||||||
testValidValues($msodbcsqlMaj, $server, $connectionOptions);
|
testValidValues($msodbcsqlMaj, $server, $connectionOptions);
|
||||||
testInvalidValues($msodbcsqlMaj, $server, $connectionOptions);
|
testInvalidValues($msodbcsqlMaj, $server, $connectionOptions);
|
||||||
testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions);
|
testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions);
|
||||||
testWrongODBC($msodbcsqlMaj, $server, $connectionOptions);
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
// end test
|
// end test
|
||||||
|
|
||||||
|
@ -115,15 +114,6 @@ function testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions)
|
||||||
connectVerifyOutput($server, $connectionOptions, "Using ODBC 13 for AE", $expected);
|
connectVerifyOutput($server, $connectionOptions, "Using ODBC 13 for AE", $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testWrongODBC($msodbcsqlMaj, $server, $connectionOptions)
|
|
||||||
{
|
|
||||||
$value = "ODBC Driver 18 for SQL Server";
|
|
||||||
$connectionOptions['Driver']=$value;
|
|
||||||
$expected = "The specified ODBC Driver is not found.";
|
|
||||||
|
|
||||||
connectVerifyOutput($server, $connectionOptions, "Connect with ODBC 18", $expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Done
|
Done
|
||||||
|
|
|
@ -61,7 +61,7 @@ function isDataClassSupported($conn, &$driverCapable)
|
||||||
|
|
||||||
// ODBC Driver must be 17.2 or above
|
// ODBC Driver must be 17.2 or above
|
||||||
$driverCapable = true;
|
$driverCapable = true;
|
||||||
if ($version[0] < 17 || $version[1] < 2) {
|
if ($version[0] < 17 || ($version[0] == 17 && $version[1] < 2)) {
|
||||||
$driverCapable = false;
|
$driverCapable = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ function isDataClassSupported($conn, &$driverCapable)
|
||||||
|
|
||||||
// ODBC Driver must be 17.2 or above
|
// ODBC Driver must be 17.2 or above
|
||||||
$driverCapable = true;
|
$driverCapable = true;
|
||||||
if ($version[0] < 17 || $version[1] < 2) {
|
if ($version[0] < 17 || ($version[0] == 17 && $version[1] < 2)) {
|
||||||
$driverCapable = false;
|
$driverCapable = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ Test for fetch_object
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo
|
class foo
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
@ -25,6 +26,7 @@ class foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo_noargs
|
class foo_noargs
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
|
|
@ -5,6 +5,7 @@ Test for fetch_object
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo
|
class foo
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
@ -25,6 +26,7 @@ class foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo_noargs
|
class foo_noargs
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
|
|
@ -4,6 +4,7 @@ Test insert various data types and fetch as strings
|
||||||
<?php
|
<?php
|
||||||
require_once('MsCommon.inc');
|
require_once('MsCommon.inc');
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class TestClass2
|
class TestClass2
|
||||||
{
|
{
|
||||||
public function __construct($a1, $a2)
|
public function __construct($a1, $a2)
|
||||||
|
@ -12,6 +13,7 @@ class TestClass2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class TestClass3
|
class TestClass3
|
||||||
{
|
{
|
||||||
public function __construct($a1, $a2, $a3)
|
public function __construct($a1, $a2, $a3)
|
||||||
|
|
|
@ -5,6 +5,7 @@ Test for fetch_object with Unicode column name
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo
|
class foo
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
@ -25,6 +26,7 @@ class foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class foo_noargs
|
class foo_noargs
|
||||||
{
|
{
|
||||||
public $stuff = "stuff";
|
public $stuff = "stuff";
|
||||||
|
|
|
@ -6,6 +6,7 @@ sqlsrv_fetch_object() into a class with Unicode column name
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Define the Product class
|
// Define the Product class
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Product
|
class Product
|
||||||
{
|
{
|
||||||
public function __construct($ID, $UID)
|
public function __construct($ID, $UID)
|
||||||
|
@ -37,6 +38,7 @@ class Product
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class Sample extends Product
|
class Sample extends Product
|
||||||
{
|
{
|
||||||
public function __construct($ID)
|
public function __construct($ID)
|
||||||
|
|
34
test/functional/sqlsrv/sqlsrv_github_1448.phpt
Normal file
34
test/functional/sqlsrv/sqlsrv_github_1448.phpt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
--TEST--
|
||||||
|
Test for Github Issue 1448
|
||||||
|
--DESCRIPTION--
|
||||||
|
Prepare and execute with int, then execute with string caused "Invalid character value for cast specification" error.
|
||||||
|
Repro script provided by thsmrtone1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||||
|
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||||
|
|
||||||
|
require_once( 'MsCommon.inc' );
|
||||||
|
$conn = Connect();
|
||||||
|
if( !$conn ) {
|
||||||
|
var_dump( sqlsrv_errors() );
|
||||||
|
die( "sqlsrv_connect failed." );
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlsrv_query($conn, "CREATE TABLE test1448 (testCol nvarchar(50) NULL)");
|
||||||
|
|
||||||
|
$v0 = 1000;
|
||||||
|
$stmt = sqlsrv_prepare($conn, 'INSERT INTO [test1448] (testCol) VALUES (?);', [&$v0]);
|
||||||
|
sqlsrv_execute($stmt);
|
||||||
|
|
||||||
|
$v0 = 'abcd';
|
||||||
|
sqlsrv_execute($stmt);
|
||||||
|
|
||||||
|
$error = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||||
|
var_dump($error);
|
||||||
|
|
||||||
|
dropTable($conn, "test1448");
|
||||||
|
sqlsrv_close($conn);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
NULL
|
|
@ -4,6 +4,8 @@ Send a large amount (10MB) using encryption. In a Linux CI environment use a sma
|
||||||
<?php require('skipif_azure_dw.inc'); ?>
|
<?php require('skipif_azure_dw.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
#[AllowDynamicProperties]
|
||||||
class my_stream
|
class my_stream
|
||||||
{
|
{
|
||||||
public $total_read = 0;
|
public $total_read = 0;
|
||||||
|
|
Loading…
Reference in a new issue