Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 1061

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- odbc</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/odbc-2.10.13.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Erlang ODBC</strong><br><strong>Reference Manual</strong><br><small>Version 2.10.13</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu"><li id="loadscrollpos" title="odbc " expanded="true">odbc<ul>
<li><a href="odbc.html">
                  Top of manual page
                </a></li>
<li title="commit-2"><a href="odbc.html#commit-2">commit/2</a></li>
<li title="commit-3"><a href="odbc.html#commit-3">commit/3</a></li>
<li title="connect-2"><a href="odbc.html#connect-2">connect/2</a></li>
<li title="disconnect-1"><a href="odbc.html#disconnect-1">disconnect/1</a></li>
<li title="describe_table-2"><a href="odbc.html#describe_table-2">describe_table/2</a></li>
<li title="describe_table-3"><a href="odbc.html#describe_table-3">describe_table/3</a></li>
<li title="first-1"><a href="odbc.html#first-1">first/1</a></li>
<li title="first-2"><a href="odbc.html#first-2">first/2</a></li>
<li title="last-1"><a href="odbc.html#last-1">last/1</a></li>
<li title="last-2"><a href="odbc.html#last-2">last/2</a></li>
<li title="next-1"><a href="odbc.html#next-1">next/1</a></li>
<li title="next-2"><a href="odbc.html#next-2">next/2</a></li>
<li title="param_query-3"><a href="odbc.html#param_query-3">param_query/3</a></li>
<li title="param_query-4"><a href="odbc.html#param_query-4">param_query/4</a></li>
<li title="prev-1"><a href="odbc.html#prev-1">prev/1</a></li>
<li title="prev-2"><a href="odbc.html#prev-2">prev/2</a></li>
<li title="start-0"><a href="odbc.html#start-0">start/0</a></li>
<li title="start-1"><a href="odbc.html#start-1">start/1</a></li>
<li title="stop-0"><a href="odbc.html#stop-0">stop/0</a></li>
<li title="sql_query-2"><a href="odbc.html#sql_query-2">sql_query/2</a></li>
<li title="sql_query-3"><a href="odbc.html#sql_query-3">sql_query/3</a></li>
<li title="select_count-2"><a href="odbc.html#select_count-2">select_count/2</a></li>
<li title="select_count-3"><a href="odbc.html#select_count-3">select_count/3</a></li>
<li title="select-3"><a href="odbc.html#select-3">select/3</a></li>
<li title="select-4"><a href="odbc.html#select-4">select/4</a></li>
</ul>
</li></ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>odbc</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">odbc</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">Erlang ODBC application</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <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>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>The functions <span class="code">first/[1,2]</span>, <span class="code">last/[1,2]</span>,
        <span class="code">next/[1,2]</span>, <span class="code">prev[1,2]</span> and <span class="code">select/[3,4]</span>
        assumes there is a result set associated with the connection to
        work on. Calling the function <span class="code">select_count/[2,3]</span>
        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
        <span class="code">sql_query/[2,3]</span>, 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 <span class="code">first/[1,2]</span>, <span class="code">last/[1,2]</span>,
        <span class="code">prev[1,2]</span>, etc will return <span class="code">{error, driver_does_not_support_function}</span></p>
    </p></div>
</div>
  </p></div>

  <h3><a name="id59807">COMMON DATA TYPES </a></h3>
<div class="REFBODY">
    
    <p>Here follows type definitions that are used by more than one
      function in the ODBC API. </p>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>The type <span class="code">TimeOut</span> has the default value
        <span class="code">infinity</span>, so for instance:        <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>
    </p></div>
