Skip to content

Commit a02691e

Browse files
author
Hadis Kakanejadi Fard
committed
merged dev into master
1 parent 71fe4ca commit a02691e

File tree

119 files changed

+38041
-30771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+38041
-30771
lines changed

.travis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
sudo: required
2+
3+
os: linux
4+
dist: trusty
5+
6+
services:
7+
- docker
8+
9+
env:
10+
global:
11+
- REPORT_EXIT_STATUS=1
12+
- ACCEPT_EULA=Y
13+
- PHPSQLDIR=/REPO/msphpsql-PHP-7.0-Linux
14+
- SQLSERVERHOSTNAME=sql
15+
16+
before_install:
17+
- docker pull microsoft/mssql-server-linux
18+
19+
install:
20+
- docker build --build-arg PHPSQLDIR=$PHPSQLDIR -t msphpsql-dev -f Dockerfile-msphpsql .
21+
- docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' -p 1433:1433 --name=$SQLSERVERHOSTNAME -d microsoft/mssql-server-linux
22+
23+
script:
24+
- docker run -e TRAVIS_JOB_ID -t -d -w $PHPSQLDIR --link $SQLSERVERHOSTNAME --name=client msphpsql-dev
25+
- docker ps -a
26+
- docker exec client php ./source/pdo_sqlsrv/run-tests.php ./test/pdo_sqlsrv/*.phpt
27+
- docker exec client php ./source/sqlsrv/run-tests.php ./test/sqlsrv/*.phpt
28+
- docker exec client coveralls -e ./source/shared/ --gcov-options '\-lp'
29+
- docker stop client
30+
- docker ps -a
31+
32+
33+
notifications:
34+
email: false

CHANGELOG.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
6+
## Windows/Linux 4.1.6 - 2017-02-03
7+
Updated PECL release packages. Here is the list of updates:
8+
### Added
9+
- Merged Linux and Windows code.
10+
- Enabled connection pooling with unixODBC. To enable pooling:
11+
- in odbcinst.ini, add `Pooling=Yes` to the `[ODBC]` section and a positive `CPTimeout` value to `[ODBC Driver 13 for SQL Server]` section. See http://www.unixodbc.org/doc/conn_pool.html for detailed instructions.
12+
13+
###Fixed
14+
- Fixed issues with sqlsrv_has_rows() to prevent it from moving statement cursor ([issue #37](https://github.com/Microsoft/msphpsql/issues/37)).
15+
- Fixed sqlsrv client buffer size to only allow positive integers ([issue #228](https://github.com/Microsoft/msphpsql/issues/228)).
16+
- Fixed PECL installation errors when PHP was installed from source ([issue #213](https://github.com/Microsoft/msphpsql/issues/213)).
17+
- Fixed segmentation fault with PDOStatement::getColumnMeta() when the supplied column index is out of range ([issue #224](https://github.com/Microsoft/msphpsql/issues/224)).
18+
- Fixed the assertion error (Linux) when fetching data from a binary column using the binary encoding ([issue #226](https://github.com/Microsoft/msphpsql/issues/226)).
19+
20+
## Windows 4.1.5 - 2017-01-19
21+
Updated Windows drivers (4.1.5) compiled with PHP 7.0.14 and 7.1 are available. Here is the list of updates:
22+
23+
### Added
24+
- Added Unicode Column name support([issue #138](https://github.com/Microsoft/msphpsql/issues/138)).
25+
26+
###Fixed
27+
- Fixed issue output parameters bound to empty string ([issue #182](https://github.com/Microsoft/msphpsql/issues/182)).
28+
- Fixed issue with SQLSRV_ATTR_FETCHES_NUMERIC_TYPE when column return type is set on statement ([issue #173](https://github.com/Microsoft/msphpsql/issues/173)).
29+
30+
31+
### Changed
32+
- Code structure is updated to facilitate the development; shared codes between both drivers are moved to "shared" folder to avoid code duplication issues in development. To build the driver from source:
33+
- if you are building the driver from source using PHP source, copy the "shared" folder as a subfolder to both the sqlsrv and pdo_sqlsrv folders.
34+
35+
## Linux 4.0.8 - 2016-12-19
36+
Production release of Linux drivers is available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2. Here is the list of updates:
37+
38+
### Added
39+
- Added `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` attribute support in PDO_SQLSRV driver.`SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` connection attribute flag handles numeric fetches from columns with numeric Sql types (only bit, integer, smallint, tinyint, float and real). This flag can be turned on by setting its value in `PDO::setAttribute` to `true`, For example,
40+
`$conn->setAttribute(PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE,true);`
41+
If `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is set to `true` the results from an integer column will be represented as an `int`, likewise, Sql types float and real will be represented as `float`.
42+
Note for exceptions:
43+
- When connection option flag `ATTR_STRINGIFY_FETCHES` is on, even when `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is on, the return value will still be string.
44+
- When the returned PDO type in bind column is `PDO_PARAM_INT`, the return value from a integer column will be int even if `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is off.
45+
- Added Unicode Column name support([issue #138](https://github.com/Microsoft/msphpsql/issues/138)).
46+
47+
###Fixed
48+
- Fixed issue with SQLSRV_ATTR_FETCHES_NUMERIC_TYPE when column return type is set on statement ([issue #173](https://github.com/Microsoft/msphpsql/issues/173)).
49+
- Fixed precision issues when double data type returned as strings using buffered queries in PDO_SQLSRV driver.
50+
- Fixed issue with buffered cursor in PDO_SQLSRV driver when CharacterSet is UTF-8 ([issue #192](https://github.com/Microsoft/msphpsql/issues/192)).
51+
- Fixed segmentation fault in error cases when error message is returned with emulate prepare attribute is set to true in PDO_SQLSRV driver.
52+
- Fixed issue with empty output parameters on stored procedure([issue #182](https://github.com/Microsoft/msphpsql/issues/182)).
53+
- Fixed memory leaks in buffered queries.
54+
55+
56+
## Linux 4.0.7 - 2016-11-23
57+
Linux drivers compiled with PHP 7.0.13 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
58+
59+
### Added
60+
- Ported buffered cursor to Linux.
61+
62+
### Changed
63+
- Code structure is updated to facilitate the development; shared codes between both drivers are moved to "shared" folder to avoid code duplication issues in development. To build the driver from source, use "packagize" script as follows:
64+
- if you are using the phpize, clone or download the “source”, run the script within the “source” directory and then run phpize.
65+
- if you are building the driver from source using PHP source, give the path to the PHP source to the script.
66+
67+
### Fixed
68+
- Fixed string truncation error when inserting long strings.
69+
- Fixed querying from large column name.
70+
- Fixed issue with trailing garbled characters in string retrieval.
71+
- Fixed issue with detecting invalid UTF-16 strings coming from server.
72+
- Fixed issues with binding input text, ntext, and image parameters.
73+
74+
## Linux 4.0.6 - 2016-10-25
75+
Linux drivers compiled with PHP 7.0.12 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
76+
77+
### Changed
78+
- Drivers versioning has been redesigned as Major#.Minor#.Release#.Build#. Build number is specific to binaries and it doesn't match with the number on the source.
79+
- Compiler C++ 11 is enabled in config file.
80+
81+
### Fixed
82+
- Fixed the issue with duplicate warning messages in PDO_SQLSRV drivers when error mode is set to PDO::ERRMODE_WARNING.
83+
- Fixed the issue with invalid UTF-8 strings, those are detected before executing any queries and proper error message is returned.
84+
- Fixed segmentation fault in sqlsrv_fetch_object and sqlsrv_fetch_array function.
85+
86+
## Windows 4.1.4 - 2016-10-25
87+
Windows drivers compiled with PHP 7.0.12 and 7.1 are available. Here is the list of updates:
88+
89+
### Changed
90+
- Drivers versioning has been redesigned as Major#.Minor#.Release#.Build#. Build number is specific to binaries and it doesn't match with the number on the source.
91+
92+
### Fixed
93+
- Fixed the issue with duplicate warning messages in PDO_SQLSRV drivers when error mode is set to PDO::ERRMODE_WARNING.
94+
95+
## Linux 4.0.5 - 2016-10-04
96+
Linux drivers compiled with PHP 7.0.11 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
97+
98+
### Fixed
99+
- Fixed segmentation fault when calling PDOStatement::getColumnMeta on RedHat 7.2.
100+
- Fixed segmentation fault when fetch mode is set to ATTR_EMULATE_PREPARES on RedHat 7.2.
101+
- Fixed [issue #139](https://github.com/Microsoft/msphpsql/issues/139) : sqlsrv_fetch_object calls custom class constructor in static context and outputs an error.
102+
103+
## Windows 4.1.3 - 2016-10-04
104+
Updated Windows drivers (4.1.3) compiled with PHP 7.0.11 and 7.1.0RC3 are available. Here is the list of updates:
105+
106+
### Fixed
107+
- Fixed [issue #139](https://github.com/Microsoft/msphpsql/issues/139) : sqlsrv_fetch_object calls custom class constructor in static context and outputs an error.
108+
109+
##Linux 4.0.4 - 2016-09-09
110+
Linux drivers compiled with PHP 7.0.10 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
111+
112+
### Added
113+
- Added Support for EMULATE_PREPARE feature.
114+
- Added following integer SQL Types constants for cases which function-like SQL types constants cannot be used e.g. type comparison:
115+
116+
SQLSRV constant | Typical SQL Server data type | SQL type identifier
117+
------------ | ----------------------- | ----------------------
118+
SQLSRV_SQLTYPE_DECIMAL | decimal | SQL_DECIMAL
119+
SQLSRV_SQLTYPE_NUMERIC | numeric | SQL_NUMERIC
120+
SQLSRV_SQLTYPE_CHAR | char | SQL_CHAR
121+
SQLSRV_SQLTYPE_NCHAR | nchar | SQL_WCHAR
122+
SQLSRV_SQLTYPE_VARCHAR | varchar | SQL_VARCHAR
123+
SQLSRV_SQLTYPE_NVARCHAR | nvarchar | SQL_WVARCHAR
124+
SQLSRV_SQLTYPE_BINARY | binary | SQL_BINARY
125+
SQLSRV_SQLTYPE_VARBINARY | varbinary | SQL_VARBINARY
126+
127+
Note: These constants should be used in type comparison operations (refer to issue [#87](https://github.com/Microsoft/msphpsql/issues/87) and [#99](https://github.com/Microsoft/msphpsql/issues/99) ), and don't replace the function like constants with similar syntax. For binding parameters you should use the function-like constants, otherwise you'll get an error.
128+
129+
### Fixed
130+
- Fixed undefined symbols at SQL* error when loading the drivers.
131+
- Fixed undefined symbol issues at LocalAlloc and LocalFree on RedHat7.2.
132+
- Fixed [issue #144](https://github.com/Microsoft/msphpsql/issues/144) (floating point exception).
133+
- Fixed [issue #119](https://github.com/Microsoft/msphpsql/issues/119) (modifying class name in sqlsrv_fetch_object).
134+
135+
## Windows 4.1.2 - 2016-09-09
136+
Updated Windows drivers (4.1.2) compiled with PHP 7.0.10 are available. Here is the list of updates:
137+
138+
### Added
139+
- Added following integer SQL Types constants for cases which function-like SQL types constants cannot be used e.g. type comparison:
140+
141+
SQLSRV constant | Typical SQL Server data type | SQL type identifier
142+
------------ | ----------------------- | ----------------------
143+
SQLSRV_SQLTYPE_DECIMAL | decimal | SQL_DECIMAL
144+
SQLSRV_SQLTYPE_NUMERIC | numeric | SQL_NUMERIC
145+
SQLSRV_SQLTYPE_CHAR | char | SQL_CHAR
146+
SQLSRV_SQLTYPE_NCHAR | nchar | SQL_WCHAR
147+
SQLSRV_SQLTYPE_VARCHAR | varchar | SQL_VARCHAR
148+
SQLSRV_SQLTYPE_NVARCHAR | nvarchar | SQL_WVARCHAR
149+
SQLSRV_SQLTYPE_BINARY | binary | SQL_BINARY
150+
SQLSRV_SQLTYPE_VARBINARY | varbinary | SQL_VARBINARY
151+
152+
Note: These constants should be used in type comparison operations (refer to issue [#87](https://github.com/Microsoft/msphpsql/issues/87) and [#99](https://github.com/Microsoft/msphpsql/issues/99) ), and don't replace the function like constants with similar syntax. For binding parameters you should use the function-like constants, otherwise you'll get an error.
153+
154+
### Fixed
155+
- Fixed [issue #119](https://github.com/Microsoft/msphpsql/issues/119) (modifying class name in sqlsrv_fetch_object).
156+
157+
158+
## Linux 4.0.3 - 2016-08-23
159+
Linux drivers compiled with PHP 7.0.9 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
160+
161+
### Fixed
162+
- Fixed data corruption in binding integer parameters.
163+
- Fixed invalid sql_display_size error.
164+
- Fixed issue with invalid statement options.
165+
- Fixed binding bit parameters.
166+
167+
## Windows 4.1.1 - 2016-08-22
168+
Updated Windows drivers(4.1.1) compiled with PHP 7.0.9 are available and include a couple of bug fixes:
169+
170+
### Fixed
171+
- Fixed issue with storing integers in varchar field.
172+
- Fixed issue with invalid connection handler if one connection fails.
173+
- Fixed crash when emulate prepare is on.
174+
175+
176+
## Linux 4.0.2 - 2016-07-29
177+
178+
### Fixed
179+
- The PDO_SQLSRV driver no longer requires PDO to be built as a shared extension.
180+
- Fixed an issue with format specifiers in error messages.
181+
- Fixed a segmentation fault when using buffered cursors.
182+
- Fixed an issue whereby calling sqlsrv_rows_affected on an empty result set would return a null result instead of 0.
183+
- Fixed an issue with error messages when there is an error in sizes in SQLSRV_SQLTYPE_*.
184+
185+
## Windows 4.1.0 - 2016-07-28
186+
187+
### Fixed
188+
- `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` connection attribute flag is added to PDO_SQLSRV driver to handle numeric fetches from columns with numeric Sql types (only bit, integer, smallint, tinyint, float and real). This flag can be turned on by setting its value in `PDO::setAttribute` to `true`, For example,
189+
`$conn->setAttribute(PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE,true);`
190+
If `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is set to `true` the results from an integer column will be represented as an `int`, likewise, Sql types float and real will be represented as `float`.
191+
Note for exceptions:
192+
- When connection option flag `ATTR_STRINGIFY_FETCHES` is on, even when `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is on, the return value will still be string.
193+
- When the returned PDO type in bind column is `PDO_PARAM_INT`, the return value from a integer column will be int even if `SQLSRV_ATTR_FETCHES_NUMERIC_TYPE` is off.
194+
- Fixed float truncation when using buffered query.
195+
- Fixed handling of Unicode strings and binary when emulate prepare is on in `PDOStatement::bindParam`. To bind a unicode string, `PDO::SQLSRV_ENCODING_UTF8` should be set using `$driverOption`, and to bind a string to column of Sql type binary, `PDO::SQLSRV_ENCODING_BINARY` should be set.
196+
- Fixed string truncation in bind output parameters when the size is not set and the length of initialized variable is less than the output.
197+
- Fixed bind string parameters as bidirectional parameters (`PDO::PARAM_INPUT_OUTPUT `) in PDO_SQLSRV driver. Note for output or bidirectional parameters, `PDOStatement::closeCursor` should be called to get the output value.
198+
199+
200+
## Linux 4.0.1 - 2016-07-09
201+
202+
### Added
203+
- Added support for PDO_SQLSRV driver on RedHat 7.
204+
205+
###Changed
206+
- Improved handling varchar(MAX).
207+
- Improved handling basic stream operations.
208+
209+
## Linux 4.0.0 - 2016-06-11
210+
211+
### Added
212+
- The early technical preview (ETP) for SQLSRV and PDO_SQLSRV drivers for Linux with basic functionalities is now available. The SQLSRV driver has been built and tested on Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2, and PDO_SQLSRV driver has been built and tested on Ubuntu 15.04, Ubuntu 16.04.

Dockerfile-msphpsql

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#Download base image ubuntu 16.04
2+
3+
FROM ubuntu:16.04
4+
5+
# Update Ubuntu Software repository
6+
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
7+
apt-get -y install \
8+
apt-transport-https \
9+
apt-utils \
10+
autoconf \
11+
curl \
12+
g++ \
13+
gcc \
14+
git \
15+
lcov \
16+
libxml2-dev \
17+
locales \
18+
make \
19+
php7.0 \
20+
php7.0-dev \
21+
python-pip \
22+
re2c \
23+
unixodbc-dev \
24+
unzip && apt-get clean
25+
26+
ARG PHPSQLDIR=/REPO/msphpsql-PHP-7.0-Linux
27+
28+
# set locale to utf-8
29+
RUN locale-gen en_US.UTF-8
30+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
31+
32+
#install ODBC driver
33+
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
34+
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
35+
36+
#RUN echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/mssql-ubuntu-xenial-release/ xenial main" > /etc/apt/sources.list.d/mssqlpreview.list
37+
#RUN apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
38+
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql mssql-tools
39+
40+
#install coveralls
41+
RUN pip install --upgrade pip && pip install cpp-coveralls
42+
43+
#Either Install git / download zip (One can see other strategies : https://ryanfb.github.io/etc/2015/07/29/git_strategies_for_docker.html )
44+
#One option is to get source from zip file of repository.
45+
46+
#another option is to copy source to build directory on image
47+
RUN mkdir -p $PHPSQLDIR
48+
COPY . $PHPSQLDIR
49+
50+
WORKDIR $PHPSQLDIR/source/
51+
52+
RUN chmod +x ./packagize.sh
53+
RUN /bin/bash -c "./packagize.sh"
54+
55+
RUN echo "extension = pdo_sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
56+
RUN echo "extension = sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
57+
58+
WORKDIR $PHPSQLDIR/source/sqlsrv
59+
RUN phpize && ./configure LDFLAGS="-lgcov" CXXFLAGS="-O0 --coverage" && make && make install
60+
61+
WORKDIR $PHPSQLDIR/source/pdo_sqlsrv
62+
RUN phpize && ./configure LDFLAGS="-lgcov" CXXFLAGS="-O0 --coverage" && make && make install
63+
64+
# set name of sql server host to use
65+
WORKDIR $PHPSQLDIR/test/pdo_sqlsrv
66+
RUN sed -i -e 's/localhost/sql/g' autonomous_setup.php
67+
68+
WORKDIR $PHPSQLDIR/test/sqlsrv
69+
RUN sed -i -e 's/localhost/sql/g' autonomous_setup.php
70+
71+
ENV REPORT_EXIT_STATUS 1
72+
ENV TEST_PHP_EXECUTABLE /usr/bin/php

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright(c) 2016 Microsoft Corporation
1+
Copyright(c) 2017 Microsoft Corporation
22
All rights reserved.
33

44
MIT License

0 commit comments

Comments
 (0)