Merge pull request #271 from v-dareck/ReadmeUpdate

Readme and Changelog update
This commit is contained in:
Jenny Tam 2017-02-03 11:59:20 -08:00 committed by GitHub
commit 695dd19aff
3 changed files with 387 additions and 8 deletions

View file

@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
## Windows/Linux 4.1.6 - 2017-02-03
Updated PECL release packages. Here is the list of updates:
### Added
- Merged Linux and Windows code.
- Enabled connection pooling with unixODBC. To enable pooling:
- 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.
###Fixed
- Fixed issues with sqlsrv_has_rows() to prevent it from moving statement cursor ([issue #37](https://github.com/Microsoft/msphpsql/issues/37)).
- Fixed sqlsrv client buffer size to only allow positive integers ([issue #228](https://github.com/Microsoft/msphpsql/issues/228)).
- Fixed PECL installation errors when PHP was installed from source ([issue #213](https://github.com/Microsoft/msphpsql/issues/213)).
- Fixed segmentation fault with PDOStatement::getColumnMeta() when the supplied column index is out of range ([issue #224](https://github.com/Microsoft/msphpsql/issues/224)).
- 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)).
## Windows 4.1.5 - 2017-01-19
Updated Windows drivers (4.1.5) compiled with PHP 7.0.14 and 7.1 are available. Here is the list of updates:
@ -18,6 +32,57 @@ Updated Windows drivers (4.1.5) compiled with PHP 7.0.14 and 7.1 are available.
- 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:
- 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.
## Linux 4.0.8 - 2016-12-19
Production release of Linux drivers is available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2. Here is the list of updates:
### Added
- 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,
`$conn->setAttribute(PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE,true);`
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`.
Note for exceptions:
- 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.
- 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.
- Added Unicode Column name support([issue #138](https://github.com/Microsoft/msphpsql/issues/138)).
###Fixed
- 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)).
- Fixed precision issues when double data type returned as strings using buffered queries in PDO_SQLSRV driver.
- Fixed issue with buffered cursor in PDO_SQLSRV driver when CharacterSet is UTF-8 ([issue #192](https://github.com/Microsoft/msphpsql/issues/192)).
- Fixed segmentation fault in error cases when error message is returned with emulate prepare attribute is set to true in PDO_SQLSRV driver.
- Fixed issue with empty output parameters on stored procedure([issue #182](https://github.com/Microsoft/msphpsql/issues/182)).
- Fixed memory leaks in buffered queries.
## Linux 4.0.7 - 2016-11-23
Linux drivers compiled with PHP 7.0.13 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
### Added
- Ported buffered cursor to Linux.
### Changed
- 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:
- if you are using the phpize, clone or download the “source”, run the script within the “source” directory and then run phpize.
- if you are building the driver from source using PHP source, give the path to the PHP source to the script.
### Fixed
- Fixed string truncation error when inserting long strings.
- Fixed querying from large column name.
- Fixed issue with trailing garbled characters in string retrieval.
- Fixed issue with detecting invalid UTF-16 strings coming from server.
- Fixed issues with binding input text, ntext, and image parameters.
## Linux 4.0.6 - 2016-10-25
Linux drivers compiled with PHP 7.0.12 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
### Changed
- 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.
- Compiler C++ 11 is enabled in config file.
### Fixed
- Fixed the issue with duplicate warning messages in PDO_SQLSRV drivers when error mode is set to PDO::ERRMODE_WARNING.
- Fixed the issue with invalid UTF-8 strings, those are detected before executing any queries and proper error message is returned.
- Fixed segmentation fault in sqlsrv_fetch_object and sqlsrv_fetch_array function.
## Windows 4.1.4 - 2016-10-25
Windows drivers compiled with PHP 7.0.12 and 7.1 are available. Here is the list of updates:
@ -26,13 +91,47 @@ Windows drivers compiled with PHP 7.0.12 and 7.1 are available. Here is the lis
### Fixed
- Fixed the issue with duplicate warning messages in PDO_SQLSRV drivers when error mode is set to PDO::ERRMODE_WARNING.
## Linux 4.0.5 - 2016-10-04
Linux drivers compiled with PHP 7.0.11 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
### Fixed
- Fixed segmentation fault when calling PDOStatement::getColumnMeta on RedHat 7.2.
- Fixed segmentation fault when fetch mode is set to ATTR_EMULATE_PREPARES on RedHat 7.2.
- Fixed [issue #139](https://github.com/Microsoft/msphpsql/issues/139) : sqlsrv_fetch_object calls custom class constructor in static context and outputs an error.
## Windows 4.1.3 - 2016-10-04
Updated Windows drivers (4.1.3) compiled with PHP 7.0.11 and 7.1.0RC3 are available. Here is the list of updates:
### Fixed
- Fixed [issue #139](https://github.com/Microsoft/msphpsql/issues/139) : sqlsrv_fetch_object calls custom class constructor in static context and outputs an error.
##Linux 4.0.4 - 2016-09-09
Linux drivers compiled with PHP 7.0.10 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
### Added
- Added Support for EMULATE_PREPARE feature.
- Added following integer SQL Types constants for cases which function-like SQL types constants cannot be used e.g. type comparison:
SQLSRV constant | Typical SQL Server data type | SQL type identifier
------------ | ----------------------- | ----------------------
SQLSRV_SQLTYPE_DECIMAL | decimal | SQL_DECIMAL
SQLSRV_SQLTYPE_NUMERIC | numeric | SQL_NUMERIC
SQLSRV_SQLTYPE_CHAR | char | SQL_CHAR
SQLSRV_SQLTYPE_NCHAR | nchar | SQL_WCHAR
SQLSRV_SQLTYPE_VARCHAR | varchar | SQL_VARCHAR
SQLSRV_SQLTYPE_NVARCHAR | nvarchar | SQL_WVARCHAR
SQLSRV_SQLTYPE_BINARY | binary | SQL_BINARY
SQLSRV_SQLTYPE_VARBINARY | varbinary | SQL_VARBINARY
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.
### Fixed
- Fixed undefined symbols at SQL* error when loading the drivers.
- Fixed undefined symbol issues at LocalAlloc and LocalFree on RedHat7.2.
- Fixed [issue #144](https://github.com/Microsoft/msphpsql/issues/144) (floating point exception).
- Fixed [issue #119](https://github.com/Microsoft/msphpsql/issues/119) (modifying class name in sqlsrv_fetch_object).
## Windows 4.1.2 - 2016-09-09
Updated Windows drivers (4.1.2) compiled with PHP 7.0.10 are available. Here is the list of updates:
@ -56,6 +155,15 @@ Updated Windows drivers (4.1.2) compiled with PHP 7.0.10 are available. Here is
- Fixed [issue #119](https://github.com/Microsoft/msphpsql/issues/119) (modifying class name in sqlsrv_fetch_object).
## Linux 4.0.3 - 2016-08-23
Linux drivers compiled with PHP 7.0.9 are available for Ubuntu 15.04, Ubuntu 16.04, and RedHat 7.2.
### Fixed
- Fixed data corruption in binding integer parameters.
- Fixed invalid sql_display_size error.
- Fixed issue with invalid statement options.
- Fixed binding bit parameters.
## Windows 4.1.1 - 2016-08-22
Updated Windows drivers(4.1.1) compiled with PHP 7.0.9 are available and include a couple of bug fixes:
@ -65,6 +173,15 @@ Updated Windows drivers(4.1.1) compiled with PHP 7.0.9 are available and include
- Fixed crash when emulate prepare is on.
## Linux 4.0.2 - 2016-07-29
### Fixed
- The PDO_SQLSRV driver no longer requires PDO to be built as a shared extension.
- Fixed an issue with format specifiers in error messages.
- Fixed a segmentation fault when using buffered cursors.
- Fixed an issue whereby calling sqlsrv_rows_affected on an empty result set would return a null result instead of 0.
- Fixed an issue with error messages when there is an error in sizes in SQLSRV_SQLTYPE_*.
## Windows 4.1.0 - 2016-07-28
### Fixed
@ -78,3 +195,18 @@ Updated Windows drivers(4.1.1) compiled with PHP 7.0.9 are available and include
- 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.
- Fixed string truncation in bind output parameters when the size is not set and the length of initialized variable is less than the output.
- 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.
## Linux 4.0.1 - 2016-07-09
### Added
- Added support for PDO_SQLSRV driver on RedHat 7.
###Changed
- Improved handling varchar(MAX).
- Improved handling basic stream operations.
## Linux 4.0.0 - 2016-06-11
### Added
- 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.

259
README.md
View file

@ -12,12 +12,12 @@ SQL Server Team
|-------------------------|--------------------------| ------------------
| [![av-image][]][av-site]| [![tv-image][]][tv-site] |[![Coverage Status][]][coveralls-site]
[av-image]: https://ci.appveyor.com/api/projects/status/github/Microsoft/msphpsql?branch=PHP-7.0&svg=true
[av-image]: https://ci.appveyor.com/api/projects/status/github/Microsoft/msphpsql?branch=merged-codebase&svg=true
[av-site]: https://ci.appveyor.com/project/Microsoft-PHPSQL/msphpsql
[tv-image]: https://travis-ci.org/Microsoft/msphpsql.svg?branch=PHP-7.0-Linux
[tv-image]: https://travis-ci.org/Microsoft/msphpsql.svg?branch=merged-codebase
[tv-site]: https://travis-ci.org/Microsoft/msphpsql/
[Coverage Status]: https://coveralls.io/repos/github/Microsoft/msphpsql/badge.svg?branch=PHP-7.0-Linux
[coveralls-site]: https://coveralls.io/github/Microsoft/msphpsql?branch=PHP-7.0-Linux
[Coverage Status]: https://coveralls.io/repos/github/Microsoft/msphpsql/badge.svg?branch=merged-codebase
[coveralls-site]: https://coveralls.io/github/Microsoft/msphpsql?branch=merged-codebase
##Get Started
@ -33,7 +33,7 @@ SQL Server Team
Please visit the [blog][blog] for more announcements.
## Build
## Build (Windows)
Note: if you prefer, you can use the pre-compiled binary found [HERE](https://github.com/Azure/msphpsql/releases)
@ -57,7 +57,7 @@ You must first be able to build PHP 7 without including these extensions. For h
This software has been compiled and tested under PHP 7.0.8 using the Visual C++ 2015 compiler.
## Install
## Install (Windows)
####Prerequisites
@ -72,6 +72,243 @@ This software has been compiled and tested under PHP 7.0.8 using the Visual C++
3. Restart the Web server.
## Install (Linux)
Following instructions shows how to install PHP 7.x, Microsoft ODBC driver, apache, and Microsoft PHP drivers on Ubuntu 15, 16 and RedHat 7. To see how to get PHP SQLSRV drivers running on Debian, please visit [Wiki](https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways). Note that Debian is not officially supported and this instruction hasn't been tested in our test lab.
### Step 1: Install PHP (unless already installed)
#### PHP 7.0
**Ubuntu 15.04, Ubuntu 15.10**
sudo su
sh -c 'echo "deb http://packages.dotdeb.org jessie all \ndeb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list'
apt-get update
apt-get install php7.0 php7.0-fpm php-pear php7.0-dev mcrypt php7.0-mcrypt php-mbstring php7.0-xml re2c gcc g++
**Ubuntu 16.04**
sudo su
apt-get update
apt-get -y install php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev php7.0-xml re2c gcc g++
**RedHat 7**
sudo su
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
yum-config-manager --enable remi-php70
yum update
yum install php php-pdo php-xml php-pear php-devel re2c gcc-c++ gcc
#### PHP 7.1
**Ubuntu 16.04**
sudo su
add-apt-repository ppa:ondrej/php
apt-get update
apt-get -y install php7.1 mcrypt php7.1-mcrypt php-mbstring php-pear php7.1-dev
**RedHat 7**
sudo su
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
yum-config-manager --enable remi-php71
yum update
yum install php php-pdo php-xml php-pear php-devel
### Step 2: Install pre-requisites
**Ubuntu 15.04**
sudo su
sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/mssql-ubuntu-vivid-release/ vivid main" > /etc/apt/sources.list.d/mssqlpreview.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
apt-get update
apt-get install msodbcsql
#for silent install use ACCEPT_EULA=Y apt-get install msodbcsql
sudo apt-get install unixodbc-dev-utf16
**Ubuntu 15.10**
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/15.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql mssql-tools
sudo apt-get install unixodbc-dev-utf16
**Ubuntu 16.04**
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql mssql-tools
sudo apt-get install unixodbc-dev-utf16
**RedHat 7**
sudo su
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
exit
sudo yum update
sudo yum remove unixODBC #to avoid conflicts
sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools
sudo yum install unixODBC-utf16-devel
*Note: On Ubuntu, you need to make sure you install PHP 7 before you proceed to step 2. The Microsoft PHP Drivers for SQL Server will only work for PHP 7+.
### Step 3: Install Apache
####PHP 7.0
**Ubuntu**
sudo apt-get install libapache2-mod-php7.0
sudo apt-get install apache2
**RedHat**
sudo yum install httpd
####PHP 7.1
**Ubuntu**
sudo apt-get install libapache2-mod-php7.1
sudo apt-get install apache2
**RedHat**
sudo yum install httpd
### Step 4: Install the Microsoft PHP Drivers for SQL Server
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
*Note: it installs the stable version, for specific version you should set the version. For example, `sudo pecl install sqlsrv-4.0.8`
### Step 5: Add the Microsoft PHP Drivers for SQL Server to php.ini
####PHP 7.0
**Ubuntu**
echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/apache2/php.ini
echo "extension=/usr/lib/php/20151012/sqlsrv.so" >> /etc/php/7.0/cli/php.ini
echo "extension=/usr/lib/php/20151012/pdo_sqlsrv.so" >> /etc/php/7.0/cli/php.ini
**RedHat**
echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini
echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini
####PHP 7.1
**Ubuntu 16.04**
echo "extension=/usr/lib/php/20160303/sqlsrv.so" >> /etc/php/7.1/apache2/php.ini
echo "extension=/usr/lib/php/20160303/pdo_sqlsrv.so" >> /etc/php/7.1/apache2/php.ini
echo "extension=/usr/lib/php/20160303/sqlsrv.so" >> /etc/php/7.1/cli/php.ini
echo "extension=/usr/lib/php/20160303/pdo_sqlsrv.so" >> /etc/php/7.1/cli/php.ini
**RedHat**
echo "extension= /usr/lib64/php/modules/sqlsrv.so" > /etc/php.d/sqlsrv.ini
echo "extension= /usr/lib64/php/modules/pdo_sqlsrv.so" > /etc/php.d/pdo_sqlsrv.ini
### Step 6: Restart Apache to load the new php.ini file
**Ubuntu**
sudo service apache2 restart
**RedHat**
sudo apachectl restart
### Step 7: Create your sample app
Navigate to `/var/www/html` and create a new file called testsql.php. Copy and paste the following code in tetsql.php and change the servername, username, password and databasename.
<?php
$serverName = "yourServername";
$connectionOptions = array(
"Database" => "yourDatabase",
"Uid" => "yourUsername",
"PWD" => "yourPassword"
);
//Establishes the connection
$conn = sqlsrv_connect($serverName, $connectionOptions);
//Select Query
$tsql= "SELECT @@Version as SQL_VERSION";
//Executes the query
$getResults= sqlsrv_query($conn, $tsql);
//Error handling
if ($getResults == FALSE)
die(FormatErrors(sqlsrv_errors()));
?>
<h1> Results : </h1>
<?php
while ($row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC)) {
echo ($row['SQL_VERSION']);
echo ("<br/>");
}
sqlsrv_free_stmt($getResults);
function FormatErrors( $errors )
{
/* Display errors. */
echo "Error information: <br/>";
foreach ( $errors as $error )
{
echo "SQLSTATE: ".$error['SQLSTATE']."<br/>";
echo "Code: ".$error['code']."<br/>";
echo "Message: ".$error['message']."<br/>";
}
}
?>
### Step 8: Run your sample app
Go to your browser and type in http://localhost/testsql.php
You should be able to connect to your SQL Server/Azure SQL Database.
The drivers are distributed as shared binary extensions for PHP. They are available in thread safe (*_ts.so) and-non thread safe (*_nts.so) versions. The source code for the drivers is also available, and you can choose whether to compile them as thread safe or non-thread safe versions. The thread safety configuration of your web server will determine which version you need.
## Sample Code
For samples, please see the sample folder. For setup instructions, see [here] [phpazure]
@ -79,10 +316,20 @@ For samples, please see the sample folder. For setup instructions, see [here] [
- This release contains the PHP 7 port of the SQLSRV and PDO_SQLSRV drivers, and does not provide backwards compatibility with PHP 5.
- Binding output parameter using emulate prepare is not supported.
- Linux
- ODBC 3.52 is supported but not 3.8.
- Connection using named instances using '\' is not supported.
- Local encodings other than UTF-8 are not supported, and SQLSRV_ENC_CHAR only supports ASCII characters with ASCII code of 0 to 127.
## Known Issues
- User defined data types and SQL_VARIANT.
- Binary column binding with emulate prepare ([issue#140](https://github.com/Microsoft/msphpsql/issues/140) )
- Linux
- The following features are not supported with connection pooling:
- Unicode connection strings
- sqlsrv_server_info and sqlsrv_client_info return false
- In certain scenarios a generic error message maybe returned instead of a specific error when pooling is disabled
- When retrieving data from columns with a data type of XML, varchar(max), nvarchar(max), or varbinary(max) no data maybe returned or the data maybe truncated depending on the length of the data in the source table.
## Future Plans
- Expand SQL 16 Feature Support (example: Always Encrypted).

View file

@ -24,7 +24,7 @@
#define SQLVERSION_MAJOR 4
#define SQLVERSION_MINOR 1
#define SQLVERSION_RELEASE 5
#define SQLVERSION_RELEASE 6
#define SQLVERSION_BUILD 0
#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_RELEASE ) "." STRINGIFY( SQLVERSION_BUILD )