luaodbc: ODBC interface for Lua

## Synopsis

- res,err= open_sh_lib("libluaodbc.so")
- db,err= dbopen(<database>,<user>,<passwd>)
- db= db.close()
- res,err= db.exec(<statement>)
- q,err= db.query(<select_statement>)
- for r in q.fetch() do
- q= q.close()

## Description

This library provides an ODBC interface for Lua. It's implemented as a shared library. Most functions in this library return two values. First of them is the result value. This can be checked to see whether the last ODBC operation was successful. If it's nil, then the second value is set to the error string that resulted. Note that the first value is always returned even when it's not used other than just checking against nil.

If you close an object, don't ever use it again. Otherwise, our program will most likely crash. Usage of idioms from the synopsis is recommended.

## Functions

### open_sh_lib

This function is defined in the standard environment.

### dbopen

Opens a connection to the given database. Give empty strings for `user` and/or `passwd` if they are not neccessary for connection. This function returns a table that contains functions to access the database.

### db.close

This member of the db table closes the connection to the DB.

### db.exec

Executes the given statement. The return value of this function has no meaning other than indicating success. Therefore, use this function to modify data. You can use db.query() to make queries.

### db.query

Returns a query object from which values may be fetched.

### q.fetch

This iterator function can be used in for loops to fetch the query's data row by row. Each returned row is represented as a table which has members named after the fields selected in the select statement.

### q.close

This function closes the given query. You must always close queries after you're done with them. Otherwise the query will continue to exist, wasting resources.

## Author

Is S. Cinar. Contact him from cinarus at yahoo dot com.

## Installation

You can get the latest version of this library from his homepage. In order to compile, just run 'make'. Then, put the .so somewhere in your library path (ie. /usr/lib or /usr/local/lib).