add check for 'delayed' error#51
Open
supersonic-copycat wants to merge 1 commit into
Open
Conversation
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`.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to ODBC spec, errors in SQLPrepare MAY be 'delayed':
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
bindParamfunction, since it's the first function calling ODBC functions afterSQLPrepare.