aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/src/odbc.erl
diff options
context:
space:
mode:
authorBernard Duggan <[email protected]>2012-07-25 17:36:40 +1000
committerHenrik Nord <[email protected]>2012-12-04 10:49:39 +0100
commit66c6cede2b5039ca05ad57d3da3b76a5b8e9da47 (patch)
tree073042ea7f65bc7791445edecfa789deb80412cb /lib/odbc/src/odbc.erl
parentb563c7967185969e0607a4139a2132312581ff08 (diff)
downloadotp-66c6cede2b5039ca05ad57d3da3b76a5b8e9da47.tar.gz
otp-66c6cede2b5039ca05ad57d3da3b76a5b8e9da47.tar.bz2
otp-66c6cede2b5039ca05ad57d3da3b76a5b8e9da47.zip
Add extended_errors option to ODBC
This patch adds the extended_errors option to odbc:connect/2. When enabled, this option alters the return code of ODBC operations that produce errors to include the ODBC error code as well as the native error code, in addition to the ODBC reason field which is returned by default. The extended error information can be used to produce more sophisticated error handling than is possible with the standard ODBC Reason alone.
Diffstat (limited to 'lib/odbc/src/odbc.erl')
-rw-r--r--lib/odbc/src/odbc.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl
index 16fdb4aabd..3eabec9ec3 100644
--- a/lib/odbc/src/odbc.erl
+++ b/lib/odbc/src/odbc.erl
@@ -810,10 +810,11 @@ connect(ConnectionReferense, ConnectionStr, Options) ->
{C_TupleRow, _} =
connection_config(tuple_row, Options),
{BinaryStrings, _} = connection_config(binary_strings, Options),
+ {ExtendedErrors, _} = connection_config(extended_errors, Options),
ODBCCmd =
[?OPEN_CONNECTION, C_AutoCommitMode, C_TraceDriver,
- C_SrollableCursors, C_TupleRow, BinaryStrings, ConnectionStr],
+ C_SrollableCursors, C_TupleRow, BinaryStrings, ExtendedErrors, ConnectionStr],
%% Send request, to open a database connection, to the control process.
case call(ConnectionReferense,
@@ -860,6 +861,8 @@ connection_default(trace_driver) ->
connection_default(scrollable_cursors) ->
{?ON, on};
connection_default(binary_strings) ->
+ {?OFF, off};
+connection_default(extended_errors) ->
{?OFF, off}.
%%-------------------------------------------------------------------------