From 065a54e7a0be98e8dc9842616b267c0e8fbeb318 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Tue, 9 Mar 2010 13:11:42 +0000 Subject: OTP-7452 Support for SQL_WCHAR, SQL_WVARCHAR and strings as binaries ODBC now handles the types SQL_WCHAR and SQL_WVARCHAR. ODBC also has a new connection option to return all strings as binaries and also expect strings to be binaries in the param_query function. This provides some but not a full unicode support. --- lib/odbc/doc/src/databases.xml | 26 +++++++++++++++-------- lib/odbc/doc/src/error_handling.xml | 16 ++++----------- lib/odbc/doc/src/notes.xml | 19 +++++++++++++++++ lib/odbc/doc/src/odbc.xml | 41 ++++++++++++++++++++++--------------- 4 files changed, 65 insertions(+), 37 deletions(-) (limited to 'lib/odbc/doc') diff --git a/lib/odbc/doc/src/databases.xml b/lib/odbc/doc/src/databases.xml index c06327e11d..2c1b932084 100644 --- a/lib/odbc/doc/src/databases.xml +++ b/lib/odbc/doc/src/databases.xml @@ -4,7 +4,7 @@
- 20022009 + 20022010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + Databases @@ -117,7 +117,11 @@ SQL_CHAR(size) - String + String | Binary (configurable) + + + SQL_WCHAR(size) + Unicode binary encoded as UTF16 little endian. SQL_NUMERIC(p,s)

@@ -171,7 +175,11 @@ when p >= 16
SQL_VARCHAR(size) - String + String | Binary (configurable) + + + SQL_WVARCHAR(size) + Unicode binary encoded as UTF16 little endian. Mapping of ODBC data types to the Erlang data types returned to the Erlang application. @@ -194,19 +202,19 @@ when p >= 16 SQL_LONGVARCHAR - String + String | Binary (configurable) SQL_BINARY - String + String | Binary (configurable) SQL_VARBINARY - String + String | Binary (configurable) SQL_LONGVARBINARY - String + String | Binary (configurable) SQL_TINYINT diff --git a/lib/odbc/doc/src/error_handling.xml b/lib/odbc/doc/src/error_handling.xml index 26ad7f9848..c30acc5fdc 100644 --- a/lib/odbc/doc/src/error_handling.xml +++ b/lib/odbc/doc/src/error_handling.xml @@ -4,7 +4,7 @@
- 20032009 + 20032010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + Error handling @@ -126,15 +126,7 @@ c-process will exit. If the c-process crashes/exits it will bring the erlang-process down too and vice versa i.e. the connection is terminated.

- -

The function connect/2 will start the odbc application if - that is not already done. In this case a supervisor information - log will be produced stating that the odbc application was started - as a temporary application. It is really the responsibility of the - application that uses the API too make sure it is started in the - desired way.

-
- +
Error types

The types of errors that may occur can be divide into the diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml index 99584efec9..29fed0e286 100644 --- a/lib/odbc/doc/src/notes.xml +++ b/lib/odbc/doc/src/notes.xml @@ -30,6 +30,25 @@

This document describes the changes made to the odbc application.

+ +
ODBC 2.10.8 + +
Improvements and New Features + + +

+ ODBC now handles the types SQL_WCHAR and SQL_WVARCHAR. + ODBC also has a new connection option to return all + strings as binaries and also expect strings to be + binaries in the param_query function. This provides some + but not a full unicode support.

+

+ Own Id: OTP-7452

+
+
+
+ +
ODBC 2.10.7 diff --git a/lib/odbc/doc/src/odbc.xml b/lib/odbc/doc/src/odbc.xml index 450531c81c..3efbac8dd4 100644 --- a/lib/odbc/doc/src/odbc.xml +++ b/lib/odbc/doc/src/odbc.xml @@ -4,7 +4,7 @@
- 19992009 + 19992010 Ericsson AB. All Rights Reserved. @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + odbc @@ -101,7 +101,7 @@ odbc_data_type() = sql_integer | sql_smallint | sql_tinyint | {sql_decimal, precision(), scale()} | {sql_numeric, precision(), scale()} | - {sql_char, size()} | {sql_varchar, size()} | {sql_float, precision()} | + {sql_char, size()} | {sql_wchar, size()} | {sql_varchar, size()} | {sql_wvarchar, size()}| {sql_float, precision()} | {sql_float, precision()} | sql_real | sql_double | sql_bit | atom() @@ -141,16 +141,9 @@ An example of a connection string:"DSN=sql-server;UID=aladdin;PWD=sesame"where DSN is your ODBC Data Source Name, UID is a database user id and PWD is the password for that user. These are usually the attributes required in the connection string, but some drivers have other driver specific attributes, for example"DSN=Oracle8;DBQ=gandalf;UID=aladdin;PWD=sesame"where DBQ is your TNSNAMES.ORA entry name e.g. some Oracle specific configuration attribute. Options = [] | [option()] All options has default values. - option() = {auto_commit, auto_commit_mode()} | {timeout, milliseconds()} | {tuple_row, tuple_mode()} | {scrollable_cursors, use_scrollable_cursors()} | {trace_driver, trace_mode()} - The default timeout is infinity - auto_commit_mode() = on | off - Default is on. - tuple_mode() = on | off - Default is on. The option is deprecated and should not be used in new code. - use_scrollable_cursors() = on | off - Default is on. - trace_mode() = on | off - Default is off. + option() = {auto_commit, on | off} | {timeout, milliseconds()} + | {binary_strings, on | off} | {tuple_row, on | off} | {scrollable_cursors, on | off} | + {trace_driver, on | off} Ref = connection_reference() - should be used to access the connection. Reason = port_program_executable_not_found | common_reason() @@ -161,21 +154,36 @@ to handle the connection. These processes will terminate if the process that created the connection dies or if you call disconnect/1.

-

If automatic commit mode is turned on, each query will be + +

If automatic commit mode is turned on, each query will be considered as an individual transaction and will be automatically committed after it has been executed. If you want more than one query to be part of the same transaction the automatic commit mode should be turned off. Then you will have to call commit/3 explicitly to end a transaction.

+ +

The default timeout is infinity

+ +

>If the option binary_strings is turned on all strings + will be returned as binaries and strings inputed to + param_query will be expected to be binaries. The user needs + to ensure that the binary is in an encoding that the + database expects. By default this option is turned off.

+

As default result sets are returned as a lists of tuples. The TupleMode option still exists to keep some degree of backwards compatibility. If the option is set to off, result sets will be returned as a lists of lists instead of a lists of tuples.

+

Scrollable cursors are nice but causes some overhead. For some connections speed might be more important than flexible data access and then you can disable scrollable cursor for a - connection, limiting the API but gaining speed

+ connection, limiting the API but gaining speed.

+ +

Turning the scrollable_cursors option off is noted + to make old odbc-drivers able to connect that will otherwhise fail.

+

If trace mode is turned on this tells the ODBC driver to write a trace log to the file SQL.LOG that is placed in the current directory of the erlang emulator. This information @@ -183,6 +191,7 @@ erlang ODBC application, and it might be relevant for you to send this file to our support. Otherwise you will probably not have much use of this.

+

For more information about the ConnectStr see description of the function SQLDriverConnect in [1].

-- cgit v1.2.3