Improve support for sqlsrv and pdo_sqlsrv

This commit is contained in:
Shivam Mathur 2022-01-31 17:37:26 +05:30
parent 9d74a11420
commit 408b70728f
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 21 additions and 0 deletions

View File

@ -56,6 +56,7 @@ describe('Extension tests', () => {
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'}
${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
@ -92,6 +93,7 @@ describe('Extension tests', () => {
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
${'sqlsrv'} | ${'7.3'} | ${'add_sqlsrv sqlsrv'}
`(
'checking addExtensionOnDarwin for extension $extension on version $version',
async ({extension, version, output}) => {

2
dist/index.js vendored
View File

@ -234,6 +234,7 @@ async function addExtensionDarwin(extension_csv, version) {
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'darwin');
return;
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
@ -348,6 +349,7 @@ async function addExtensionLinux(extension_csv, version) {
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
add_script += await utils.customPackage(ext_name, 'extensions', extension, 'linux');
return;
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):

View File

@ -44,6 +44,7 @@ export async function addExtensionDarwin(
):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
add_script += await utils.customPackage(
ext_name,
'extensions',
@ -267,6 +268,7 @@ export async function addExtensionLinux(
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
add_script += await utils.customPackage(
ext_name,
'extensions',

View File

@ -0,0 +1,15 @@
# Function to get sqlsrv and pdo_sqlsrv version.
get_sqlsrv_version() {
if [[ "${version:?}" =~ 7.[0-2] ]]; then
echo '5.9.0'
else
echo '5.10.0beta2'
fi
}
# Function to install sqlsrv and pdo_sqlsrv.
add_sqlsrv() {
ext=$1
ext_version=$(get_sqlsrv_version)
add_pecl_extension "$ext" "$ext_version" extension
}