1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>odbc</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<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> 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>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P> The functions <CODE>first/[1,2]</CODE>, <CODE>last/[1,2]</CODE>,
<CODE>next/[1,2]</CODE>, <CODE>prev[1,2]</CODE> and <CODE>select/[3,4]</CODE>
assumes there is a result set associated with the connection to
work on. Calling the function <CODE>select_count/[2,3]</CODE>
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
<CODE>sql_query/[2,3]</CODE>, will remove the current result set
association.
<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 <CODE>first/[1,2]</CODE>, <CODE>last/[1,2]</CODE>,
<CODE>prev[1,2]</CODE>, etc will return <CODE>{error,
driver_does_not_support_function}</CODE>
</TD>
</TR>
</TABLE>
</DIV>
<H3> COMMON DATA TYPES </H3>
<DIV CLASS=REFBODY>
<P> Here follows type definitions that are used by more than one
function in the ODBC API.
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P>The type <CODE>TimeOut</CODE> has the default value
<CODE>infinity</CODE>, 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. </TD>
</TR>
</TABLE>
<PRE>
connection_reference() - as returned by connect/2
</PRE>
<PRE>
time_out() = milliseconds() | infinity
</PRE>
<PRE>
milliseconds() = integer() >= 0
</PRE>
<PRE>
common_reason() = connection_closed | term() - some kind of
explanation of what went wrong
</PRE>
<PRE>
string() = list of ASCII characters
</PRE>
<PRE>
col_name() = string() - Name of column in the result set
</PRE>
<PRE>
col_names() - [col_name()] - e.g. a list of the names of the
selected columns in the result set.
</PRE>
<PRE>
row() = {value()} - Tuple of column values e.g. one row of the
result set.
</PRE>
<PRE>
value() = null | term() - A column value.
</PRE>
<PRE>
rows() = [row()] - A list of rows from the result set.
</PRE>
<PRE>
result_tuple() =
{updated, n_rows()} | {selected, col_names(), rows()}
</PRE>
<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>
<PRE>
odbc_data_type() = sql_integer | sql_smallint | sql_tinyint |
{sql_decimal, precison(), scale()} |
{sql_numeric, precison(), scale()} |
{sql_char, size()} | {sql_varchar, size()} | {sql_float, precision()} |
{sql_float, precision()} | sql_real | sql_double | sql_bit | atom()
</PRE>
<PRE>
precision() = integer()
</PRE>
<PRE>
scale() = integer()
</PRE>
<PRE>
size() = integer()
</PRE>
</DIV>
<H3> ERROR HANDLING </H3>
<DIV CLASS=REFBODY>
<P>The error handling strategy and possible errors sources are
described in the Erlang ODBC <A HREF="error_handling.html">User's
Guide.</A>
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="commit/2"><STRONG><CODE> commit(Ref, CommitMode) -></CODE></STRONG></A><BR>
<A NAME="commit/3"><STRONG><CODE> commit(Ref, CommitMode, TimeOut) ->
ok | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference() </CODE></STRONG><BR>
<STRONG><CODE> CommitMode = commit | rollback</CODE></STRONG><BR>
<STRONG><CODE> TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> Reason = not_an_explicit_commit_connection |
process_not_owner_of_odbc_connection | common_reason()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P> Commits or rollbacks a transaction. Needed on connections
where automatic commit is turned off.
</DIV>
<P><A NAME="connect/2"><STRONG><CODE> connect(ConnectStr, Options) ->
{ok, Ref} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> ConnectStr = string()</CODE></STRONG><BR>
<DIV CLASS=REFBODY>
An example of a connection string:
<CODE>"DSN=sql-server;UID=alladin;PWD=sesame"</CODE> 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
<CODE>"DSN=Oracle8;DBQ=gandalf;UID=alladin;PWD=sesame"</CODE>
where DBQ is your TNSNAMES.ORA entry name e.g. some Oracle
specific configuration attribute.
</DIV>
<STRONG><CODE> Options = [] | [option()]</CODE></STRONG><BR>
<DIV CLASS=REFBODY>
All options has default values.
</DIV>
<STRONG><CODE> option() = {auto_commit, auto_commit_mode()} | {timeout,
milliseconds()} | {tuple_row, tuple_mode()} |
{scrollable_cursors, use_srollable_cursors()} |
{trace_driver, trace_mode()} </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
The default timeout is infinity
</DIV>
<STRONG><CODE> auto_commit_mode() = on | off </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Default is on.
</DIV>
<STRONG><CODE> tuple_mode() = on | off </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Default is on. The option is deprecated and should not be used
in new code.
</DIV>
<STRONG><CODE> use_srollable_cursors() = on | off </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Default is on.
</DIV>
<STRONG><CODE> trace_mode() = on | off </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Default is off.
</DIV>
<STRONG><CODE> Ref = connection_reference() - should be used to acess the
connection. </CODE></STRONG><BR>
<STRONG><CODE> Reason = port_program_executable_not_found | common_reason()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<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 funtion 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> If automatic commit mode is turned on, each query will be
considered as an individual transaction and will be
automaticly commited 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> As default result sets are returned as a lists of
tuples. The <CODE>TupleMode</CODE> option still exists to keep some
degree of backwards compatiblity. If the option is set to
off, result sets will be returned as a lists of lists
instead of a lists of tuples.
<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> 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>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P>For more information about the <CODE>ConnectStr</CODE> see
description of the function SQLDriverConnect in [1]. </TD>
</TR>
</TABLE>
</DIV>
<P><A NAME="disconnect/1"><STRONG><CODE> disconnect(Ref) -> ok | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> Reason = process_not_owner_of_odbc_connection</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<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"><!-- Empty --></A>
</DIV>
<P><A NAME="describe_table/2"><STRONG><CODE> describe_table(Ref, Table) -> </CODE></STRONG></A><BR>
<A NAME="describe_table/3"><STRONG><CODE> describe_table(Ref, Table, Timeout) ->
{ok, Description} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE>Table = string() - Name of databas table.</CODE></STRONG><BR>
<STRONG><CODE> TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE>Description = [{col_name(), odbc_data_type()}]</CODE></STRONG><BR>
<STRONG><CODE> Reason = common_reason()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P> Queries the database to find out the ODBC data types of the
columns of the table <CODE>Table</CODE>.
</DIV>
<P><A NAME="first/1"><STRONG><CODE> first(Ref) -></CODE></STRONG></A><BR>
<A NAME="first/2"><STRONG><CODE> first(Ref, Timeout) ->
{selected, ColNames, Rows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> ColNames = col_names() </CODE></STRONG><BR>
<STRONG><CODE> Rows = rows()</CODE></STRONG><BR>
<STRONG><CODE> Reason = result_set_does_not_exist | driver_does_not_support_function |
scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P> Returns the first row of the result set and positions a
cursor at this row.
</DIV>
<P><A NAME="last/1"><STRONG><CODE>last(Ref) -></CODE></STRONG></A><BR>
<A NAME="last/2"><STRONG><CODE>last(Ref, TimeOut) ->
{selected, ColNames, Rows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> ColNames = col_names() </CODE></STRONG><BR>
<STRONG><CODE> Rows = rows()</CODE></STRONG><BR>
<STRONG><CODE> Reason = result_set_does_not_exist | driver_does_not_support_function |
scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P> Returns the last row of the result set and positions a
cursor at this row.
</DIV>
<P><A NAME="next/1"><STRONG><CODE> next(Ref) -> </CODE></STRONG></A><BR>
<A NAME="next/2"><STRONG><CODE> next(Ref, TimeOut) ->
{selected, ColNames, Rows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> ColNames = col_names() </CODE></STRONG><BR>
<STRONG><CODE> Rows = rows()</CODE></STRONG><BR>
<STRONG><CODE> Reason = result_set_does_not_exist | process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<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 <CODE>{selected, ColNames,[]}</CODE> e.i. the list of row
values is empty indicating that there is no more data to fetch.
<A NAME="param_query"><!-- Empty --></A>
</DIV>
<P><A NAME="param_query/3"><STRONG><CODE> param_query(Ref, SQLQuery, Params) -> </CODE></STRONG></A><BR>
<A NAME="param_query/4"><STRONG><CODE> param_query(Ref, SQLQuery, Params, TimeOut) ->
ResultTuple | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE>SQLQuery = string() - a SQL query with parameter
markers/place holders in form of question marks.</CODE></STRONG><BR>
<STRONG><CODE>Params = [{odbc_data_type(), [value()]}]</CODE></STRONG><BR>
<STRONG><CODE>TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE>Values = term() - Must be consistent with the Erlang data type
that corresponds to the ODBC data type ODBCDataType</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Executes a parameterized SQL query. For an
example see the <A HREF="getting_started.html#param_query"> "Using the Erlang API"</A> in the Erlang ODBC
User's Guide.
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<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<A HREF="databases.html#type"> mapping
</A> in the User's Guide.
</TD>
</TR>
</TABLE>
</DIV>
<P><A NAME="prev/1"><STRONG><CODE> prev(Ref) -> </CODE></STRONG></A><BR>
<A NAME="prev/2"><STRONG><CODE>prev(ConnectionReference, TimeOut) ->
{selected, ColNames, Rows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE>TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> ColNames = col_names() </CODE></STRONG><BR>
<STRONG><CODE> Rows = rows()</CODE></STRONG><BR>
<STRONG><CODE> Reason = result_set_does_not_exist | driver_does_not_support_function |
scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P> Returns the previous row of the result set relative the
current cursor position and positions the
cursor at this row.
</DIV>
<P><A NAME="sql_query/2"><STRONG><CODE>sql_query(Ref, SQLQuery) -> </CODE></STRONG></A><BR>
<A NAME="sql_query/3"><STRONG><CODE>sql_query(Ref, SQLQuery, TimeOut) ->
ResultTuple | [ResultTuple] |{error, Reason}
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> SQLQuery = string() - The string may be composed by several
SQL-queries separated by a ";", this is called a
batch. </CODE></STRONG><BR>
<STRONG><CODE>TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> ResultTuple = result_tuple() </CODE></STRONG><BR>
<STRONG><CODE> Reason = process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<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
<CODE>{selected, ColNames, Rows}</CODE>. For other query types the
tuple <CODE>{updated, NRows}</CODE> is returned, and for batched
queries, if the driver supports them, this function can also
return a list of result tuples.
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P>Some drivers may not have the information of the number
of affected rows available and then the return value may
be <CODE>{updated, undefined} </CODE>.
<P>The list of column names is ordered in the same way as the
list of values of a row, e.g. the first <CODE>ColName</CODE> is
associated with the first <CODE>Value</CODE> in a <CODE>Row</CODE>.
</TD>
</TR>
</TABLE>
<BR>
</DIV>
<P><A NAME="select_count/2"><STRONG><CODE> select_count(Ref, SelectQuery) -> </CODE></STRONG></A><BR>
<A NAME="select_count/3"><STRONG><CODE> select_count(Ref, SelectQuery, TimeOut) ->
{ok, NrRows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> SelectQuery = string()</CODE></STRONG><BR>
<DIV CLASS=REFBODY>
SQL SELECT query.
</DIV>
<STRONG><CODE>TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> NrRows = n_rows()</CODE></STRONG><BR>
<STRONG><CODE> Reason = process_not_owner_of_odbc_connection |
common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<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 <CODE>{ok, NrRows}</CODE> is
returned.
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P>Some drivers may not have the information of the number of
rows in the result set, then <CODE>NrRows</CODE> will have the value
<CODE>undefined</CODE>. </TD>
</TR>
</TABLE>
</DIV>
<P><A NAME="select/3"><STRONG><CODE> select(Ref, Position, N) ->
</CODE></STRONG></A><BR>
<A NAME="select/4"><STRONG><CODE> select(Ref, Position, N, TimeOut) ->
{selected, ColNames, Rows} | {error, Reason} </CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE> Ref = connection_reference()</CODE></STRONG><BR>
<STRONG><CODE> Position = next | {relative, Pos} | {absolute, Pos} </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Selection strategy, determines at which row in the
result set to start the selection.
</DIV>
<STRONG><CODE> Pos = integer() </CODE></STRONG><BR>
<DIV CLASS=REFBODY>
Should indicate a row number in the result set.
When used together with the option <CODE>relative</CODE> it
will be used as an offset from the current cursor position,
when used together with the option <CODE>absolute</CODE> it will
be interpreted as a row number.
</DIV>
<STRONG><CODE> N = integer() </CODE></STRONG><BR>
<STRONG><CODE>TimeOut = time_out()</CODE></STRONG><BR>
<STRONG><CODE> Reason = result_set_does_not_exist | driver_does_not_support_function |
scrollable_cursors_disabled | process_not_owner_of_odbc_connection | common_reason() </CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Selects <CODE>N</CODE> consecutive rows of the result set. If
<CODE>Position</CODE> is <CODE>next</CODE> it is semanticly equivalent
of calling <CODE>next/[1,2]</CODE> <CODE>N</CODE> times. If
<CODE>Position</CODE> is <CODE>{relative, Pos}</CODE>, <CODE>Pos</CODE> will be
used as an offset from the current cursor position to
determine the first selected row. If <CODE>Position</CODE> is
<CODE>{absolute, Pos}</CODE>, <CODE>Pos</CODE> 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 <CODE>N</CODE> rows left of the result set the length of
<CODE>Rows</CODE> will be less than <CODE>N</CODE>. If the first row to
select happens to be beyond the last row of the result set,
the returned value will be <CODE>{selected, ColNames,[]}</CODE>
e.i. the list of row values is empty indicating that there
is no more data to fetch.
</DIV>
<H3>REFERENCES</H3>
<DIV CLASS=REFBODY>
<P>[1]: Microsoft ODBC 3.0, Programmer's Reference and SDK Guide<BR>
See also http://msdn.microsoft.com/
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Ingela Anderton Andin - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>odbc 2.0.6<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|