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

fix: if the connection is broken when calling SQLFreeHandle, the client can't be notified #1

Closed
wants to merge 12 commits into from
Closed
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
38 changes: 38 additions & 0 deletions .github/workflows/configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration version="" formatVersion="0.4" vcversion="" toolset="">
<title>
</title>
<x86 disabled="no">
<libpq version="y">
<include>d:\postgresql86\include</include>
<lib>d:\postgresql86\lib</lib>
<bin>d:\postgresql86\bin</bin>
</libpq>
<setvcvars>
</setvcvars>
<build_macros>
</build_macros>
<runtime_folder>
</runtime_folder>
</x86>
<x64>
<libpq version="y">
<include>c:\Program Files\PostgreSQL\16\include</include>
<lib>c:\Program Files\PostgreSQL\16\lib</lib>
<bin>c:\Program Files\PostgreSQL\16\bin</bin>
</libpq>
<setvcvars>
</setvcvars>
<build_macros>
</build_macros>
<runtime_folder>
</runtime_folder>
</x64>
<BuildResult>
<Date>03/04/2024 10:49:13</Date>
<VisualStudioVersion>17.0</VisualStudioVersion>
<PlatformToolset>v143</PlatformToolset>
<ToolsVersion>Current</ToolsVersion>
<Platform>arm64</Platform>
</BuildResult>
</Configuration>
326 changes: 326 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
name: MSBuild
run-name: psql ODBC CI - ${{ github.event.head_commit.message }}

