aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/doc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/odbc/doc')
-rw-r--r--lib/odbc/doc/html/.gitignore0
-rw-r--r--lib/odbc/doc/man3/.gitignore0
-rw-r--r--lib/odbc/doc/man6/.gitignore0
-rw-r--r--lib/odbc/doc/pdf/.gitignore0
-rw-r--r--lib/odbc/doc/src/Makefile221
-rw-r--r--lib/odbc/doc/src/book.gifbin0 -> 1081 bytes
-rw-r--r--lib/odbc/doc/src/book.xml49
-rw-r--r--lib/odbc/doc/src/databases.xml275
-rw-r--r--lib/odbc/doc/src/error_handling.xml174
-rw-r--r--lib/odbc/doc/src/fascicules.xml19
-rw-r--r--lib/odbc/doc/src/getting_started.xml248
-rw-r--r--lib/odbc/doc/src/introduction.xml74
-rw-r--r--lib/odbc/doc/src/make.dep27
-rw-r--r--lib/odbc/doc/src/note.gifbin0 -> 1539 bytes
-rw-r--r--lib/odbc/doc/src/notes.gifbin0 -> 2005 bytes
-rw-r--r--lib/odbc/doc/src/notes.xml492
-rw-r--r--lib/odbc/doc/src/notes_history.xml235
-rw-r--r--lib/odbc/doc/src/odbc.gifbin0 -> 15184 bytes
-rw-r--r--lib/odbc/doc/src/odbc.xml455
-rw-r--r--lib/odbc/doc/src/odbc_app_arc.fig76
-rw-r--r--lib/odbc/doc/src/odbc_app_arc.gifbin0 -> 4179 bytes
-rw-r--r--lib/odbc/doc/src/odbc_app_arc.ps284
-rw-r--r--lib/odbc/doc/src/odbc_index.gifbin0 -> 15184 bytes
-rw-r--r--lib/odbc/doc/src/part.xml41
-rw-r--r--lib/odbc/doc/src/part_notes.xml40
-rw-r--r--lib/odbc/doc/src/part_notes_history.xml34
-rw-r--r--lib/odbc/doc/src/ref_man.gifbin0 -> 1530 bytes
-rw-r--r--lib/odbc/doc/src/ref_man.xml41
-rw-r--r--lib/odbc/doc/src/user_guide.gifbin0 -> 1581 bytes
-rw-r--r--lib/odbc/doc/src/warning.gifbin0 -> 1498 bytes
30 files changed, 2785 insertions, 0 deletions
diff --git a/lib/odbc/doc/html/.gitignore b/lib/odbc/doc/html/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/odbc/doc/html/.gitignore
diff --git a/lib/odbc/doc/man3/.gitignore b/lib/odbc/doc/man3/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/odbc/doc/man3/.gitignore
diff --git a/lib/odbc/doc/man6/.gitignore b/lib/odbc/doc/man6/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/odbc/doc/man6/.gitignore
diff --git a/lib/odbc/doc/pdf/.gitignore b/lib/odbc/doc/pdf/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/odbc/doc/pdf/.gitignore
diff --git a/lib/odbc/doc/src/Makefile b/lib/odbc/doc/src/Makefile
new file mode 100644
index 0000000000..136ddfb980
--- /dev/null
+++ b/lib/odbc/doc/src/Makefile
@@ -0,0 +1,221 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 1999-2009. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# 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.
+#
+# %CopyrightEnd%
+#
+
+#
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+include ../../vsn.mk
+VSN=$(ODBC_VSN)
+APPLICATION=odbc
+
+# ----------------------------------------------------
+# Include dependency
+# ----------------------------------------------------
+
+ifndef DOCSUPPORT
+include make.dep
+endif
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+XML_APPLICATION_FILES = ref_man.xml
+XML_REF3_FILES = odbc.xml
+
+XML_PART_FILES = part.xml \
+ part_notes.xml \
+ part_notes_history.xml
+
+XML_HTML_FILES = \
+ notes_history.xml
+
+XML_CHAPTER_FILES = \
+ introduction.xml \
+ getting_started.xml \
+ databases.xml \
+ error_handling.xml \
+ notes.xml
+
+BOOK_FILES = book.xml
+
+GIF_FILES = \
+ book.gif \
+ odbc.gif \
+ note.gif \
+ notes.gif \
+ ref_man.gif \
+ user_guide.gif \
+ odbc_app_arc.gif
+
+# ----------------------------------------------------
+
+HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
+ $(XML_HTML_FILES:%.xml=$(HTMLDIR)/%.html) \
+ $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) \
+
+INFO_FILE = ../../info
+EXTRA_FILES = $(DEFAULT_GIF_FILES) \
+ $(DEFAULT_HTML_FILES) \
+ $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \
+ $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html)
+
+MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3)
+
+ifdef DOCSUPPORT
+
+HTML_REF_MAN_FILE = $(HTMLDIR)/index.html
+
+TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf
+
+else
+
+TEX_FILES_BOOK = \
+ $(BOOK_FILES:%.xml=%.tex)
+TEX_FILES_REF_MAN = $(XML_REF3_FILES:%.xml=%.tex) \
+ $(XML_APPLICATION_FILES:%.xml=%.tex)
+TEX_FILES_USERS_GUIDE = \
+ $(XML_CHAPTER_FILES:%.xml=%.tex)
+
+TOP_PDF_FILE = $(APPLICATION)-$(VSN).pdf
+TOP_PS_FILE = $(APPLICATION)-$(VSN).ps
+
+$(TOP_PDF_FILE): book.dvi ../../vsn.mk
+ $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@
+
+$(TOP_PS_FILE): book.dvi ../../vsn.mk
+ $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@
+
+endif
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+XML_FLAGS +=
+DVIPS_FLAGS +=
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+
+$(HTMLDIR)/%.gif: %.gif # Copy them to ../html
+ $(INSTALL_DATA) $< $@
+
+ifdef DOCSUPPORT
+
+docs: pdf html man
+
+$(TOP_PDF_FILE): $(XML_FILES)
+
+pdf: $(TOP_PDF_FILE)
+
+html: gifs $(HTML_REF_MAN_FILE)
+
+clean clean_docs:
+ rm -rf $(HTMLDIR)/*
+ rm -f $(MAN3DIR)/*
+ rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo)
+ rm -f errs core *~
+
+else
+
+ifeq ($(DOCTYPE),pdf)
+docs: pdf
+else
+ifeq ($(DOCTYPE),ps)
+docs: ps
+else
+docs: html gifs man
+endif
+endif
+
+pdf: $(TOP_PDF_FILE)
+
+ps: $(TOP_PS_FILE)
+
+html: $(HTML_FILES)
+
+clean clean_docs clean_tex:
+ rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_REF_MAN) $(TEX_FILES_BOOK)
+ rm -f $(HTML_FILES) $(MAN3_FILES)
+ rm -f $(TOP_PDF_FILE) $(TOP_PS_FILE)
+ rm -f errs core *~ *xmls_output *xmls_errs $(LATEX_CLEAN)
+
+endif
+
+man: $(MAN3_FILES)
+
+gifs: $(GIF_FILES:%=$(HTMLDIR)/%) # We depend just to copy them to ../html
+
+debug opt:
+
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+ifdef DOCSUPPORT
+
+release_docs_spec: docs
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf
+ $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(HTMLDIR)/* \
+ $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR)
+ $(INSTALL_DIR) $(RELEASE_PATH)/man/man3
+ $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3
+else
+
+ifeq ($(DOCTYPE),pdf)
+release_docs_spec: pdf
+ $(INSTALL_DIR) $(RELEASE_PATH)/pdf
+ $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf
+else
+ifeq ($(DOCTYPE),ps)
+release_docs_spec: ps
+ $(INSTALL_DIR) $(RELEASE_PATH)/ps
+ $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps
+else
+release_docs_spec: docs
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \
+ $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR)
+ $(INSTALL_DIR) $(RELEASE_PATH)/man/man3
+ $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3
+endif
+endif
+
+endif
+
+release_spec:
+
+
+
+
diff --git a/lib/odbc/doc/src/book.gif b/lib/odbc/doc/src/book.gif
new file mode 100644
index 0000000000..94b3868792
--- /dev/null
+++ b/lib/odbc/doc/src/book.gif
Binary files differ
diff --git a/lib/odbc/doc/src/book.xml b/lib/odbc/doc/src/book.xml
new file mode 100644
index 0000000000..05e16b512a
--- /dev/null
+++ b/lib/odbc/doc/src/book.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE book SYSTEM "book.dtd">
+
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header titlestyle="normal">
+ <copyright>
+ <year>1999</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Erlang ODBC</title>
+ <prepared>Ingvar Meyer</prepared>
+ <docno></docno>
+ <date></date>
+ <rev>A</rev>
+ <file>book.sgml</file>
+ </header>
+ <insidecover>
+ </insidecover>
+ <pagetext>Erlang ODBC</pagetext>
+ <preamble>
+ <contents level="2"></contents>
+ </preamble>
+ <parts lift="no">
+ <xi:include href="part.xml"/>
+ </parts>
+ <applications>
+ <xi:include href="ref_man.xml"/>
+ </applications>
+ <releasenotes>
+ <xi:include href="notes.xml"/>
+ </releasenotes>
+ <index></index>
+</book>
+
+
diff --git a/lib/odbc/doc/src/databases.xml b/lib/odbc/doc/src/databases.xml
new file mode 100644
index 0000000000..c06327e11d
--- /dev/null
+++ b/lib/odbc/doc/src/databases.xml
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2002</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Databases</title>
+ <prepared>Ingela Anderton</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date></date>
+ <rev></rev>
+ <file>databases.xml</file>
+ </header>
+
+ <section>
+ <title>Databases</title>
+ <p>If you need to access a relational database such as
+ <c>sqlserver</c>, <c>mysql</c>, <c>postgres</c>, <c>oracle</c>,
+ <c>cybase</c> etc. from your erlang application using the Erlang
+ ODBC interface is a good way to go about it.</p>
+ <p></p>
+ <p>The Erlang ODBC application should work for any relational
+ database that has an ODBC driver. But currently it is only
+ regularly tested for <c>sqlserver</c> and <c>postgres</c>.</p>
+ </section>
+
+ <section>
+ <title>Database independence </title>
+ <p>The Erlang ODBC interface is in principal database
+ independent, e.i. an erlang program using the interface could be
+ run without changes towards different databases. But as SQL is
+ used it is alas possible to write database dependent
+ programs. Even though SQL is an ANSI-standard meant to be
+ database independent, different databases have proprietary
+ extensions to SQL defining their own data types. If you keep to
+ the ANSI data types you will minimize the problem. But
+ unfortunately there is no guarantee that all databases actually
+ treats the ANSI data types equivalently. For instance an
+ installation of <c>Oracle Enterprise release 8.0.5.0.0 for unix</c> will accept that you create a table column with the
+ ANSI data type <c>integer</c>, but when retrieving values from
+ this column the driver reports that it is of type
+ <c>SQL_DECIMAL(0, 38)</c> and not <c>SQL_INTEGER</c> as you may have
+ expected. </p>
+ <p>Another obstacle is that some drivers do not support scrollable
+ cursors which has the effect that the only way to traverse the
+ result set is sequentially, with next, from the first row to the
+ last, and once you pass a row you can not go back. This means
+ that some functions in the interface will not work together with
+ certain drivers. A similar problem is that not all drivers
+ support "row count" for select queries, hence resulting in that
+ the function <c>select_count/[3,4]</c> will return <c>{ok, undefined}</c> instead of <c>{ok, NrRows}</c> where
+ <c>NrRows</c> is the number of rows in the result set.</p>
+ </section>
+
+ <section>
+ <title>Data types </title>
+ <p>The following is a list of the ANSI data types. For details
+ turn to the ANSI standard documentation. Usage of other data types
+ is of course possible, but you should be aware that this makes your
+ application dependent on the database you are using at the moment.</p>
+ <list type="bulleted">
+ <item>CHARACTER (size), CHAR (size)</item>
+ <item>NUMERIC (precision, scale), DECIMAL (precision, scale), DEC
+ (precision, scale ) precision - total number of digits, scale
+ - total number of decimal places</item>
+ <item>INTEGER, INT, SMALLINT</item>
+ <item>FLOAT (precision)</item>
+ <item>REAL</item>
+ <item>DOUBLE PRECISION</item>
+ <item>CHARACTER VARYING(size), CHAR VARYING(size)</item>
+ </list>
+ <p>When inputting data using sql_query/[2,3] the values will
+ always be in string format as they are part of an SQL-query.
+ Example:</p>
+ <code type="none">
+ odbc:sql_query(Ref, "INSERT INTO TEST VALUES(1, 2, 3)").
+ </code>
+ <note>
+ <p>Note that when the value of the data to input is a string, it
+ has to be quoted with <c>'</c>. Example: </p>
+ <code type="none">
+\011odbc:sql_query(Ref, "INSERT INTO EMPLOYEE VALUES(1, 'Jane', 'Doe', 'F')").
+ </code>
+ </note>
+ <p>You may also input data using <seealso marker="odbc#param_query">param_query/[3,4]</seealso> and then
+ the input data will have the Erlang type corresponding to the
+ ODBC type of the column.<seealso marker="#type">See ODBC to Erlang mapping</seealso></p>
+ <p> <marker id="type"></marker>
+ When selecting data from a table, all data
+ types are returned from the database to the ODBC driver as an
+ ODBC data type. The tables below shows the mapping between those
+ data types and what is returned by the Erlang API.</p>
+ <table>
+ <row>
+ <cell align="left" valign="middle">ODBC Data Type </cell>
+ <cell align="left" valign="middle">Erlang Data Type </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_CHAR(size)</cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_NUMERIC(p,s) <br></br>
+when (p >= 0 and p &lt;= 9 and s == 0) </cell>
+ <cell align="left" valign="middle">Integer </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_NUMERIC(p,s) <br></br>
+when (p >= 10 and p &lt;= 15 and s == 0) or (s &lt;= 15 and s > 0)</cell>
+ <cell align="left" valign="middle">Float </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_NUMERIC(p,s) <br></br>
+when p >= 16 </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_DECIMAL(p,s) <br></br>
+when (p >= 0 and p &lt;= 9 and s == 0) </cell>
+ <cell align="left" valign="middle">Integer </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_DECIMAL(p,s) <br></br>
+when (p >= 10 and p &lt;= 15 and s == 0) or (s &lt;= 15 and s > 0)</cell>
+ <cell align="left" valign="middle">Float </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_DECIMAL(p,s) <br></br>
+when p >= 16 </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_INTEGER </cell>
+ <cell align="left" valign="middle">Integer </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_SMALLINT </cell>
+ <cell align="left" valign="middle">Integer </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_FLOAT </cell>
+ <cell align="left" valign="middle">Float </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_REAL </cell>
+ <cell align="left" valign="middle">Float </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_DOUBLE</cell>
+ <cell align="left" valign="middle">Float</cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_VARCHAR(size) </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <tcaption>Mapping of ODBC data types to the Erlang data types returned to the Erlang application.</tcaption>
+ </table>
+ <table>
+ <row>
+ <cell align="left" valign="middle">ODBC Data Type </cell>
+ <cell align="left" valign="middle">Erlang Data Type </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_TYPE_DATE </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_TYPE_TIME </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_TYPE_TIMESTAMP </cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_LONGVARCHAR </cell>
+ <cell align="left" valign="middle">String</cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_BINARY</cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_VARBINARY</cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_LONGVARBINARY</cell>
+ <cell align="left" valign="middle">String </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_TINYINT </cell>
+ <cell align="left" valign="middle">Integer </cell>
+ </row>
+ <row>
+ <cell align="left" valign="middle">SQL_BIT</cell>
+ <cell align="left" valign="middle">Boolean </cell>
+ </row>
+ <tcaption>Mapping of extended ODBC data types to the Erlang data types returned to the Erlang application.</tcaption>
+ </table>
+ <note>
+ <p>To find out which data types will be returned for the
+ columns in a table use the function <seealso marker="odbc#describe_table">describe_table/[2,3]</seealso></p>
+ </note>
+ </section>
+
+ <section>
+ <title>Batch handling</title>
+ <p>Grouping of SQL queries can be desirable in order to reduce
+ network traffic. Another benefit can be that the data source
+ sometimes can optimize execution of a batch of SQL queries.</p>
+ <p>Explicit batches an procedures described below will result
+ in multiple results being returned from sql_query/[2,3].
+ while with parameterized queries only one result will be returned
+ from param_query/[2,3].</p>
+
+ <section>
+ <title>Explicit batches</title>
+ <p>The most basic form of a batch is created by semicolons
+ separated SQL queries, for example:</p>
+ <code type="none">
+"SELECT * FROM FOO; SELECT * FROM BAR" or
+"INSERT INTO FOO VALUES(1,'bar'); SELECT * FROM FOO"
+ </code>
+ </section>
+
+ <section>
+ <title>Procedures </title>
+ <p>Different databases may also support creating of procedures
+ that contains more than one SQL query. For example, the
+ following SQLServer-specific statement creates a procedure that
+ returns a result set containing information about employees
+ that work at the department and and a result set listing the
+ customers of that department. </p>
+ <code type="none">
+ CREATE PROCEDURE DepartmentInfo (@DepartmentID INT) AS
+\011SELECT * FROM Employee WHERE department = @DepartmentID
+\011SELECT * FROM Customers WHERE department = @DepartmentID
+ </code>
+ </section>
+
+ <section>
+ <title>Parameterized queries</title>
+ <p>To effectively perform a batch of similar queries, you can use
+ parameterized queries. This means that you in your SQL query
+ string will mark the places that usually would contain values
+ with question marks and then provide lists of values for each
+ parameter. For instance you can use this to insert multiple
+ rows into the <c>EMPLOYEE</c> table while executing only a
+ single SQL statement, for example code see <seealso marker="getting_started#param_query">"Using the Erlang API"</seealso> section in the "Getting Started" chapter.</p>
+ </section>
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/error_handling.xml b/lib/odbc/doc/src/error_handling.xml
new file mode 100644
index 0000000000..26ad7f9848
--- /dev/null
+++ b/lib/odbc/doc/src/error_handling.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2003</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Error handling</title>
+ <prepared>Ingela Anderton</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date></date>
+ <rev></rev>
+ <file>error_handling.xml</file>
+ </header>
+
+ <section>
+ <title>Strategy </title>
+ <p>On a conceptual level starting a database connection using the
+ Erlang ODBC API is a basic client server application. The client
+ process uses the API to start and communicate with the server
+ process that manages the connection. The strategy of the Erlang
+ ODBC application is that programming faults in the application
+ itself will cause the connection process to terminate
+ abnormally.(When a process terminates abnormally its supervisor
+ will log relevant error reports.) Calls to API functions during or
+ after termination of the connection process, will return <c>{error, connection_closed}</c>. Contextual errors on the other
+ hand will not terminate the connection it will only return
+ <c>{error, Reason} </c> to the client, where <c>Reason</c> may be
+ any erlang term.</p>
+
+ <section>
+ <title>Clients </title>
+ <p>The connection is associated with the process that created it
+ and can only be accessed through it. The reason for this is to
+ preserve the semantics of result sets and transactions when
+ select_count/[2,3] is called or auto_commit is turned off.
+ Attempts to use the connection from another process will
+ fail. This will not effect the connection. On the other hand, if
+ the client process dies the connection will be terminated.</p>
+ </section>
+
+ <section>
+ <title>Timeouts </title>
+ <p>All request made by the client to the connection are
+ synchronous. If the timeout is used and expires the client
+ process will exit with reason timeout. Proably the right thing
+ to do is let the client die and perhaps be restarted by its
+ supervisor. But if the client chooses to catch this timeout,
+ it is a good idea to wait a little while before trying
+ again. If there are too many consecutive timeouts that are
+ caught the connection process will conclude that there is
+ something radically wrong and terminate the connection.</p>
+ </section>
+
+ <section>
+ <title>Gaurds </title>
+ <p>All API-functions are guarded and if you pass an argument of
+ the wrong type a runtime error will occur. All input parameters
+ to internal functions are trusted to be correct. It is a good
+ programming practise to only distrust input from truly external
+ sources. You are not supposed to catch these errors, it will
+ only make the code very messy and much more complex, which
+ introduces more bugs and in the worst case also covers up the
+ actual faults. Put your effort on testing instead, you should
+ trust your own input.</p>
+ </section>
+ </section>
+
+ <section>
+ <title>The whole picture </title>
+ <p>As the Erlang ODBC application relies on third party products
+ and communicates with a database that probably runs on an other
+ computer in the network there are plenty of things that might go
+ wrong. To fully understand the things that might happen it
+ facilitate to know the design of the Erlang ODBC application,
+ hence here follows a short description of the current design.</p>
+ <note>
+ <p>Please note that design is something, that not
+ necessarily will, but might change in future releases. While the
+ semantics of the API will not change as it is independent of the
+ implementation.</p>
+ </note>
+ <image file="odbc_app_arc.gif">
+ <icaption>Architecture of the Erlang odbc application</icaption>
+ </image>
+ <p>When you do application:start(odbc) the only thing that
+ happens is that a supervisor process is started. For each call
+ to the API function connect/2 a process is spawned and added as
+ a child to the Erlang ODBC supervisor. The supervisors only
+ tasks are to provide error-log reports, if a child process should
+ die abnormally, and the possibility to do a code change. Only
+ the client process has the knowledge to decide if this
+ connection managing process should be restarted.</p>
+ <p>The erlang connection process spawned by connect/2, will open a
+ port to a c-process that handles the communication with the
+ database through Microsoft's ODBC API. The erlang port will be
+ kept open for exit signal propagation, if something goes wrong
+ in the c-process and it exits we want know as mush as possible
+ about the reason. The main communication with the c-process is
+ done through sockets. The C-process consists of two threads,
+ the supervisor thread and the database handler thread. The
+ supervisor thread checks for shutdown messages on the supervisor
+ socket and the database handler thread receives requests and sends
+ answers on the database socket. If the database thread seems to
+ hang on some database call, the erlang control process will send
+ a shutdown message on the supervisor socket, in this case the
+ 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.</p>
+ <note>
+ <p>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.</p>
+ </note>
+
+ <section>
+ <title>Error types</title>
+ <p>The types of errors that may occur can be divide into the
+ following categories.</p>
+ <list type="bulleted">
+ <item>Configuration problems - Everything from that the
+ database was not set up right to that the c-program that
+ should be run through the erlang port was not compiled for
+ your platform.</item>
+ <item>Errors discovered by the ODBC driver - If calls to the
+ ODBC-driver fails due to circumstances that can not be
+ controlled by the Erlang ODBC application programmer, an
+ error string will be dug up from the driver. This string
+ will be the <c>Reason</c> in the <c>{error, Reason} </c>
+ return value. How good this error message is will of course
+ be driver dependent. Examples of such circumstances are
+ trying to insert the same key twice, invalid SQL-queries and
+ that the database has gone off line.</item>
+ <item>Connection termination - If a connection is terminated
+ in an abnormal way, or if you try to use a connection that
+ you have already terminated in a normal way by calling
+ disconnect/1, the return value will be<c>{error, connection_closed}</c>. A connection could end abnormally
+ because of an programming error in the Erlang ODBC
+ application, but also if the ODBC driver crashes.</item>
+ <item>Contextual errors - If API functions are used in the
+ wrong context, the <c>Reason</c> in the error tuple will
+ be a descriptive atom. For instance if you try to call the
+ function <c>last/[1,2] </c> without first calling <c>select_count/[2,3] </c> to associate a result set with the
+ connection. If the ODBC-driver does not support some
+ functions, or if you disabled some functionality for a
+ connection and then try to use it.</item>
+ </list>
+ </section>
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/fascicules.xml b/lib/odbc/doc/src/fascicules.xml
new file mode 100644
index 0000000000..91d81d2ac1
--- /dev/null
+++ b/lib/odbc/doc/src/fascicules.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE fascicules SYSTEM "fascicules.dtd">
+
+<fascicules>
+ <fascicule file="part" href="part_frame.html" entry="no">
+ User's Guide
+ </fascicule>
+ <fascicule file="ref_man" href="ref_man_frame.html" entry="yes">
+ Reference Manual
+ </fascicule>
+ <fascicule file="part_notes" href="part_notes_frame.html" entry="no">
+ Release Notes
+ </fascicule>
+ <fascicule file="" href="../../../../doc/print.html" entry="no">
+ Off-Print
+ </fascicule>
+</fascicules>
+
+
diff --git a/lib/odbc/doc/src/getting_started.xml b/lib/odbc/doc/src/getting_started.xml
new file mode 100644
index 0000000000..864c3a7b65
--- /dev/null
+++ b/lib/odbc/doc/src/getting_started.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2002</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Getting started</title>
+ <prepared>Ingela Anderton Andin</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date></date>
+ <rev></rev>
+ <file>getting_started.xml</file>
+ </header>
+
+ <section>
+ <title>Setting things up </title>
+ <p>As the Erlang ODBC application is dependent on third party
+ products there are a few administrative things that needs to be
+ done before you can get things up and running.</p>
+ <p></p>
+ <list type="bulleted">
+ <item>The first thing you need to do, is to make sure you
+ have an ODBC driver installed for the database that you
+ want to access. Both the client machine where you plan to
+ run your erlang node and the server machine running the
+ database needs the the ODBC driver. (In some cases the
+ client and the server may be the same machine).</item>
+ <item>Secondly you might need to set environment variables
+ and paths to appropriate values. This may differ a lot
+ between different os's, databases and ODBC drivers. This
+ is a configuration problem related to the third party product
+ and hence we can not give you a standard solution in this guide.</item>
+ <item>The Erlang ODBC application consists of both <c>Erlang</c>
+ and <c>C</c> code. The <c>C</c> code is delivered as a
+ precompiled executable for windows, solaris and linux (SLES10) in the commercial
+ build. In the open source distribution it is built the
+ same way as all other application using configure and make.
+ You may want to provide the the path to your ODBC libraries
+ using --with-odbc=PATH. </item>
+ </list>
+ <note>
+ <p>The Erlang ODBC application should run on all Unix
+ dialects including Linux, Windows 2000, Windows XP and
+ NT. But currently it is only tested for Solaris, Windows
+ 2000, Windows XP and NT.</p>
+ </note>
+ </section>
+
+ <section>
+ <title>Using the Erlang API</title>
+ <p>The following dialog within the Erlang shell illustrates the
+ functionality of the Erlang ODBC interface. The table used in
+ the example does not have any relevance to anything that exist
+ in reality, it is just a simple example. The example was created
+ using <c>sqlserver 7.0 with servicepack 1</c> as database and
+ the ODBC driver for <c>sqlserver</c> with version
+ <c>2000.80.194.00</c>.</p>
+ <code type="none">
+ 1 > odbc:start().
+ ok </code>
+ <p>Connect to the database </p>
+ <code type="none"><![CDATA[
+ 2 > {ok, Ref} = odbc:connect("DSN=sql-server;UID=aladdin;PWD=sesame", []).
+ {ok,<0.342.0>} ]]></code>
+ <p>Create a table </p>
+ <code type="none">
+ 3 > odbc:sql_query(Ref, "CREATE TABLE EMPLOYEE (NR integer,
+ FIRSTNAME char varying(20), LASTNAME char varying(20), GENDER char(1),
+ PRIMARY KEY(NR))").
+ {updated,undefined} </code>
+ <p>Insert some data </p>
+ <code type="none">
+ 4 > odbc:sql_query(Ref, "INSERT INTO EMPLOYEE VALUES(1, 'Jane', 'Doe', 'F')").
+ {updated,1} </code>
+ <p>Check what data types the database assigned for the columns.
+ Hopefully this is not a surprise, some times it can be! These
+ are the data types that you should use if you want to do a
+ parameterized query.</p>
+ <code type="none">
+ 5 > odbc:describe_table(Ref, "EMPLOYEE").
+ {ok, [{"NR", sql_integer},
+ {"FIRSTNAME", {sql_varchar, 20}},
+ {"LASTNAME", {sql_varchar, 20}}
+ {"GENDER", {sql_char, 1}}]}
+ </code>
+ <p> <marker id="param_query"></marker>
+ Use a parameterized query
+ to insert many rows in one go. </p>
+ <code type="none">
+ 6 > odbc:param_query(Ref,"INSERT INTO EMPLOYEE (NR, FIRSTNAME, "
+\011 "LASTNAME, GENDER) VALUES(?, ?, ?, ?)",
+\011 [{sql_integer,[2,3,4,5,6,7,8]},
+\011 {{sql_varchar, 20},
+ ["John", "Monica", "Ross", "Rachel",
+ "Piper", "Prue", "Louise"]},
+\011 {{sql_varchar, 20},
+ ["Doe","Geller","Geller", "Green",
+ "Halliwell", "Halliwell", "Lane"]},
+\011 {{sql_char, 1}, ["M","F","M","F","F","F","F"]}]).
+ {updated, 7}
+ </code>
+ <p>Fetch all data in the table employee </p>
+ <code type="none">
+ 7> odbc:sql_query(Ref, "SELECT * FROM EMPLOYEE").
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],
+ [{1,"Jane","Doe","F"},
+ {2,"John","Doe","M"},
+ {3,"Monica","Geller","F"},
+ {4,"Ross","Geller","M"},
+ {5,"Rachel","Green","F"},
+ {6,"Piper","Halliwell","F"},
+ {7,"Prue","Halliwell","F"},
+ {8,"Louise","Lane","F"}]]} </code>
+ <p>Associate a result set containing the whole table
+ <c>EMPLOYEE</c> to the connection. The number of rows in the
+ result set is returned.</p>
+ <code type="none">
+ 8 > odbc:select_count(Ref, "SELECT * FROM EMPLOYEE").
+ {ok,8} </code>
+ <p>You can always traverse the result set sequential by using next</p>
+ <code type="none">
+ 9 > odbc:next(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{1,"Jane","Doe","F"}]}
+ </code>
+ <code type="none">
+ 10 > odbc:next(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{2,"John","Doe","M"}]}
+ </code>
+ <p>If your driver supports scrollable cursors you have a little
+ more freedom, and can do things like this. </p>
+ <code type="none">
+ 11 > odbc:last(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{8,"Louise","Lane","F"}]} </code>
+ <code type="none">
+ 12 > odbc:prev(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{7,"Prue","Halliwell","F"}]} </code>
+ <code type="none">
+ 13 > odbc:first(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{1,"Jane","Doe","F"}]} </code>
+ <code type="none">
+ 14 > odbc:next(Ref).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],[{2,"John","Doe","M"}]}
+ </code>
+ <p>Fetch the fields <c>FIRSTNAME </c> and <c>NR </c> for all female
+ employees</p>
+ <code type="none">
+ 15 > odbc:sql_query(Ref, "SELECT FIRSTNAME, NR FROM EMPLOYEE WHERE GENDER = 'F'").
+ {selected,["FIRSTNAME","NR"],
+ [{"Jane",1},
+ {"Monica",3},
+ {"Rachel",5},
+ {"Piper",6},
+ {"Prue",7},
+ {"Louise",8}]} </code>
+ <p>Fetch the fields <c>FIRSTNAME </c> and <c>NR </c> for all female
+ employees and sort them on the field <c>FIRSTNAME </c>. </p>
+ <code type="none">
+ 16 > odbc:sql_query(Ref, "SELECT FIRSTNAME, NR FROM EMPLOYEE WHERE GENDER = 'F'
+ ORDER BY FIRSTNAME").
+ {selected,["FIRSTNAME","NR"],
+ [{"Jane",1},
+ {"Louise",8},
+ {"Monica",3},
+ {"Piper",6},
+ {"Prue",7},
+ {"Rachel",5}]}
+ </code>
+ <p>Associate a result set that contains the fields <c>FIRSTNAME</c> and <c>NR </c> for all female employees to the
+ connection. The number of rows in the result set is
+ returned.</p>
+ <code type="none">
+ 17 > odbc:select_count(Ref, "SELECT FIRSTNAME, NR FROM EMPLOYEE WHERE GENDER = 'F'").
+ {ok,6} </code>
+ <p>A few more ways of retrieving parts of the result set when the
+ driver supports scrollable cursors. Note that next will work even
+ without support for scrollable cursors. </p>
+ <code type="none">
+ 18 > odbc:select(Ref, {relative, 2}, 3).
+ {selected,["FIRSTNAME","NR"],[{"Monica",3},{"Rachel",5},{"Piper",6}]}
+ </code>
+ <code type="none">
+ 19 > odbc:select(Ref, next, 2).
+ {selected,["FIRSTNAME","NR"],[{"Prue",7},{"Louise",8}]}
+ </code>
+ <code type="none">
+ 20 > odbc:select(Ref, {absolute, 1}, 2).
+ {selected,["FIRSTNAME","NR"],[{"Jane",1},{"Monica",3}]}
+ </code>
+ <code type="none">
+ 21 > odbc:select(Ref, next, 2).
+ {selected,["FIRSTNAME","NR"],[{"Rachel",5},{"Piper",6}]}
+ </code>
+ <code type="none">
+ 22 > odbc:select(Ref, {absolute, 1}, 4).
+ {selected,["FIRSTNAME","NR"],
+ [{"Jane",1},{"Monica",3},{"Rachel",5},{"Piper",6}]}
+ </code>
+ <p>Select, using a parameterized query. </p>
+ <code type="none">
+ 23 > odbc:param_query(Ref, "SELECT * FROM EMPLOYEE WHERE GENDER=?",
+ [{{sql_char, 1}, ["M"]}]).
+ {selected,["NR","FIRSTNAME","LASTNAME","GENDER"],
+ [{2,"John", "Doe", "M"},{4,"Ross","Geller","M"}]}
+ </code>
+ <p>Delete the table <c>EMPLOYEE</c>.</p>
+ <code type="none">
+ 24 > odbc:sql_query(Ref, "DROP TABLE EMPLOYEE").
+ {updated,undefined}
+ </code>
+ <p>Shut down the connection. </p>
+ <code type="none">
+ 25 > odbc:disconnect(Ref).
+ ok
+ </code>
+ <p>Shut down the application. </p>
+ <code type="none">
+ 26 > odbc:stop().
+ =INFO REPORT==== 7-Jan-2004::17:00:59 ===
+ application: odbc
+ exited: stopped
+ type: temporary
+
+ ok
+ </code>
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/introduction.xml b/lib/odbc/doc/src/introduction.xml
new file mode 100644
index 0000000000..8e9688c407
--- /dev/null
+++ b/lib/odbc/doc/src/introduction.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2002</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Introduction</title>
+ <prepared>Ingela Anderton</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date>2002-09-17</date>
+ <rev>A</rev>
+ <file>introduction.xml</file>
+ </header>
+
+ <section>
+ <title>Purpose</title>
+ <p>The purpose of the Erlang ODBC application is to provide the
+ programmer with an ODBC interface that has a Erlang/OTP touch and
+ feel. So that the programmer may concentrate on solving his/her
+ actual problem instead of struggling with pointers and memory
+ allocation which is not very relevant for Erlang. This user guide
+ will give you some information about technical issues and provide
+ some examples of how to use the Erlang ODBC interface.</p>
+ </section>
+
+ <section>
+ <title>Prerequisites</title>
+ <p>It is assumed that the reader is familiar with the Erlang
+ programming language, concepts of OTP and has a basic
+ understanding of relational databases and SQL.</p>
+ </section>
+
+ <section>
+ <title>About ODBC</title>
+ <p>Open Database Connectivity (ODBC) is a Microsoft standard for
+ accessing relational databases that has become widely used. The
+ ODBC standard provides a c-level application programming
+ interface (API) for database access. It uses Structured Query
+ Language (SQL) as its database access language.</p>
+ </section>
+
+ <section>
+ <title>About the Erlang ODBC application</title>
+ <p>Provides an Erlang interface to communicate with relational
+ SQL-databases. It is built on top of Microsofts ODBC interface and
+ therefore requires that you have an ODBC driver to the database
+ that you want to connect to. The Erlang ODBC application is designed
+ using the version 3.0 of the ODBC-standard, however using the option
+ <c>{scrollable_cursors, off} </c> for a connection has been known
+ to make it work for at least some 2.X drivers.</p>
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/make.dep b/lib/odbc/doc/src/make.dep
new file mode 100644
index 0000000000..d62e8dd8f0
--- /dev/null
+++ b/lib/odbc/doc/src/make.dep
@@ -0,0 +1,27 @@
+# ----------------------------------------------------
+# >>>> Do not edit this file <<<<
+# This file was automaticly generated by
+# /home/otp/bin/docdepend
+# ----------------------------------------------------
+
+
+# ----------------------------------------------------
+# TeX files that the DVI file depend on
+# ----------------------------------------------------
+
+book.dvi: book.tex databases.tex error_handling.tex \
+ getting_started.tex introduction.tex odbc.tex \
+ part.tex ref_man.tex
+
+# ----------------------------------------------------
+# Source inlined when transforming from source to LaTeX
+# ----------------------------------------------------
+
+book.tex: ref_man.xml
+
+# ----------------------------------------------------
+# Pictures that the DVI file depend on
+# ----------------------------------------------------
+
+book.dvi: odbc_app_arc.ps
+
diff --git a/lib/odbc/doc/src/note.gif b/lib/odbc/doc/src/note.gif
new file mode 100644
index 0000000000..6fffe30419
--- /dev/null
+++ b/lib/odbc/doc/src/note.gif
Binary files differ
diff --git a/lib/odbc/doc/src/notes.gif b/lib/odbc/doc/src/notes.gif
new file mode 100644
index 0000000000..e000cca26a
--- /dev/null
+++ b/lib/odbc/doc/src/notes.gif
Binary files differ
diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml
new file mode 100644
index 0000000000..1f9b3b4290
--- /dev/null
+++ b/lib/odbc/doc/src/notes.xml
@@ -0,0 +1,492 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2004</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>ODBC Release Notes</title>
+ <prepared>otp_appnotes</prepared>
+ <docno>nil</docno>
+ <date>nil</date>
+ <rev>nil</rev>
+ <file>notes.xml</file>
+ </header>
+ <p>This document describes the changes made to the odbc application.
+ </p>
+
+ <section><title>ODBC 2.10.6</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Applied a patch from Andrew Thompson, which fixes some
+ error cases.</p>
+ <p>
+ Own Id: OTP-8291</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ The documentation is now built with open source tools
+ (xsltproc and fop) that exists on most platforms. One
+ visible change is that the frames are removed.</p>
+ <p>
+ Own Id: OTP-8250</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section><title>ODBC 2.10.5</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ A missing return statement in a non void function has been fixed in <c>odbc</c>. (Thanks to Nico Kruber)
+ </p>
+ <p>
+ Own Id: OTP-7978</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+
+ <section><title>ODBC 2.10.4</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ param_query now handles the in_or_out parameter
+ correctly.</p>
+ <p>
+ Own Id: OTP-7720</p>
+ </item>
+ <item>
+ <p>
+ Changed the internal socket use so that it will become
+ more robust to non-functional ipv6 and fallback on ipv4.</p>
+ <p>
+ Own Id: OTP-7721</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section><title>ODBC 2.10.3</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Configure update for mac.</p>
+ <p>
+ Own Id: OTP-7418</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Known Bugs and Problems</title>
+ <list>
+ <item>
+ <p>
+ describe_table/[2,3] on mac gives an empty result</p>
+ <p>
+ Own Id: OTP-7478</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+ <section><title>ODBC 2.10.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ SQLINTEGERs where not retrieved correctly on 64 bit
+ platforms as an SQLINTEGER is defined to be a 32 bit
+ integer and not a true long.</p>
+ <p>
+ Own Id: OTP-7297</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section><title>ODBC 2.10.1</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Now supports out and input parameters for stored
+ procedures.</p>
+ <p>
+ Own Id: OTP-7019</p>
+ </item>
+ <item>
+ <p>
+ ODBC is now prebuilt for SLES10 in the commercial build
+ and parameters to error_logger:error_report/1 has been
+ corrected.</p>
+ <p>
+ Own Id: OTP-7294</p>
+ </item>
+ <item>
+ <p>
+ Parametrized queries will now work correctly when using
+ Erlang R12B-2 on Linux (SuSE 10.3), MySQL 5.0.45, myodbc
+ 3.51 and unixODBC 2.2.12. Earlier it could happen that an
+ error was returned even though data was correctly
+ inserted into the database.</p>
+ <p>
+ Own Id: OTP-7307</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Known Bugs and Problems</title>
+ <list>
+ <item>
+ <p>
+ SQLINTEGERs are not retrieved correctly on 64 bit
+ platforms as an SQLINTEGER seems to be defined to be a 32
+ bit integer and not a true long.</p>
+ <p>
+ Own Id: OTP-7297</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section><title>ODBC 2.10</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Enhanced configure to among other things work better when
+ there is a library found but it is not usable e.i. 32 bit
+ library in 64 bit build.</p>
+ <p>
+ Own Id: OTP-7062</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section><title>ODBC 2.0.9</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ The odbc application now has to be explicitly started and
+ stopped e.i. it will not automatically be started as a
+ temporary application as it did before. Although a
+ practical feature when testing things in the shell, it is
+ not desirable that people take advantage of this and not
+ start the odbc application in a correct way in their
+ products. Added functions to the odbc API that calls
+ application:start/stop.</p>
+ <p>
+ *** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>
+ Own Id: OTP-6984</p>
+ </item>
+ <item>
+ <p>
+ Changed Makefile.in so that odbc is not disabled on
+ 64-bits architectures. It was earlier disabled due to
+ that it had never been tested in that environment.</p>
+ <p>
+ Own Id: OTP-6987</p>
+ </item>
+ </list>
+ </section>
+
+ </section>
+
+ <section>
+ <title>ODBC 2.0.8</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Minor Makefile changes.</p>
+ <p>Own Id: OTP-6689</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>ODBC 2.0.7</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>When using a parameterized query on a windows platform
+ the data was inserted in the table on the sql-server but
+ the connection was lost, this seems to be due to a
+ compiler error that has now been worked around, but
+ further investigation is ongoing to verify that that
+ really was the problem.</p>
+ <p>Own Id: OTP-5504</p>
+ </item>
+ <item>
+ <p>param_query/[3,4] could return an unexpected row count
+ for some drivers, in this case a postgresdriver.</p>
+ <p>Own Id: OTP-6363</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>ODBC 2.0.6</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>pthread header and library mismatch on linux systems (at
+ least some SuSE and Debian) with both NPTL and
+ Linuxthreads libraries installed.</p>
+ <p>Own Id: OTP-5981</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Changed configure to find odbc in /usr/local too</p>
+ <p>Own Id: OTP-5966</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Known Bugs and Problems</title>
+ <list type="bulleted">
+ <item>
+ <p>When using a parameterized query on a windows platform
+ the data is inserted in the table on the sql-server but
+ for some reason the connection is lost.</p>
+ <p>Own Id: OTP-5504</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>ODBC 2.0.5</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>Fixed bug, reported error when deleting nonexisting rows,
+ thanks to Laura M. Castro for reporting this.</p>
+ <p>Own Id: OTP-5759</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Known Bugs and Problems</title>
+ <list type="bulleted">
+ <item>
+ <p>When using a parameterized query on a windows platform
+ the data is inserted in the table on the sql-server but
+ for some reason the connection is lost.</p>
+ <p>Own Id: OTP-5504</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>Odbc 2.0.4</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>/usr was added as a default place for configure to look
+ for the odbc library on unix/linux platforms.</p>
+ <p>Own Id: OTP-5501</p>
+ </item>
+ <item>
+ <p>A legacy timer in the c port program was set to infinity.
+ All timeout handling is handled by the erlang code and a
+ extra timeout in the c code will just lead to confusion
+ if it is released.</p>
+ <p>Own Id: OTP-5502</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Known Bugs and Problems</title>
+ <list type="bulleted">
+ <item>
+ <p>When using a parameterized query on a windows platform
+ the data is inserted in the table on the sql-server but
+ for some reason the connection is lost.</p>
+ <p>Own Id: OTP-5504</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>Odbc 2.0.3</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>odbc now uses configure as all "normal" applications
+ instead of providing special Makefiles for each
+ commercial supported platform. This also makes it easier
+ to build odbc on non supported platforms.</p>
+ <p>Own Id: OTP-5437</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 2.0.2</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>When issuing a batch of queries and one of the queries
+ fail the odbc port program crashed. This is no longer the
+ case.</p>
+ <p>Own Id: OTP-5176</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 2.0.1</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Added use of the socket option TCP_NODELAY, as in the
+ case of Erlang odbc the Nagel algorithm will never help,
+ but always cause an unnecessary delay.</p>
+ <p>Own Id: OTP-5100</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 2.0</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Erlang ODBC now handles batches of queries and can return
+ multiple result sets.</p>
+ <p>Own Id: OTP-4642 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>The old interface that became deprecated in odbc 1.0 has
+ now been removed.</p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Own Id: OTP-4794</p>
+ </item>
+ <item>
+ <p>The port program now sends different exit codes to Erlang
+ when it exits due to failure. This instead of sending the
+ same exit code and then trying to write to stderr. Erlang
+ encodes the exit code to a descriptive atom.</p>
+ <p>Own Id: OTP-4813</p>
+ </item>
+ <item>
+ <p>Erlang ODBC now supports parameterized queries for the
+ most common ODBC data types.</p>
+ <p>Own Id: OTP-4821</p>
+ </item>
+ <item>
+ <p>SQL_NUMERIC and SQL_DECIMAL columns are converted to
+ integer and float values if possible.</p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Own Id: OTP-4826</p>
+ </item>
+ <item>
+ <p>Result sets are now by default returned as a list of
+ tuples which is the most intuitive and useful mapping. To
+ keep some degree of backwards compatibility you may turn
+ this off to get the old behavior that result sets are
+ returned as lists of lists. However do not use this in
+ new code as it is considered a deprecated feature that
+ eventually will disappear.</p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Own Id: OTP-4850</p>
+ </item>
+ <item>
+ <p>The odbc implementation now mostly uses sockets to
+ communicate between the c and the erlang process, this is
+ to avoid a lot of problems arising from different
+ odbc-drivers doing strange things that disturbed the
+ port-program communication mechanism.</p>
+ <p>Own Id: OTP-4875</p>
+ </item>
+ </list>
+ </section>
+ <!-- p>For information about older versions see
+ <url href="part_notes_history_frame.html">release notes history</url>.</p -->
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/notes_history.xml b/lib/odbc/doc/src/notes_history.xml
new file mode 100644
index 0000000000..2ce6b18201
--- /dev/null
+++ b/lib/odbc/doc/src/notes_history.xml
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2004</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Older ODBC Release Notes</title>
+ <prepared>otp_appnotes</prepared>
+ <docno>nil</docno>
+ <date>nil</date>
+ <rev>nil</rev>
+ </header>
+
+ <section>
+ <title>odbc 1.0.6</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Error handling has been enhanced and better documented</p>
+ <p>Own Id: OTP-4661</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 1.0.5</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>Some error messages originating from the sql-driver where
+ corrupted so that odbc only returned the end of the error
+ message. This has now been fixed.</p>
+ <p>Own Id: OTP-4636 Aux Id: seq7766 </p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>The erlang odbc process will now die normally if a
+ connection can not be established. No connection no
+ process it is expected. And as the client has already
+ received the error message that would be the reason with
+ which the erlang process would be stopped, the supervisor
+ report will be superfluous. Naturally you may still get
+ supervisor reports if the erlang process is stopped for
+ any other reason than the above.</p>
+ <p>Own Id: OTP-4639 Aux Id: seq7766 </p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 1.0.4</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>API function commit/3 is now exported.</p>
+ <p>Own Id: OTP-4593 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>If an ODBC API function times out it will cause the
+ client to exit with reason timeout. If this exit was
+ caught and the client continued using the connection, the
+ next request could get the answer meant for the
+ previously timed out request, this is no longer the case.</p>
+ <p>Own Id: OTP-4606 Aux Id: seq7766 </p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Improved error messages so that the implementation not
+ shall shine through.</p>
+ <p>Added possibility to let a connection return rows as
+ tuples instead of lists.</p>
+ <p>Own Id: OTP-4605 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>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.</p>
+ <p>Own Id: OTP-4624</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 1.0</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>API function commit/3 is now exported.</p>
+ <p>Own Id: OTP-4593 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>If an ODBC API function times out it will cause the
+ client to exit with reason timeout. If this exit was
+ caught and the client continued using the connection, the
+ next request could get the answer meant for the
+ previously timed out request, this is no longer the case.</p>
+ <p>Own Id: OTP-4606 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>Some error messages originating from the sql-driver where
+ corrupted so that odbc only returned the end of the error
+ message. This has now been fixed.</p>
+ <p>Own Id: OTP-4636 Aux Id: seq7766 </p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>The Erlang ODBC application consists of both Erlang and C
+ code. The C code is delivered as a precompiled executable
+ for windows and solaris. For the purpose of recompilation
+ or compiling on some other platform there is a Makefile
+ included.</p>
+ <p>Own Id: OTP-4193 Aux Id: seq7190 </p>
+ </item>
+ <item>
+ <p>Expensive constructs such as lists:flatten/1, double
+ buffering and string compare has been replaced by more
+ efficient constructs or when possible totally eliminated.</p>
+ <p>Own Id: OTP-4362</p>
+ </item>
+ <item>
+ <p>New API that has an Erlang/OTP touch and feel instead of
+ being a C-interface with Erlang syntax. The old interface
+ is deprecated and will be removed in release R10.</p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Own Id: OTP-4498</p>
+ </item>
+ <item>
+ <p>API functions that became deprecated in version 0.9.1 has
+ been removed.</p>
+ <p>*** POTENTIAL INCOMPATIBILITY ***</p>
+ <p>Own Id: OTP-4499</p>
+ </item>
+ <item>
+ <p>Improved error messages so that the implementation not
+ shall shine through.</p>
+ <p>Added possibility to let a connection return rows as
+ tuples instead of lists.</p>
+ <p>Own Id: OTP-4605 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>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.</p>
+ <p>Own Id: OTP-4624</p>
+ </item>
+ <item>
+ <p>The erlang odbc process will now die normally if a
+ connection can not be established. No connection no
+ process it is expected. And as the client has already
+ received the error message that would be the reason with
+ which the erlang process would be stopped, the supervisor
+ report will be superfluous. Naturally you may still get
+ supervisor reports if the erlang process is stopped for
+ any other reason than the above.</p>
+ <p>Own Id: OTP-4639 Aux Id: seq7766 </p>
+ </item>
+ <item>
+ <p>Error handling has been enhanced and better documented</p>
+ <p>Own Id: OTP-4661</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>odbc 0.9.3</title>
+
+ <section>
+ <title>Fixed Bugs and Malfunctions</title>
+ <list type="bulleted">
+ <item>
+ <p>Erlang ODBC application can handle floating point number
+ and has been improved with null value handling. The error
+ messages has been improved with STATE-information from SQL
+ function SQLGetDiagRec.</p>
+ <p>Own Id: OTP-4192 Aux Id: seq7195 </p>
+ </item>
+ <item>
+ <p>sqlCloseCursor have been replaced with sqlCloseHandle </p>
+ <p>(*** POTENTIAL INCOMPATIBILITY ***) </p>
+ <p>Aux Id: seq7283 </p>
+ </item>
+ </list>
+ </section>
+ </section>
+</chapter>
+
+
diff --git a/lib/odbc/doc/src/odbc.gif b/lib/odbc/doc/src/odbc.gif
new file mode 100644
index 0000000000..fbbabee5aa
--- /dev/null
+++ b/lib/odbc/doc/src/odbc.gif
Binary files differ
diff --git a/lib/odbc/doc/src/odbc.xml b/lib/odbc/doc/src/odbc.xml
new file mode 100644
index 0000000000..450531c81c
--- /dev/null
+++ b/lib/odbc/doc/src/odbc.xml
@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>1999</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>odbc</title>
+ <prepared>Ingela Anderton Andin</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <date></date>
+ <rev></rev>
+ </header>
+ <module>odbc</module>
+ <modulesummary>Erlang ODBC application</modulesummary>
+ <description>
+ <p>This application provides an Erlang interface to communicate
+ with relational SQL-databases. It is built on top of Microsofts
+ ODBC interface and therefore requires that you have an ODBC driver
+ to the database that you want to connect to.</p>
+ <note>
+ <p>The functions <c>first/[1,2]</c>, <c>last/[1,2]</c>,
+ <c>next/[1,2]</c>, <c>prev[1,2]</c> and <c>select/[3,4]</c>
+ assumes there is a result set associated with the connection to
+ work on. Calling the function <c>select_count/[2,3]</c>
+ associates such a result set with the connection. Calling
+ select_count again will remove the current result set
+ association and create a new one. Calling a function which dose
+ not operate on an associated result sets, such as
+ <c>sql_query/[2,3]</c>, will remove the current result set
+ association.</p>
+ <p>Alas some drivers only support sequential traversal of the
+ result set, e.i. they do not support what in the ODBC world is
+ known as scrollable cursors. This will have the effect that
+ functions such as <c>first/[1,2]</c>, <c>last/[1,2]</c>,
+ <c>prev[1,2]</c>, etc will return <c>{error, driver_does_not_support_function}</c></p>
+ </note>
+ </description>
+
+ <section>
+ <title>COMMON DATA TYPES </title>
+ <p>Here follows type definitions that are used by more than one
+ function in the ODBC API. </p>
+ <note>
+ <p>The type <c>TimeOut</c> has the default value
+ <c>infinity</c>, so for instance: <br></br>
+
+ commit(Ref, CommitMode) is the same as
+ commit(Ref, CommitMode, infinity). If the
+ timeout expires the client will exit with the reason
+ timeout. </p>
+ </note>
+ <code type="none">
+ connection_reference() - as returned by connect/2 </code>
+ <code type="none">
+ time_out() = milliseconds() | infinity </code>
+ <code type="none">
+ milliseconds() = integer() >= 0 </code>
+ <code type="none">
+ common_reason() = connection_closed | term() - some kind of
+ explanation of what went wrong </code>
+ <code type="none">
+ string() = list of ASCII characters </code>
+ <code type="none">
+ col_name() = string() - Name of column in the result set </code>
+ <code type="none">
+ col_names() - [col_name()] - e.g. a list of the names of the
+ selected columns in the result set. </code>
+ <code type="none">
+ row() = {value()} - Tuple of column values e.g. one row of the
+ result set. </code>
+ <code type="none">
+ value() = null | term() - A column value. </code>
+ <code type="none">
+ rows() = [row()] - A list of rows from the result set. </code>
+ <code type="none">
+ result_tuple() =
+ {updated, n_rows()} | {selected, col_names(), rows()} </code>
+ <code type="none">
+ n_rows() = integer() - The number of affected rows for UPDATE,
+ INSERT, or DELETE queries. For other query types the value
+ is driver defined, and hence should be ignored. </code>
+ <code type="none">
+ 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_float, precision()} | sql_real | sql_double | sql_bit | atom()
+ </code>
+ <code type="none">
+ precision() = integer() </code>
+ <code type="none">
+ scale() = integer() </code>
+ <code type="none">
+ size() = integer() </code>
+ </section>
+
+ <section>
+ <title>ERROR HANDLING </title>
+ <p>The error handling strategy and possible errors sources are
+ described in the Erlang ODBC <seealso marker="error_handling">User's Guide.</seealso></p>
+ </section>
+ <funcs>
+ <func>
+ <name>commit(Ref, CommitMode) -></name>
+ <name>commit(Ref, CommitMode, TimeOut) -> ok | {error, Reason} </name>
+ <fsummary>Commits or rollbacks a transaction. </fsummary>
+ <type>
+ <v>Ref = connection_reference() </v>
+ <v>CommitMode = commit | rollback</v>
+ <v>TimeOut = time_out()</v>
+ <v>Reason = not_an_explicit_commit_connection | process_not_owner_of_odbc_connection | common_reason()</v>
+ </type>
+ <desc>
+ <p>Commits or rollbacks a transaction. Needed on connections
+ where automatic commit is turned off.</p>
+ </desc>
+ </func>
+ <func>
+ <name>connect(ConnectStr, Options) -> {ok, Ref} | {error, Reason} </name>
+ <fsummary>Opens a connection to the database. </fsummary>
+ <type>
+ <v>ConnectStr = string()</v>
+ <d>An example of a connection string:<c>"DSN=sql-server;UID=aladdin;PWD=sesame"</c>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<c>"DSN=Oracle8;DBQ=gandalf;UID=aladdin;PWD=sesame"</c>where DBQ is your TNSNAMES.ORA entry name e.g. some Oracle specific configuration attribute.</d>
+ <v>Options = [] | [option()]</v>
+ <d>All options has default values. </d>
+ <v>option() = {auto_commit, auto_commit_mode()} | {timeout, milliseconds()} | {tuple_row, tuple_mode()} | {scrollable_cursors, use_scrollable_cursors()} | {trace_driver, trace_mode()} </v>
+ <d>The default timeout is infinity </d>
+ <v>auto_commit_mode() = on | off </v>
+ <d>Default is on.</d>
+ <v>tuple_mode() = on | off </v>
+ <d>Default is on. The option is deprecated and should not be used in new code.</d>
+ <v>use_scrollable_cursors() = on | off </v>
+ <d>Default is on.</d>
+ <v>trace_mode() = on | off </v>
+ <d>Default is off.</d>
+ <v>Ref = connection_reference() - should be used to access the connection. </v>
+ <v>Reason = port_program_executable_not_found | common_reason()</v>
+ </type>
+ <desc>
+ <p>Opens a connection to the database. The connection is
+ associated with the process that created it and can only be
+ accessed through it. This function may spawn new processes
+ to handle the connection. These processes will terminate if
+ the process that created the connection dies or if you call
+ disconnect/1.</p>
+ <p>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. </p>
+ <p>As default result sets are returned as a lists of
+ tuples. The <c>TupleMode</c> 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.</p>
+ <p>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</p>
+ <p>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
+ may be useful if you suspect there might be a bug in the
+ 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.</p>
+ <note>
+ <p>For more information about the <c>ConnectStr</c> see
+ description of the function SQLDriverConnect in [1].</p>
+ </note>
+ </desc>
+ </func>
+ <func>
+ <name>disconnect(Ref) -> ok | {error, Reason} </name>
+ <fsummary>Closes a connection to a database. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>Reason = process_not_owner_of_odbc_connection</v>
+ </type>
+ <desc>
+ <p>Closes a connection to a database. This will also
+ terminate all processes that may have been spawned
+ when the connection was opened. This call will always succeed.
+ If the connection can not be disconnected gracefully it will
+ be brutally killed. However you may receive an error message
+ as result if you try to disconnect a connection started by another
+ process.
+ <marker id="describe_table"></marker>
+</p>
+ </desc>
+ </func>
+ <func>
+ <name>describe_table(Ref, Table) -> </name>
+ <name>describe_table(Ref, Table, Timeout) -> {ok, Description} | {error, Reason} </name>
+ <fsummary>Queries the database to find out the data types of the columns of the table <c>Table</c>. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>Table = string() - Name of databas table.</v>
+ <v>TimeOut = time_out()</v>
+ <v>Description = [{col_name(), odbc_data_type()}]</v>
+ <v>Reason = common_reason()</v>
+ </type>
+ <desc>
+ <p>Queries the database to find out the ODBC data types of the
+ columns of the table <c>Table</c>. </p>
+ </desc>
+ </func>
+ <func>
+ <name>first(Ref) -></name>
+ <name>first(Ref, Timeout) -> {selected, ColNames, Rows} | {error, Reason} </name>
+ <fsummary>Returns the first row of the result set and positions a cursor at this row.</fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>TimeOut = time_out()</v>
+ <v>ColNames = col_names() </v>
+ <v>Rows = rows()</v>
+ <v>Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Returns the first row of the result set and positions a
+ cursor at this row.</p>
+ </desc>
+ </func>
+ <func>
+ <name>last(Ref) -></name>
+ <name>last(Ref, TimeOut) -> {selected, ColNames, Rows} | {error, Reason} </name>
+ <fsummary>Returns the last row of the result set and positions a cursor at this row. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>TimeOut = time_out()</v>
+ <v>ColNames = col_names() </v>
+ <v>Rows = rows()</v>
+ <v>Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Returns the last row of the result set and positions a
+ cursor at this row.</p>
+ </desc>
+ </func>
+ <func>
+ <name>next(Ref) -> </name>
+ <name>next(Ref, TimeOut) -> {selected, ColNames, Rows} | {error, Reason} </name>
+ <fsummary>Returns the next row of the result set relative the current cursor position and positions the cursor at this row. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>TimeOut = time_out()</v>
+ <v>ColNames = col_names() </v>
+ <v>Rows = rows()</v>
+ <v>Reason = result_set_does_not_exist | process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Returns the next row of the result set relative the
+ current cursor position and positions the cursor at this
+ row. If the cursor is positioned at the last row of the
+ result set when this function is called the returned value
+ will be <c>{selected, ColNames,[]}</c> e.i. the list of row
+ values is empty indicating that there is no more data to fetch.
+ <marker id="param_query"></marker>
+</p>
+ </desc>
+ </func>
+ <func>
+ <name>param_query(Ref, SQLQuery, Params) -> </name>
+ <name>param_query(Ref, SQLQuery, Params, TimeOut) -> ResultTuple | {error, Reason} </name>
+ <fsummary>Executes a parameterized SQL query.</fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>SQLQuery = string() - a SQL query with parameter markers/place holders in form of question marks.</v>
+ <v>Params = [{odbc_data_type(), [value()]}] |[{odbc_data_type(), in_or_out(), [value()]}] </v>
+ <v>in_or_out = in | out | inout</v>
+ <d>Defines IN, OUT, and IN OUT Parameter Modes for stored procedures.</d>
+ <v>TimeOut = time_out()</v>
+ <v>Values = term() - Must be consistent with the Erlang data type that corresponds to the ODBC data type ODBCDataType</v>
+ </type>
+ <desc>
+ <p>Executes a parameterized SQL query. For an
+ example see the <seealso marker="getting_started#param_query">"Using the Erlang API"</seealso> in the Erlang ODBC
+ User's Guide.</p>
+ <note>
+ <p>Use the function describe_table/[2,3] to find out which
+ ODBC data type that is expected for each column of that
+ table. If a column has a data type that is described with
+ capital letters, alas it is not currently supported by the
+ param_query function. Too know which Erlang data type
+ corresponds to an ODBC data type see the Erlang to ODBC
+ data type<seealso marker="databases#type">mapping</seealso> in the User's Guide.</p>
+ </note>
+ </desc>
+ </func>
+ <func>
+ <name>prev(Ref) -> </name>
+ <name>prev(ConnectionReference, TimeOut) -> {selected, ColNames, Rows} | {error, Reason} </name>
+ <fsummary>Returns the previous row of the result set relative the current cursor position and positions the cursor at this row. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>TimeOut = time_out()</v>
+ <v>ColNames = col_names() </v>
+ <v>Rows = rows()</v>
+ <v>Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Returns the previous row of the result set relative the
+ current cursor position and positions the
+ cursor at this row.</p>
+ </desc>
+ </func>
+
+ <func>
+ <name>start() -> </name>
+ <name>start(Type) -> ok | {error, Reason}</name>
+ <fsummary>Starts the odb application. </fsummary>
+
+ <type>
+ <v>Type = permanent | transient | temporary
+ </v>
+ </type>
+
+ <desc>
+ <p> Starts the odbc application. Default type
+ is temporary.
+ <seealso marker="kernel:application">See application(3)</seealso>
+ </p>
+ </desc>
+ </func>
+
+ <func>
+ <name>stop() -> ok </name>
+ <fsummary> Stops the odbc application.</fsummary>
+
+ <desc>
+ <p> Stops the odbc application.
+ <seealso marker="kernel:application">See application(3)</seealso>
+ </p>
+ </desc>
+ </func>
+
+ <func>
+ <name>sql_query(Ref, SQLQuery) -> </name>
+ <name>sql_query(Ref, SQLQuery, TimeOut) -> ResultTuple | [ResultTuple] |{error, Reason}</name>
+ <fsummary>Executes a SQL query or a batch of SQL queries. If it is a SELECT query the result set is returned, on the format<c>{selected, ColNames, Rows}</c>. For other query types the tuple <c>{updated, NRows}</c>is returned, and for batched queries, if the driver supports them, this function can also return a list of result tuples.</fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>SQLQuery = string() - The string may be composed by several SQL-queries separated by a ";", this is called a batch. </v>
+ <v>TimeOut = time_out()</v>
+ <v>ResultTuple = result_tuple() </v>
+ <v>Reason = process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Executes a SQL query or a batch of SQL queries. If it
+ is a SELECT query the result set is returned, on the format
+ <c>{selected, ColNames, Rows}</c>. For other query types the
+ tuple <c>{updated, NRows}</c> is returned, and for batched
+ queries, if the driver supports them, this function can also
+ return a list of result tuples.</p>
+ <note>
+ <p>Some drivers may not have the information of the number
+ of affected rows available and then the return value may
+ be <c>{updated, undefined} </c>. </p>
+ <p>The list of column names is ordered in the same way as the
+ list of values of a row, e.g. the first <c>ColName</c> is
+ associated with the first <c>Value</c> in a <c>Row</c>.</p>
+ </note>
+ <br></br>
+ </desc>
+ </func>
+ <func>
+ <name>select_count(Ref, SelectQuery) -> </name>
+ <name>select_count(Ref, SelectQuery, TimeOut) -> {ok, NrRows} | {error, Reason} </name>
+ <fsummary>Executes a SQL SELECT query and associates the result set with the connection. A cursor is positioned before the first row in the result set and the tuple <c>{ok, NrRows}</c>is returned. </fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>SelectQuery = string()</v>
+ <d>SQL SELECT query.</d>
+ <v>TimeOut = time_out()</v>
+ <v>NrRows = n_rows()</v>
+ <v>Reason = process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Executes a SQL SELECT query and associates the result set
+ with the connection. A cursor is positioned before the first
+ row in the result set and the tuple <c>{ok, NrRows}</c> is
+ returned. </p>
+ <note>
+ <p>Some drivers may not have the information of the number of
+ rows in the result set, then <c>NrRows</c> will have the value
+ <c>undefined</c>. </p>
+ </note>
+ </desc>
+ </func>
+ <func>
+ <name>select(Ref, Position, N) -></name>
+ <name>select(Ref, Position, N, TimeOut) -> {selected, ColNames, Rows} | {error, Reason} </name>
+ <fsummary>Selects <c>N</c>consecutive rows of the result set.</fsummary>
+ <type>
+ <v>Ref = connection_reference()</v>
+ <v>Position = next | {relative, Pos} | {absolute, Pos} </v>
+ <d>Selection strategy, determines at which row in the result set to start the selection.</d>
+ <v>Pos = integer() </v>
+ <d>Should indicate a row number in the result set. When used together with the option <c>relative</c>it will be used as an offset from the current cursor position, when used together with the option <c>absolute</c>it will be interpreted as a row number.</d>
+ <v>N = integer() </v>
+ <v>TimeOut = time_out()</v>
+ <v>Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </v>
+ </type>
+ <desc>
+ <p>Selects <c>N</c> consecutive rows of the result set. If
+ <c>Position</c> is <c>next</c> it is semantically equivalent
+ of calling <c>next/[1,2]</c><c>N</c> times. If
+ <c>Position</c> is <c>{relative, Pos}</c>, <c>Pos</c> will be
+ used as an offset from the current cursor position to
+ determine the first selected row. If <c>Position</c> is
+ <c>{absolute, Pos}</c>, <c>Pos</c> will be the number of the
+ first row selected. After this function has returned the
+ cursor is positioned at the last selected row. If there is
+ less then <c>N</c> rows left of the result set the length of
+ <c>Rows</c> will be less than <c>N</c>. If the first row to
+ select happens to be beyond the last row of the result set,
+ the returned value will be <c>{selected, ColNames,[]}</c>
+ e.i. the list of row values is empty indicating that there
+ is no more data to fetch.</p>
+ </desc>
+ </func>
+ </funcs>
+
+ <section>
+ <title>REFERENCES</title>
+ <p>[1]: Microsoft ODBC 3.0, Programmer's Reference and SDK Guide <br></br>
+
+ See also http://msdn.microsoft.com/</p>
+ </section>
+
+</erlref>
+
+
+
+
+
diff --git a/lib/odbc/doc/src/odbc_app_arc.fig b/lib/odbc/doc/src/odbc_app_arc.fig
new file mode 100644
index 0000000000..15ae385dbb
--- /dev/null
+++ b/lib/odbc/doc/src/odbc_app_arc.fig
@@ -0,0 +1,76 @@
+#FIG 3.1
+Landscape
+Center
+Inches
+1200 2
+5 1 0 1 -1 7 0 0 -1 0.000 0 0 0 0 2737.500 5737.500 2250 5700 2775 5250 3225 5700
+1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 4200 2700 474 474 4200 2700 3750 2550
+1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 4275 7500 474 474 4275 7500 3825 7350
+1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 4200 4125 474 474 4200 4125 3750 3975
+1 3 0 1 -1 7 0 0 -1 0.000 1 0.0000 2325 4275 474 474 2325 4275 1875 4125
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 1 1 1.00 60.00 120.00
+ 1 1 1.00 60.00 120.00
+ 4200 3150 4200 3600
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 3675 4200 2850 4200
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 2100 3825 3750 2550
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 3837 3017 2625 3825
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 2775 3975 3675 3975
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 3825 4500 2775 4500
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 4350 4575 4350 7050
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 4125 4575 4125 7125
+2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
+ 2250 5700 3225 5700 3225 6300 2250 6300 2250 5700
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 3900 7275 2925 6300
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 1 1 1.00 60.00 120.00
+ 3075 5325 3975 4575
+3 2 0 1 -1 7 0 0 -1 0.000 0 0 0 7
+ 4125 7200 3975 7350 4200 7425 4050 7575 4275 7650 4125 7725
+ 4275 7875
+ 0.00 0.00 4001.93 7267.73 3964.43 7305.23 3990.76 7416.74
+ 4184.24 7358.26 4214.09 7484.70 4035.91 7515.30 4065.76 7641.74
+ 4271.46 7600.21 4277.50 7685.21 4133.64 7671.76 4116.80 7775.50
+ 4154.30 7813.00 0.00 0.00
+3 2 0 1 -1 7 0 0 -1 0.000 0 0 0 7
+ 4425 7088 4275 7238 4500 7313 4350 7463 4575 7538 4425 7613
+ 4575 7763
+ 300.00 -112.00 4301.93 7155.73 4264.43 7193.23 4290.76 7304.74
+ 4484.24 7246.26 4514.09 7372.70 4335.91 7403.30 4365.76 7529.74
+ 4571.46 7488.21 4577.50 7573.21 4433.64 7559.76 4416.80 7663.50
+ 4454.30 7701.00 300.00 -112.00
+4 0 -1 0 0 0 12 0.0000 4 180 1290 3675 2100 Erlang Supervisor\001
+4 0 -1 0 0 0 12 0.0000 4 180 1590 4800 4125 Erlang control process\001
+4 0 -1 0 0 0 12 0.0000 4 180 765 3900 8250 C-process\001
+4 0 -1 0 0 0 12 0.0000 4 180 885 900 4200 Erlang client\001
+4 0 -1 0 0 0 12 0.0000 4 135 330 4275 3525 Link\001
+4 0 -1 0 0 0 12 0.6109 4 135 1500 2543 3786 Connection reference\001
+4 0 -1 0 0 0 12 0.0000 4 165 510 3000 3900 request\001
+4 0 -1 0 0 0 12 0.0000 4 135 630 3000 4350 response\001
+4 0 -1 0 0 0 12 0.0000 4 135 555 2850 4650 monitor\001
+4 0 -1 0 0 0 12 0.6109 4 180 1140 2339 3449 Connect request\001
+4 0 -1 0 0 0 12 0.0000 4 180 1260 2850 7800 Supervisor thread\001
+4 0 -1 0 0 0 12 0.0000 4 135 1695 4650 7575 Database handler thread\001
+4 0 -1 0 0 0 12 0.0000 4 165 510 4425 6825 request\001
+4 0 -1 0 0 0 12 0.0000 4 135 630 4425 4950 response\001
+4 0 -1 0 0 0 12 0.0000 4 180 795 2325 6000 Erlang port\001
+4 0 -1 0 0 0 12 0.0000 4 180 1635 1800 6975 Exit signal propagation\001
+4 0 -1 0 0 0 12 0.0000 4 135 705 3375 5850 shutdown\001
+4 0 -1 0 0 0 12 0.0000 4 180 1635 1650 5175 Exit signal propagation\001
diff --git a/lib/odbc/doc/src/odbc_app_arc.gif b/lib/odbc/doc/src/odbc_app_arc.gif
new file mode 100644
index 0000000000..724864f9ad
--- /dev/null
+++ b/lib/odbc/doc/src/odbc_app_arc.gif
Binary files differ
diff --git a/lib/odbc/doc/src/odbc_app_arc.ps b/lib/odbc/doc/src/odbc_app_arc.ps
new file mode 100644
index 0000000000..1ae8bd9649
--- /dev/null
+++ b/lib/odbc/doc/src/odbc_app_arc.ps
@@ -0,0 +1,284 @@
+%!PS-Adobe-2.0
+%%Title: odbc_app_arc.fig
+%%Creator: fig2dev Version 3.1 Patchlevel 2
+%%CreationDate: Thu Jan 8 11:11:36 2004
+%%For: ingela@gildor (Ingela Anderton, UAB/KH/P)
+%Magnification: 1.00
+%%Orientation: Landscape
+%%BoundingBox: 116 230 497 562
+%%Pages: 1
+%%BeginSetup
+%%IncludeFeature: *PageSize Letter
+%%EndSetup
+%%EndComments
+/$F2psDict 200 dict def
+$F2psDict begin
+$F2psDict /mtrx matrix put
+/col-1 {0 setgray} bind def
+/col0 {0.000 0.000 0.000 srgb} bind def
+/col1 {0.000 0.000 1.000 srgb} bind def
+/col2 {0.000 1.000 0.000 srgb} bind def
+/col3 {0.000 1.000 1.000 srgb} bind def
+/col4 {1.000 0.000 0.000 srgb} bind def
+/col5 {1.000 0.000 1.000 srgb} bind def
+/col6 {1.000 1.000 0.000 srgb} bind def
+/col7 {1.000 1.000 1.000 srgb} bind def
+/col8 {0.000 0.000 0.560 srgb} bind def
+/col9 {0.000 0.000 0.690 srgb} bind def
+/col10 {0.000 0.000 0.820 srgb} bind def
+/col11 {0.530 0.810 1.000 srgb} bind def
+/col12 {0.000 0.560 0.000 srgb} bind def
+/col13 {0.000 0.690 0.000 srgb} bind def
+/col14 {0.000 0.820 0.000 srgb} bind def
+/col15 {0.000 0.560 0.560 srgb} bind def
+/col16 {0.000 0.690 0.690 srgb} bind def
+/col17 {0.000 0.820 0.820 srgb} bind def
+/col18 {0.560 0.000 0.000 srgb} bind def
+/col19 {0.690 0.000 0.000 srgb} bind def
+/col20 {0.820 0.000 0.000 srgb} bind def
+/col21 {0.560 0.000 0.560 srgb} bind def
+/col22 {0.690 0.000 0.690 srgb} bind def
+/col23 {0.820 0.000 0.820 srgb} bind def
+/col24 {0.500 0.190 0.000 srgb} bind def
+/col25 {0.630 0.250 0.000 srgb} bind def
+/col26 {0.750 0.380 0.000 srgb} bind def
+/col27 {1.000 0.500 0.500 srgb} bind def
+/col28 {1.000 0.630 0.630 srgb} bind def
+/col29 {1.000 0.750 0.750 srgb} bind def
+/col30 {1.000 0.880 0.880 srgb} bind def
+/col31 {1.000 0.840 0.000 srgb} bind def
+
+end
+save
+-1.5 176.0 translate
+ 90 rotate
+1 -1 scale
+
+/cp {closepath} bind def
+/ef {eofill} bind def
+/gr {grestore} bind def
+/gs {gsave} bind def
+/sa {save} bind def
+/rs {restore} bind def
+/l {lineto} bind def
+/m {moveto} bind def
+/rm {rmoveto} bind def
+/n {newpath} bind def
+/s {stroke} bind def
+/sh {show} bind def
+/slc {setlinecap} bind def
+/slj {setlinejoin} bind def
+/slw {setlinewidth} bind def
+/srgb {setrgbcolor} bind def
+/rot {rotate} bind def
+/sc {scale} bind def
+/sd {setdash} bind def
+/ff {findfont} bind def
+/sf {setfont} bind def
+/scf {scalefont} bind def
+/sw {stringwidth} bind def
+/tr {translate} bind def
+/tnt {dup dup currentrgbcolor
+ 4 -2 roll dup 1 exch sub 3 -1 roll mul add
+ 4 -2 roll dup 1 exch sub 3 -1 roll mul add
+ 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
+ bind def
+/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
+ 4 -2 roll mul srgb} bind def
+ /DrawEllipse {
+ /endangle exch def
+ /startangle exch def
+ /yrad exch def
+ /xrad exch def
+ /y exch def
+ /x exch def
+ /savematrix mtrx currentmatrix def
+ x y tr xrad yrad sc 0 0 1 startangle endangle arc
+ closepath
+ savematrix setmatrix
+ } def
+
+/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
+/$F2psEnd {$F2psEnteredState restore end} def
+%%EndProlog
+
+$F2psBegin
+10 setmiterlimit
+n 0 612 m 0 0 l 792 0 l 792 612 l cp clip
+ 0.06000 0.06000 sc
+%%Page: 1 1
+/Times-Roman ff 180.00 scf sf
+4800 4125 m
+gs 1 -1 sc (Erlang control process) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+3900 8250 m
+gs 1 -1 sc (C-process) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+900 4200 m
+gs 1 -1 sc (Erlang client) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+4275 3525 m
+gs 1 -1 sc (Link) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+2543 3786 m
+gs 1 -1 sc 35.0 rot (Connection reference) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+3000 3900 m
+gs 1 -1 sc (request) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+3000 4350 m
+gs 1 -1 sc (response) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+2850 4650 m
+gs 1 -1 sc (monitor) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+2339 3449 m
+gs 1 -1 sc 35.0 rot (Connect request) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+2850 7800 m
+gs 1 -1 sc (Supervisor thread) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+4650 7575 m
+gs 1 -1 sc (Database handler thread) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+4425 6825 m
+gs 1 -1 sc (request) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+4425 4950 m
+gs 1 -1 sc (response) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+2325 6000 m
+gs 1 -1 sc (Erlang port) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+1800 6975 m
+gs 1 -1 sc (Exit signal propagation) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+3375 5850 m
+gs 1 -1 sc (shutdown) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+1650 5175 m
+gs 1 -1 sc (Exit signal propagation) col-1 sh gr
+/Times-Roman ff 180.00 scf sf
+3675 2100 m
+gs 1 -1 sc (Erlang Supervisor) col-1 sh gr
+7.500 slw
+% Arc
+gs n 2737.5 5737.5 488.9 -175.6 -4.4 arc
+gs col-1 s gr
+ gr
+
+% Ellipse
+n 4200 2700 474 474 0 360 DrawEllipse gs col-1 s gr
+
+% Ellipse
+n 4275 7500 474 474 0 360 DrawEllipse gs col-1 s gr
+
+% Ellipse
+n 4200 4125 474 474 0 360 DrawEllipse gs col-1 s gr
+
+% Ellipse
+n 2325 4275 474 474 0 360 DrawEllipse gs col-1 s gr
+
+% Polyline
+gs clippath
+4230 3453 m 4200 3573 l 4170 3453 l 4170 3615 l 4230 3615 l cp clip
+4170 3297 m 4200 3177 l 4230 3297 l 4230 3135 l 4170 3135 l cp clip
+n 4200 3150 m 4200 3600 l gs col-1 s gr gr
+
+% arrowhead
+n 4170 3297 m 4200 3177 l 4230 3297 l 4200 3297 l 4170 3297 l cp gs 0.00 setgray ef gr col-1 s
+% arrowhead
+n 4230 3453 m 4200 3573 l 4170 3453 l 4200 3453 l 4230 3453 l cp gs 0.00 setgray ef gr col-1 s
+% Polyline
+gs clippath
+2997 4230 m 2877 4200 l 2997 4170 l 2835 4170 l 2835 4230 l cp clip
+n 3675 4200 m 2850 4200 l gs col-1 s gr gr
+
+% arrowhead
+n 2997 4230 m 2877 4200 l 2997 4170 l 2997 4200 l 2997 4230 l cp gs 0.00 setgray ef gr col-1 s
+% Polyline
+gs clippath
+3615 2616 m 3728 2566 l 3652 2664 l 3780 2565 l 3744 2517 l cp clip
+n 2100 3825 m 3750 2550 l gs col-1 s gr gr
+
+% arrowhead
+n 3615 2616 m 3728 2566 l 3652 2664 l col-1 s
+% Polyline
+gs clippath
+2764 3768 m 2647 3810 l 2731 3718 l 2596 3808 l 2629 3858 l cp clip
+n 3837 3017 m 2625 3825 l gs col-1 s gr gr
+
+% arrowhead
+n 2764 3768 m 2647 3810 l 2731 3718 l col-1 s
+% Polyline
+gs clippath
+3528 3945 m 3648 3975 l 3528 4005 l 3690 4005 l 3690 3945 l cp clip
+n 2775 3975 m 3675 3975 l gs col-1 s gr gr
+
+% arrowhead
+n 3528 3945 m 3648 3975 l 3528 4005 l 3528 3975 l 3528 3945 l cp gs 0.00 setgray ef gr col-1 s
+% Polyline
+gs clippath
+2922 4530 m 2802 4500 l 2922 4470 l 2760 4470 l 2760 4530 l cp clip
+n 3825 4500 m 2775 4500 l gs col-1 s gr gr
+
+% arrowhead
+n 2922 4530 m 2802 4500 l 2922 4470 l 2922 4500 l 2922 4530 l cp gs 0.00 setgray ef gr col-1 s
+% Polyline
+gs clippath
+4380 6903 m 4350 7023 l 4320 6903 l 4320 7065 l 4380 7065 l cp clip
+4320 4722 m 4350 4602 l 4380 4722 l 4380 4560 l 4320 4560 l cp clip
+n 4350 4575 m 4350 7050 l gs col-1 s gr gr
+
+% arrowhead
+n 4320 4722 m 4350 4602 l 4380 4722 l col-1 s
+% arrowhead
+n 4380 6903 m 4350 7023 l 4320 6903 l col-1 s
+% Polyline
+gs clippath
+4155 6978 m 4125 7098 l 4095 6978 l 4095 7140 l 4155 7140 l cp clip
+n 4125 4575 m 4125 7125 l gs col-1 s gr gr
+
+% arrowhead
+n 4155 6978 m 4125 7098 l 4095 6978 l col-1 s
+% Polyline
+n 2250 5700 m 3225 5700 l 3225 6300 l 2250 6300 l cp gs col-1 s gr
+% Polyline
+gs clippath
+3008 6425 m 2944 6319 l 3050 6383 l 2936 6268 l 2893 6311 l cp clip
+n 3900 7275 m 2925 6300 l gs col-1 s gr gr
+
+% arrowhead
+n 3008 6425 m 2944 6319 l 3050 6383 l 3029 6404 l 3008 6425 l cp gs 0.00 setgray ef gr col-1 s
+% Polyline
+gs clippath
+3843 4646 m 3954 4592 l 3881 4692 l 4006 4588 l 3967 4542 l cp clip
+n 3075 5325 m 3975 4575 l gs col-1 s gr gr
+
+% arrowhead
+n 3843 4646 m 3954 4592 l 3881 4692 l 3862 4669 l 3843 4646 l cp gs 0.00 setgray ef gr col-1 s
+% Interp Spline
+gs n 4125 7200 m
+ 4001.9 7267.7 3964.4 7305.2 3975 7350 curveto
+ 3990.8 7416.7 4184.2 7358.3 4200 7425 curveto
+ 4214.1 7484.7 4035.9 7515.3 4050 7575 curveto
+ 4065.8 7641.7 4271.5 7600.2 4275 7650 curveto
+ 4277.5 7685.2 4133.6 7671.8 4125 7725 curveto
+ 4116.8 7775.5 4154.3 7813.0 4275 7875 curveto
+ gs col-1 s gr
+ gr
+
+% Interp Spline
+gs n 4425 7088 m
+ 4301.9 7155.7 4264.4 7193.2 4275 7238 curveto
+ 4290.8 7304.7 4484.2 7246.3 4500 7313 curveto
+ 4514.1 7372.7 4335.9 7403.3 4350 7463 curveto
+ 4365.8 7529.7 4571.5 7488.2 4575 7538 curveto
+ 4577.5 7573.2 4433.6 7559.8 4425 7613 curveto
+ 4416.8 7663.5 4454.3 7701.0 4575 7763 curveto
+ gs col-1 s gr
+ gr
+
+showpage
+$F2psEnd
+rs
diff --git a/lib/odbc/doc/src/odbc_index.gif b/lib/odbc/doc/src/odbc_index.gif
new file mode 100644
index 0000000000..fbbabee5aa
--- /dev/null
+++ b/lib/odbc/doc/src/odbc_index.gif
Binary files differ
diff --git a/lib/odbc/doc/src/part.xml b/lib/odbc/doc/src/part.xml
new file mode 100644
index 0000000000..2ab981c04f
--- /dev/null
+++ b/lib/odbc/doc/src/part.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE part SYSTEM "part.dtd">
+
+<part xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>1999</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Erlang ODBC User's Guide</title>
+ <prepared>Ingela Anderton</prepared>
+ <docno></docno>
+ <date>2002-09-17</date>
+ <rev>A</rev>
+ <file>part.sgml</file>
+ </header>
+ <description>
+ <p>The <em>Erlang ODBC Application </em> provides an interface for
+ accessing relational SQL-databases from Erlang.</p>
+ </description>
+ <xi:include href="introduction.xml"/>
+ <xi:include href="getting_started.xml"/>
+ <xi:include href="databases.xml"/>
+ <xi:include href="error_handling.xml"/>
+</part>
+
+
diff --git a/lib/odbc/doc/src/part_notes.xml b/lib/odbc/doc/src/part_notes.xml
new file mode 100644
index 0000000000..f101cee799
--- /dev/null
+++ b/lib/odbc/doc/src/part_notes.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE part SYSTEM "part.dtd">
+
+<part xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>2004</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>ODBC Release Notes</title>
+ <prepared>Ingela Anderton Andin</prepared>
+ <docno></docno>
+ <date>2004-09-07</date>
+ <rev></rev>
+ <file>part_notes.sgml</file>
+ </header>
+ <description>
+ <p>An interface to relational SQL-databases built on ODBC (Open
+ Database Connectivity). </p>
+ <p>For information about older versions see
+ <url href="part_notes_history_frame.html">release notes history</url>.</p>
+ </description>
+ <xi:include href="notes.xml"/>
+</part>
+
+
diff --git a/lib/odbc/doc/src/part_notes_history.xml b/lib/odbc/doc/src/part_notes_history.xml
new file mode 100644
index 0000000000..fa9b3b7dc7
--- /dev/null
+++ b/lib/odbc/doc/src/part_notes_history.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE part SYSTEM "part.dtd">
+
+<part>
+ <header>
+ <copyright>
+ <year>2004</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Odbc</title>
+ <prepared>Ingela Anderton Andin</prepared>
+ <docno></docno>
+ <date>2004-09-30</date>
+ <rev></rev>
+ <file>part_notes.sgml</file>
+ </header>
+ <include file="notes_history"></include>
+</part>
+
+
diff --git a/lib/odbc/doc/src/ref_man.gif b/lib/odbc/doc/src/ref_man.gif
new file mode 100644
index 0000000000..b13c4efd53
--- /dev/null
+++ b/lib/odbc/doc/src/ref_man.gif
Binary files differ
diff --git a/lib/odbc/doc/src/ref_man.xml b/lib/odbc/doc/src/ref_man.xml
new file mode 100644
index 0000000000..e94febf0f1
--- /dev/null
+++ b/lib/odbc/doc/src/ref_man.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE application SYSTEM "application.dtd">
+
+<application xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>1999</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ 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.
+
+ </legalnotice>
+
+ <title>Erlang ODBC Reference Manual</title>
+ <prepared>Ingela Anderton</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date>2002-09-13</date>
+ <rev>A</rev>
+ <file>application.sgml</file>
+ </header>
+ <description>
+ <p>The <em>Erlang ODBC </em> application provides an interface for
+ accessing relational SQL-databases from Erlang.</p>
+ </description>
+ <xi:include href="odbc.xml"/>
+</application>
+
+
diff --git a/lib/odbc/doc/src/user_guide.gif b/lib/odbc/doc/src/user_guide.gif
new file mode 100644
index 0000000000..e6275a803d
--- /dev/null
+++ b/lib/odbc/doc/src/user_guide.gif
Binary files differ
diff --git a/lib/odbc/doc/src/warning.gif b/lib/odbc/doc/src/warning.gif
new file mode 100644
index 0000000000..96af52360e
--- /dev/null
+++ b/lib/odbc/doc/src/warning.gif
Binary files differ