Skip to content

add check for 'delayed' error#51

Open
supersonic-copycat wants to merge 1 commit into
hdbc:masterfrom
supersonic-copycat:pr
Open

add check for 'delayed' error#51
supersonic-copycat wants to merge 1 commit into
hdbc:masterfrom
supersonic-copycat:pr

Conversation

@supersonic-copycat

Copy link
Copy Markdown
Contributor

According to ODBC spec, errors in SQLPrepare MAY be 'delayed':

"Some drivers cannot return syntax errors or access violations when the application calls SQLPrepare. A driver can handle syntax errors and access violations, only syntax errors, or neither syntax errors nor access violations. Therefore, an application must be able to handle these conditions when calling subsequent related functions such as SQLNumResultCols, SQLDescribeCol, SQLColAttribute, and SQLExecute."

Unfortunately, I could not find a list of such drivers, but I found that popular drivers, supplied by Microsoft themselves, indeed 'delay' some (not all!) errors. (I tested 'SQL Server Native Client 11.0' and 'ODBC Driver 17 for SQL Server' with SQL Server 2016).
So, I've add another check for error in the bindParam function, since it's the first function calling ODBC functions after SQLPrepare.

  According to [ODBC spec](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlprepare-function?view=sql-server-ver17),
errors in SQLPrepare MAY be 'delayed':
'''
Some drivers cannot return syntax errors or access violations when the
application calls SQLPrepare. A driver can handle syntax errors and
access violations, only syntax errors, or neither syntax errors nor
access violations. Therefore, an application must be able to handle
these conditions when calling subsequent related functions such as
SQLNumResultCols, SQLDescribeCol, SQLColAttribute, and SQLExecute.
'''
  Unfortunately, I could not find a list of such drivers, but I found
that popular drivers, supplied by Microsoft themselves, indeed 'delay'
some (not all!) errors. (I tested 'SQL Server Native Client 11.0' and
'ODBC Driver 17 for SQL Server' with SQL Server 2016).
  So, I've add another check for error in the `bindParam` function,
since it's the first function calling ODBC functions after `SQLPrepare`.
@supersonic-copycat supersonic-copycat changed the title add chech for 'delayed' error add check for 'delayed' error Mar 31, 2026
@supersonic-copycat

Copy link
Copy Markdown
Contributor Author

Changes are small and trivial, and they should not break anything, but I did no testing with other drivers/DBs available to me. I can do it, though

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