Skip to content

Add SQL dialect support to StatementOptions#44

Merged
asfernandes merged 2 commits into
asfernandes:mainfrom
fdcastel:issue-42-req1
Mar 13, 2026
Merged

Add SQL dialect support to StatementOptions#44
asfernandes merged 2 commits into
asfernandes:mainfrom
fdcastel:issue-42-req1

Conversation

@fdcastel
Copy link
Copy Markdown
Contributor

Adds a configurable SQL dialect to StatementOptions, addressing REQ-1 from #42.

Problem

Statement constructor hardcodes SQL_DIALECT_CURRENT (dialect 3) in the call to IAttachment::prepare(). The ODBC driver needs to support legacy Firebird databases running in dialect 1 (InterBase compatibility mode), where NUMERIC/DECIMAL types map to DOUBLE PRECISION and quoted identifiers behave differently.

Changes

  • StatementOptions: Added dialect field (default: SQL_DIALECT_CURRENT) with getDialect() / setDialect(unsigned) fluent API.
  • Statement constructor: Replaced hardcoded SQL_DIALECT_CURRENT with options.getDialect().
  • Tests: Added tests for default value, setter/getter, and statement construction with explicit dialect.

Impact

  • Backward compatible: Default dialect remains SQL_DIALECT_CURRENT (3).

Add dialect getter/setter to StatementOptions with SQL_DIALECT_CURRENT
as the default, preserving backward compatibility.

Uses options.getDialect() in Statement constructor instead of the
hardcoded SQL_DIALECT_CURRENT constant.

Closes asfernandes#42 (REQ-1).
Comment thread src/test/Statement.cpp Outdated
Comment thread src/test/Statement.cpp Outdated
Comment thread src/test/Statement.cpp
@fdcastel fdcastel force-pushed the issue-42-req1 branch 2 times, most recently from 7fcb0f5 to 79043eb Compare March 13, 2026 02:05
…ic-as-double behavior

In SQL dialect 1, NUMERIC(18,2) columns are described as DOUBLE PRECISION
instead of scaled integers. The updated test inserts a value into a NUMERIC(18,2)
table column, then selects it using s dialect-1-prepared statement and verifies
that getDouble() retrieves the correct value, exercising the dialect-specific
type mapping.
@asfernandes asfernandes merged commit 9f6d80e into asfernandes:main Mar 13, 2026
4 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.

2 participants