</div>
    <div class="example"><pre>
 connection_reference() - as returned by connect/2    </pre></div>
    <div class="example"><pre>
 time_out() = milliseconds() | infinity    </pre></div>
    <div class="example"><pre>
 milliseconds() = integer() &gt;= 0     </pre></div>
    <div class="example"><pre>
 common_reason() = connection_closed | term() - some kind of
                 explanation of what went wrong    </pre></div>
    <div class="example"><pre>
 string() = list of ASCII characters    </pre></div>
    <div class="example"><pre>
 col_name() = string() - Name of column in the result set    </pre></div>
    <div class="example"><pre>
 col_names() - [col_name()] - e.g. a list of the names of the
           selected columns in the result set.     </pre></div>
    <div class="example"><pre>
 row() = {value()} - Tuple of column values e.g. one row of the
           result set.     </pre></div>
    <div class="example"><pre>
 value() = null | term() - A column value.     </pre></div>
    <div class="example"><pre>
 rows() = [row()] - A list of rows from the result set.    </pre></div>
    <div class="example"><pre>
 result_tuple() =
      {updated, n_rows()} | {selected, col_names(), rows()}    </pre></div>
    <div class="example"><pre>
 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.    </pre></div>
    <div class="example"><pre>
 odbc_data_type() = sql_integer | sql_smallint | sql_tinyint |
      {sql_decimal, precision(), scale()} |
      {sql_numeric, precision(), scale()} |
      {sql_char, size()} | {sql_wchar, size()} | {sql_varchar, size()} | {sql_wvarchar, size()}| {sql_float, precision()} |
      {sql_wlongvarchar, size()} | {sql_float, precision()} | sql_real | sql_double | sql_bit | atom()
    </pre></div>
    <div class="example"><pre>
 precision() = integer()    </pre></div>
    <div class="example"><pre>
 scale() = integer()    </pre></div>
    <div class="example"><pre>
 size() = integer()    </pre></div>
  </div>

  <h3><a name="id63858">ERROR HANDLING </a></h3>
<div class="REFBODY">
    
    <p>The error handling strategy and possible errors sources are
      described in the Erlang ODBC <span class="bold_code"><a href="error_handling.html">User's Guide.</a></span></p>
  </div>
  <h3>EXPORTS</h3>
    <p><a name="commit-2"><span class="bold_code">commit(Ref, CommitMode) -&gt;</span></a><br><a name="commit-3"><span class="bold_code">commit(Ref, CommitMode, TimeOut) -&gt; ok | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">CommitMode = commit | rollback</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = not_an_explicit_commit_connection | process_not_owner_of_odbc_connection | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Commits or rollbacks a transaction. Needed on connections
          where automatic commit is turned off.</p>
      </p></div>
    <p><a name="connect-2"><span class="bold_code">connect(ConnectStr, Options) -&gt; {ok, Ref} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">ConnectStr = string()</span><br>
</div>
        <div class="REFBODY">An example of a connection string: <span class="code">"DSN=sql-server;UID=aladdin;PWD=sesame"</span> 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 <span class="code">"DSN=Oracle8;DBQ=gandalf;UID=aladdin;PWD=sesame"</span> where DBQ is your TNSNAMES.ORA entry name e.g. some Oracle specific configuration attribute.</div>
        <div class="REFTYPES">
<span class="bold_code">Options = [] | [option()]</span><br>
</div>
        <div class="REFBODY">All options has default values. </div>
        <div class="REFTYPES">
<span class="bold_code">option() = {auto_commit, on | off} | {timeout, milliseconds()}
	| {binary_strings, on | off} | {tuple_row, on | off} | {scrollable_cursors, on | off} |
	{trace_driver, on | off} </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference() - should be used to access the connection. </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = port_program_executable_not_found | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <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>The default timeout is infinity </p>
	  
	  <p> &gt;If the option binary_strings is turned on all strings
	  will be returned as binaries and strings inputed to
	  param_query will be expected to be binaries. The user needs
	  to ensure that the binary is in an encoding that the
	  database expects. By default this option is turned off.</p>
	  
        <p>As default result sets are returned as a lists of
          tuples. The <span class="code">TupleMode</span> 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>

	  <div class="note">
<div class="label">Note</div>
<div class="content"><p><p>Turning the scrollable_cursors option off is noted
	  to make old odbc-drivers able to connect that will otherwhise fail.</p></p></div>
