Skip to content

fix: unbreak build (AE_PARSE_ERROR) + ODBC driver x86 (C4100/C2733)#119

Merged
Admnwk merged 2 commits into
FiveTechSoft:mainfrom
Admnwk:fix/odbc-driver-x86-build
Jun 26, 2026
Merged

fix: unbreak build (AE_PARSE_ERROR) + ODBC driver x86 (C4100/C2733)#119
Admnwk merged 2 commits into
FiveTechSoft:mainfrom
Admnwk:fix/odbc-driver-x86-build

Conversation

@Admnwk

@Admnwk Admnwk commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Two build fixes. The first unbreaks main (currently red on clang/macOS/PHP and a clean MSVC); the second fixes the x86 (32-bit) ODBC driver build behind issue #3.

1. AE_PARSE_ERROR in the INDEX ON guard (unbreaks main)

PR #118's INDEX-ON-SELECT guard referenced openads::AE_SYNTAX_ERROR, which is not a member of the openads error enum. On Windows the SAP ACE SDK headers define AE_SYNTAX_ERROR as a macro (see the #undef block in error.h), so a local MSVC build with that header silently accepted it — but clang/gcc and a clean MSVC reject it. Use AE_PARSE_ERROR (7200), the existing parse/syntax code the SQL parser already emits.

Note: PR #118 merged without this surfacing because CI status wasn't confirmed green before merge. This restores green.

2. ODBC driver x86 build — C4100 + C2733

The ODBC driver (bindings/odbc/openads_odbc.cpp) does not compile on MSVC x86 /WX (CI only builds x64, so it slipped past):

  • C4100SQLSetStmtAttr's SQLINTEGER param was named a but unused. Drop the name.
  • C2733SQLColAttribute's final param is SQLLEN* on 64-bit but SQLPOINTER on 32-bit per the Windows SDK sqlext.h (defined(_WIN64) || defined(SQLCOLATTRIBUTE_SQLLEN)). Our SQLLEN* definition conflicted with the 32-bit declaration → extern "C" overload rejection. Mirror the SDK guard, alias back to SQLLEN* internally.

x64 unchanged

On x64 _WIN64 is defined, so SQLColAttribute takes the byte-identical original signature. SQLSetStmtAttr change is cosmetic.

Verification

  • x86 /WX full build clean; x86 unit suite 873/873, 0 failed (361,197 assertions).
  • x64 openads_odbc.cpp compiles clean /W4 /WX.

Scope

bindings/odbc/ + one line in the existing INDEX ON guard. Does not touch the wire protocol.

🤖 Generated with Claude Code

The ODBC driver failed to compile on MSVC x86 /WX (CI only builds x64,
so these slipped past). Two x86-only issues:

1. C4100: SQLSetStmtAttr's SQLINTEGER param was named 'a' but unused →
   /WX error. Drop the name.

2. C2733: SQLColAttribute's final parameter is SQLLEN* on 64-bit but
   SQLPOINTER on 32-bit per the Windows SDK sqlext.h
   (guarded by 'defined(_WIN64) || defined(SQLCOLATTRIBUTE_SQLLEN)').
   Our fixed SQLLEN* definition conflicted with the 32-bit declaration,
   which MSVC rejects as an extern "C" overload. Mirror the SDK guard
   and alias back to SQLLEN* internally.

x64 is unchanged: the _WIN64 branch is byte-identical to the prior
signature. Verified:
- x86 /WX full build clean; x86 unit suite 873/873, 0 failed.
- x64 openads_odbc.cpp compiles clean /W4 /WX.

Addresses the x86 build gap reported in issue #3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request resolves compilation issues on 32-bit Windows (x86) by conditionally defining the SQLColAttribute signature based on platform bitness, and removes an unused parameter name in SQLSetStmtAttr. The review feedback recommends using static_cast instead of reinterpret_cast when casting the SQLPOINTER (which is void*) to SQLLEN* to align with idiomatic C++ practices.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

SQLUSMALLINT field, SQLPOINTER charattr,
SQLSMALLINT bufmax, SQLSMALLINT* strlen,
SQLPOINTER numattr_) {
SQLLEN* numattr = reinterpret_cast<SQLLEN*>(numattr_);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since SQLPOINTER is defined as void* in the Windows SDK, it is more idiomatic and safer in C++ to use static_cast instead of reinterpret_cast when casting from void* to a typed pointer.

    SQLLEN* numattr = static_cast<SQLLEN*>(numattr_);

The INDEX ON SELECT-result guard (PR #118) referenced
openads::AE_SYNTAX_ERROR, which is not a member of the openads error
enum. On Windows the SAP ACE SDK headers define AE_SYNTAX_ERROR as a
macro (see the #undef block in error.h), so a local MSVC build with
that header present silently accepted it — but clang/gcc and a clean
MSVC build reject it, breaking main on Linux/macOS/PHP and x64.

Use AE_PARSE_ERROR (7200), the existing parse/syntax error code the
SQL parser already emits, which exists in the enum on all toolchains.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Admnwk Admnwk changed the title fix(odbc driver): x86 (32-bit) build (C4100 + C2733) fix: unbreak build (AE_PARSE_ERROR) + ODBC driver x86 (C4100/C2733) Jun 26, 2026
@Admnwk Admnwk merged commit 6d05ac2 into FiveTechSoft:main Jun 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant