Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated versioning to semantic versioning #315

Merged
merged 2 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/pdo_sqlsrv/template.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

//Version
VS_VERSION_INFO VERSIONINFO
FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD
PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,0
FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD
PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -62,12 +62,12 @@ BEGIN
VALUE "Comments", "This product includes PHP software that is freely available from http://www.php.net/software/. Copyright © 2001-2016 The PHP Group. All rights reserved.\0"
VALUE "CompanyName", "Microsoft Corp.\0"
VALUE "FileDescription", "Microsoft Drivers for PHP for SQL Server (PDO Driver)\0"
VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD)
VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD)
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright Microsoft Corporation.\0"
VALUE "OriginalFilename", FILE_NAME "\0"
VALUE "ProductName", "Microsoft Drivers for PHP for SQL Server\0"
VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE)
VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH)
VALUE "URL", "http://www.microsoft.com\0"
END
END
Expand Down
21 changes: 16 additions & 5 deletions source/shared/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@

#define SQLVERSION_MAJOR 4
#define SQLVERSION_MINOR 1
#define SQLVERSION_RELEASE 6
#define SQLVERSION_PATCH 7
#define SQLVERSION_BUILD 0

#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_RELEASE ) "." STRINGIFY( SQLVERSION_BUILD )
#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,SQLVERSION_BUILD
#define PHP_SQLSRV_VERSION STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_RELEASE )
#define PHP_PDO_SQLSRV_VERSION PHP_SQLSRV_VERSION
// Semantic versioning pre-release and buil metadata
#define SEMVER_PRERELEASE "-preview"
#define SEMVER_BUILDMETA

#if SQLVERSION_BUILD > 0
#undef SEMVER_BUILDMETA
#define SEMVER_BUILDMETA "+" STRINGIFY( SQLVERSION_BUILD )
#endif

#define VER_FILEVERSION_STR STRINGIFY( SQLVERSION_MAJOR ) "." STRINGIFY( SQLVERSION_MINOR ) "." STRINGIFY( SQLVERSION_PATCH ) SEMVER_PRERELEASE SEMVER_BUILDMETA
#define _FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_PATCH,SQLVERSION_BUILD

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so when SQLVERSION_BUILD is 1, VER_FILEVERSION_STR is 4.1.7-preview+1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true and when it is 0, VER_FILEVERSION_STR is 4.1.7-preview, and build number is not counted in precedence order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Product name? Both drivers have the same name but file descriptions are different?

Copy link
Author

@Hadis-Knj Hadis-Knj Mar 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion will remain untouched

//PECL extension verison macros
#define PHP_SQLSRV_VERSION VER_FILEVERSION_STR
#define PHP_PDO_SQLSRV_VERSION VER_FILEVERSION_STR

#endif // VERSION_H

Expand Down
8 changes: 4 additions & 4 deletions source/sqlsrv/template.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

//Version
VS_VERSION_INFO VERSIONINFO
FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD
PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR,SQLVERSION_RELEASE,0
FILEVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD
PRODUCTVERSION SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -62,12 +62,12 @@ BEGIN
VALUE "Comments", "This product includes PHP software that is freely available from http://www.php.net/software/. Copyright © 2001-2016 The PHP Group. All rights reserved.\0"
VALUE "CompanyName", "Microsoft Corp.\0"
VALUE "FileDescription", "Microsoft Drivers for PHP for SQL Server\0"
VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE, SQLVERSION_BUILD)
VALUE "FileVersion", STRVER4(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH, SQLVERSION_BUILD)
VALUE "InternalName", FILE_NAME "\0"
VALUE "LegalCopyright", "Copyright Microsoft Corporation.\0"
VALUE "OriginalFilename", FILE_NAME "\0"
VALUE "ProductName", "Microsoft Drivers for PHP for SQL Server\0"
VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_RELEASE)
VALUE "ProductVersion", STRVER3(SQLVERSION_MAJOR,SQLVERSION_MINOR, SQLVERSION_PATCH)
VALUE "URL", "http://www.microsoft.com\0"
END
END
Expand Down
22 changes: 22 additions & 0 deletions test/pdo_sqlsrv/pdo_getAttribute_clientInfo.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test client info by calling PDO::getAttribute with PDO::ATTR_CLIENT_VERSION
--FILE--
<?php
require_once("autonomous_setup.php");

$conn = new PDO( "sqlsrv:server=$serverName", "$username", "$password" );

// An example using PDO::ATTR_CLIENT_VERSION
print_r($conn->getAttribute( PDO::ATTR_CLIENT_VERSION ));

//free the connection
$conn=null;
?>
--EXPECTREGEX--
Array
\(
\[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9])
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
\[ExtensionVer\] => [0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)?
\)
25 changes: 25 additions & 0 deletions test/sqlsrv/sqlsrv_client_info.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Test sqlsrv_client_info
--SKIPIF--
--FILE--
<?php
require_once("autonomous_setup.php");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( !$conn ) {
die( print_r( sqlsrv_errors(), true));
}

$client_info = sqlsrv_client_info( $conn );
var_dump( $client_info );
?>
--EXPECTREGEX--
array\(4\) {
\[\"(DriverDllName|DriverName)\"\]=>
(string\(15\) \"msodbcsql1[1-9].dll\"|string\(24\) \"libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9]\")
\[\"DriverODBCVer\"\]=>
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
\[\"DriverVer\"\]=>
string\(10\) \"[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}\"
\[\"ExtensionVer\"\]=>
string\([0-9]+\) \"[0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)?"
}