</div>
	  
        <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>
	  
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>For more information about the <span class="code">ConnectStr</span> see
            description of the function SQLDriverConnect in [1].</p>
        </p></div>
</div>
      </p></div>
    <p><a name="disconnect-1"><span class="bold_code">disconnect(Ref) -&gt; ok | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = process_not_owner_of_odbc_connection</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <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.
                    <a name="describe_table"></a>
</p>
      </p></div>
    <p><a name="describe_table-2"><span class="bold_code">describe_table(Ref, Table) -&gt; </span></a><br><a name="describe_table-3"><span class="bold_code">describe_table(Ref, Table, Timeout) -&gt; {ok, Description} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Table = string() - Name of databas table.</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Description = [{col_name(), odbc_data_type()}]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Queries the database to find out the ODBC data types of the
          columns of the table <span class="code">Table</span>. </p>
      </p></div>
    <p><a name="first-1"><span class="bold_code">first(Ref) -&gt;</span></a><br><a name="first-2"><span class="bold_code">first(Ref, Timeout) -&gt; {selected, ColNames, Rows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">ColNames = col_names() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Rows = rows()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the first row of the result set and positions a
          cursor at this row.</p>
      </p></div>
    <p><a name="last-1"><span class="bold_code">last(Ref) -&gt;</span></a><br><a name="last-2"><span class="bold_code">last(Ref, TimeOut) -&gt; {selected, ColNames, Rows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">ColNames = col_names() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Rows = rows()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the last row of the result set and positions a
          cursor at this row.</p>
      </p></div>
    <p><a name="next-1"><span class="bold_code">next(Ref) -&gt; </span></a><br><a name="next-2"><span class="bold_code">next(Ref, TimeOut) -&gt; {selected, ColNames, Rows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">ColNames = col_names() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Rows = rows()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = result_set_does_not_exist | process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <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 <span class="code">{selected, ColNames,[]}</span> e.i. the list of row
          values is empty indicating that there is no more data to fetch.
                    <a name="param_query"></a>
</p>
      </p></div>
    <p><a name="param_query-3"><span class="bold_code">param_query(Ref, SQLQuery, Params) -&gt; </span></a><br><a name="param_query-4"><span class="bold_code">param_query(Ref, SQLQuery, Params, TimeOut) -&gt; ResultTuple | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">SQLQuery = string() - a SQL query with parameter markers/place holders in form of question marks.</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Params = [{odbc_data_type(), [value()]}] |[{odbc_data_type(), in_or_out(), [value()]}]  </span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">in_or_out = in | out | inout</span><br>
</div>
	<div class="REFBODY">Defines IN, OUT, and IN OUT Parameter Modes for stored procedures.</div>
	<div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Values = term() - Must be consistent with the Erlang data type that corresponds to the ODBC data type ODBCDataType</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Executes a parameterized SQL query. For an
          example see the <span class="bold_code"><a href="getting_started.html#param_query">"Using the Erlang API"</a></span> in the Erlang ODBC 
          User's Guide.</p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <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 <span class="bold_code"><a href="databases.html#type">mapping</a></span> in the User's Guide.</p>
        </p></div>
</div>
      </p></div>
    <p><a name="prev-1"><span class="bold_code">prev(Ref) -&gt; </span></a><br><a name="prev-2"><span class="bold_code">prev(ConnectionReference, TimeOut) -&gt; {selected, ColNames, Rows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">ColNames = col_names() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Rows = rows()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the previous row of the result set relative the
          current cursor position and positions the
          cursor at this row.</p>
      </p></div>

    <p><a name="start-0"><span class="bold_code">start() -&gt; </span></a><br><a name="start-1"><span class="bold_code">start(Type) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Type =  permanent | transient | temporary
	</span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p> Starts the odbc application. Default type
	  is temporary.
	  <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','application.html');">See application(3)</a></span>
	</p>
      </p></div>

    <p><a name="stop-0"><span class="bold_code">stop() -&gt; ok </span></a><br></p>
<div class="REFBODY"><p>
	<p> Stops the odbc application.
	  <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','application.html');">See application(3)</a></span>
	</p>
      </p></div>
    
    <p><a name="sql_query-2"><span class="bold_code">sql_query(Ref, SQLQuery) -&gt; </span></a><br><a name="sql_query-3"><span class="bold_code">sql_query(Ref, SQLQuery, TimeOut) -&gt; ResultTuple | [ResultTuple] |{error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">SQLQuery = string() - The string may be composed by several SQL-queries separated by a ";", this is called a batch. </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">ResultTuple = result_tuple() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <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
          <span class="code">{selected, ColNames, Rows}</span>. For other query types the
          tuple <span class="code">{updated, NRows}</span> is returned, and for batched
          queries, if the driver supports them, this function can also
          return a list of result tuples.</p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>Some drivers may not have the information of the number
            of affected rows available and then the return value may
            be <span class="code">{updated, undefined} </span>. </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 <span class="code">ColName</span> is
            associated with the first <span class="code">Value</span> in a <span class="code">Row</span>.</p>
        </p></div>
</div>
        <br>
      </p></div>
    <p><a name="select_count-2"><span class="bold_code">select_count(Ref, SelectQuery) -&gt; </span></a><br><a name="select_count-3"><span class="bold_code">select_count(Ref, SelectQuery, TimeOut) -&gt; {ok, NrRows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">SelectQuery = string()</span><br>
</div>
        <div class="REFBODY">SQL SELECT query.</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">NrRows = n_rows()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <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 <span class="code">{ok, NrRows}</span> is
          returned. </p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>Some drivers may not have the information of the number of
            rows in the result set, then <span class="code">NrRows</span> will have the value
            <span class="code">undefined</span>. </p>
        </p></div>
</div>
      </p></div>
    <p><a name="select-3"><span class="bold_code">select(Ref, Position, N) -&gt;</span></a><br><a name="select-4"><span class="bold_code">select(Ref, Position, N, TimeOut) -&gt; {selected, ColNames, Rows} | {error, Reason} </span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Ref = connection_reference()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Position = next | {relative, Pos} | {absolute, Pos} </span><br>
</div>
        <div class="REFBODY">Selection strategy, determines at which row in the result set to start the selection.</div>
        <div class="REFTYPES">
<span class="bold_code">Pos = integer() </span><br>
</div>
        <div class="REFBODY">Should indicate a row number in the result set. When used together with the option <span class="code">relative</span>it will be used as an offset from the current cursor position, when used together with the option <span class="code">absolute</span>it will be interpreted as a row number.</div>
        <div class="REFTYPES">
<span class="bold_code">N = integer() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TimeOut = time_out()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = result_set_does_not_exist | driver_does_not_support_function | scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Selects <span class="code">N</span> consecutive rows of the result set. If
          <span class="code">Position</span> is <span class="code">next</span> it is semantically equivalent
          of calling <span class="code">next/[1,2]</span> <span class="code">N</span> times. If
          <span class="code">Position</span> is <span class="code">{relative, Pos}</span>, <span class="code">Pos</span> will be
          used as an offset from the current cursor position to
          determine the first selected row. If <span class="code">Position</span> is
          <span class="code">{absolute, Pos}</span>, <span class="code">Pos</span> 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 <span class="code">N</span> rows left of the result set the length of
          <span class="code">Rows</span> will be less than <span class="code">N</span>. If the first row to
          select happens to be beyond the last row of the result set,
          the returned value will be <span class="code">{selected, ColNames,[]}</span>
          e.i. the list of row values is empty indicating that there
          is no more data to fetch.</p>
      </p></div>
  

  <h3><a name="id59419">REFERENCES</a></h3>
<div class="REFBODY">
    
    <p>[1]: Microsoft ODBC 3.0, Programmer's Reference and SDK Guide      <br>

      See also http://msdn.microsoft.com/</p>
  </div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1999-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>