2022-01-31 19:07:26 +07:00
|
|
|
# Function to get sqlsrv and pdo_sqlsrv version.
|
|
|
|
get_sqlsrv_version() {
|
2022-02-22 02:21:53 +07:00
|
|
|
if [[ "${version:?}" =~ 7.[0-3] ]]; then
|
2022-01-31 19:07:26 +07:00
|
|
|
echo '5.9.0'
|
|
|
|
else
|
2022-02-22 02:21:53 +07:00
|
|
|
echo '5.10.0'
|
2022-01-31 19:07:26 +07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-05-25 11:46:23 +07:00
|
|
|
add_unixodbc() {
|
|
|
|
if [ "$(uname -s)" = 'Linux' ]; then
|
|
|
|
install_packages unixodbc-dev
|
|
|
|
else
|
|
|
|
brew install unixodbc
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-01-31 19:07:26 +07:00
|
|
|
# Function to install sqlsrv and pdo_sqlsrv.
|
|
|
|
add_sqlsrv() {
|
|
|
|
ext=$1
|
|
|
|
ext_version=$(get_sqlsrv_version)
|
2022-05-25 11:46:23 +07:00
|
|
|
add_unixodbc >/dev/null 2>&1
|
2022-01-31 19:07:26 +07:00
|
|
|
add_pecl_extension "$ext" "$ext_version" extension
|
|
|
|
}
|