on:
push:
branches: [ "main" ]
tags:
- 'REL-*'
pull_request:
branches: [ "main" ]

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
build_and_test:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
repository: "postgres/postgres.git"
ref: 'master'
- name: 'get meson'
run: |
python -m pip install meson
python -m pip install ninja
- name: Cache Postgres directory
uses: actions/cache@v4
id: cachePostgres
with:
path: d:\postgresql
key: postgresql
- name: Cache Postgres86 directory
uses: actions/cache@v4
id: cachePostgres86
with:
path: d:\postgresql86
key: postgresql86
- name: Cache GNU diffutils for Test on PostgreSQL for Windows
uses: actions/cache@v4
id: cacheDiffutilsZip
with:
path: C:\OTHERBIN\diffutils
key: diffutils-2.8.7-1-bin.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Cache PostgreSQL installer
uses: actions/cache@v4
id: cachePostgresInstaller
with:
path: C:\OTHERBIN\postgresql_install.exe
key: postgresql_installer
- name: Cache pkgconfiglite for Compile using msvc and meson
uses: actions/cache@v4
id: cachePkgConfigLiteZip
with:
path: C:\OTHERBIN\pkgconfiglite
key: pkg-config-lite-0.28-1_bin-win32.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Cache Win32OpenSSL32 for Win32Compile
uses: actions/cache@v4
id: cacheWin32OpenSSL-3_3
with:
path: C:\OTHERBIN\openssl32
key: Win32OpenSSL-3_3_0.exe
- name: Cache winflexbison for Compile using msvc
uses: actions/cache@v4
id: cacheWinFlexBisonZip
with:
path: C:\OTHERBIN\winflexbison
key: win_flex_bison-2.5.24.zip
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Download GNU diffutils for Test on PostgreSQL for Windows
if: ${{steps.cacheDiffutilsZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadDiffutilsZip
with:
retry-times: 5
url: https://zenlayer.dl.sourceforge.net/project/gnuwin32/diffutils/2.8.7-1/diffutils-2.8.7-1-bin.zip

- name: Download openssl32 for win32 compile
if: ${{steps.cacheWin32OpenSSL.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadWin32OpenSSL3_3_3
with:
retry-times: 5
url: https://slproweb.com/download/Win32OpenSSL-3_3_0.exe

- name: Download pkgconfiglite for Compile using msvc and meson
if: ${{steps.cachePkgConfigLiteZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadPkgConfigLiteZip
with:
retry-times: 5
url: http://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip

- name: Download winflexbison for Compile using msvc
if: ${{steps.cacheWinFlexBisonZip.outputs.cache-hit != 'true'}}
uses: suisei-cn/[email protected]
id: downloadWinFlexBisonZip
with:
retry-times: 5
url: https://sourceforge.net/projects/winflexbison/files/win_flex_bison-2.5.24.zip

- name: Download postgresql install from EDB
uses: suisei-cn/[email protected]
if: ${{steps.cachePostgresInstaller.outputs.cache-hit != 'true'}}
id: downloadPostgresInstaller
with:
retry-times: 5
url: https://sbp.enterprisedb.com/getfile.jsp?fileid=1258893
target: c:\OTHERBIN
filename: postgresql_install.exe

- name: Extract Diffuntils and add Diffuntils bin directory to the PATH for Test on PostgreSQL for Windows
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\diffutils"
rem 7z is provided by Github Actions
7z x diffutils-2.8.7-1-bin.zip -o"C:\OTHERBIN\diffutils"
copy diffutils-2.8.7-1-bin.zip "C:\OTHERBIN\diffutils"
dir "C:\OTHERBIN\diffutils"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\\OTHERBIN\\diffutils\\bin" >> %GITHUB_PATH%

- name: Extract pkgconfiglite and add pkgconfiglite bin directory to the PATH for Compile using msvc and meson
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\pkgconfiglite"
rem 7z is provided by Github Actions
7z x pkg-config-lite-0.28-1_bin-win32.zip -o"C:\OTHERBIN\pkgconfiglite"
copy pkg-config-lite-0.28-1_bin-win32.zip "C:\OTHERBIN\pkgconfiglite"
dir "C:\OTHERBIN\pkgconfiglite"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\\OTHERBIN\\pkgconfiglite\\pkg-config-lite-0.28-1\\bin" >> %GITHUB_PATH%

- name: Install Win32OpenSSL
shell: cmd
run: Win32OpenSSL-3_3_0.exe /sp /silent /dir=c:\openssl32

# Choco Install winflexbison
# BUT the "crazy-max/ghaction-chocolatey@v2" "install pkgconfiglite" file download often times-out
- name: Extract winflexbison and add the winflexbison directory to the PATH for Compile using msvc
shell: cmd
run: |
rem MKDIR creates any intermediate directories in the path, if needed.
mkdir "C:\OTHERBIN\winflexbison"
rem 7z is provided by Github Actions
7z x win_flex_bison-2.5.24.zip -o"C:\OTHERBIN\winflexbison"
copy win_flex_bison-2.5.24.zip "C:\OTHERBIN\winflexbison"
dir "C:\OTHERBIN\winflexbison"
rem - man7.org/linux/man-pages/man1/printf.1.html
printf "C:\OTHERBIN\\winflexbison" >> %GITHUB_PATH%
- name: 'setup msvc x86'
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86
- name: 'build postgresx86'
if: ${{steps.cachePostgres86.outputs.cache-hit != 'true'}}
run: |
meson setup buildx86 -Dssl=openssl -Dextra_lib_dirs=c:\openssl32\lib\VC\x86\MT -Dextra_include_dirs=c:\openssl32\include --prefix=d:\postgresql86
cd buildx86
ninja -v
ninja -v install
cp c:\openssl32\*.dll d:\postgresql86\bin
- name: 'setup msvc x64'
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name : 'build postgres x64'
if: ${{steps.cachePostgres.outputs.cache-hit != 'true'}}
run: |
meson setup build --prefix=d:\postgresql
cd build
ninja
ninja install
- name: install postgresql binary
shell: cmd
run: |
echo on
C:\OTHERBIN\postgresql_install.exe --mode unattended --unattendedmodeui none --superpassword password --enable-components server
- name: start postgresql
shell: cmd
run: |
echo on
sc config "postgresql-x64-14" start= auto
- name: get psqlodbc
uses: actions/checkout@v4
with:
submodules: true
- name: 'setup msvc for psqlodbc'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86

- name: build psqlodbc standard
shell: powershell
run: |
copy .github\workflows\configuration.xml winbuild
winbuild\BuildAll.ps1
installer\buildInstallers.ps1
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\winbuild\standard
- name: test psqlodbc standard
shell: powershell
run: |
winbuild\regress.ps1 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password"
standard\test_x86\RegisterRegdsn.exe uninstall_driver postgres_devw
standard\test_x64\RegisterRegdsn.exe uninstall_driver postgres_devw
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\winbuild\standard

- name: build psqlodbc mimalloc
shell: powershell
run: |
copy .github\workflows\configuration.xml winbuild
winbuild\BuildAll.ps1 -UseMimalloc
installer\buildInstallers.ps1
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\winbuild\mimalloc
- name: test psqlodbc mimalloc
shell: powershell
run: |
winbuild\regress.ps1 -DsnInfo "SERVER=localhost|DATABASE=contrib_regression|PORT=5432|UID=postgres|PWD=password" -ExpectMimalloc
mimalloc\test_x86\RegisterRegdsn.exe uninstall_driver postgres_devw
mimalloc\test_x64\RegisterRegdsn.exe uninstall_driver postgres_devw
env:
PSQLODBC_OBJBASE: ${{ github.workspace }}\winbuild\mimalloc

- name: Upload standard x64 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC Standard x64 Merge Module
path: winbuild/standard/installer/x64/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload standard x64 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC Standard x64 Installer
path: winbuild/standard/installer/x64/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload standard x86 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC Standard x86 Merge Module
path: winbuild/standard/installer/x86/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload standard x86 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC Standard x86 Installer
path: winbuild/standard/installer/x86/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload standard x64 setup
uses: actions/upload-artifact@v4
with:
name: psqlODBC Standard x64 Setup
path: winbuild/standard/installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe
retention-days: 5
if-no-files-found: error

- name: Upload mimalloc x64 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC mimalloc x64 Merge Module
path: winbuild/mimalloc/installer/x64/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload mimalloc x64 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC mimalloc x64 Installer
path: winbuild/mimalloc/installer/x64/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload mimalloc x86 merge module
uses: actions/upload-artifact@v4
with:
name: psqlODBC mimalloc x86 Merge Module
path: winbuild/mimalloc/installer/x86/*.msm
retention-days: 5
if-no-files-found: error
- name: Upload mimalloc x86 installer package
uses: actions/upload-artifact@v4
with:
name: psqlODBC mimalloc x86 Installer
path: winbuild/mimalloc/installer/x86/*.msi
retention-days: 5
if-no-files-found: error
- name: Upload mimalloc x64 setup
uses: actions/upload-artifact@v4
with:
name: psqlODBC mimalloc x64 Setup
path: winbuild/mimalloc/installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe
retention-days: 5
if-no-files-found: error

- name: Create Release
if: startsWith(github.ref, 'refs/tags/REL-')
uses: ncipollo/[email protected]
id: create_release
with:
draft: false
prerelease: false
token: ${{secrets.RELEASE_TOKEN}}
artifacts: "winbuild/standard/installer/x64/*.ms?,winbuild/standard/installer/x86/*.ms?,winbuild/standard/installer/psqlodbc-setup/bin/Release/psqlodbc-setup.exe"
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "libs/mimalloc"]
path = libs/mimalloc
url = https://github.com/microsoft/mimalloc
branch = master
3 changes: 2 additions & 1 deletion environ.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ ER_ReturnError(PG_ErrorInfo *pgerror,
PG_ErrorInfo *error;
BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0);
const char *msg;
SWORD msglen, stapos, wrtlen, pcblen;
UWORD msglen, wrtlen, pcblen;
UInt4 stapos;

if (!pgerror)
return SQL_NO_DATA_FOUND;
Expand Down
Loading