LuaSQL
Database connectivity for the Lua programming language

## History

LuaSQL 2.8.1 [18/Feb/2026]
  - Updated `environment:connect()` method to accept a single connection string in ODBC driver (thanks to saspivey98).
LuaSQL 2.8.0 [14/Feb/2026]
  - Drivers for DuckDB, Firebird, MySQL, ODBC, PostgreSQL and SQLite3 were tested against Lua 5.1, 5.2, 5.3, 5.4 and 5.5
  - Driver for DuckDB added (thanks to Geraldo Luiz de Carvalho Pereira Junior)
  - Fix bug on Firebird driver on the garbage colletion method
  - Fix bug on SQLite3 driver on the garbage colletion method
LuaSQL 2.7.1 [08/Jul/2025]
  - Drivers for Firebird, MySQL, PostgreSQL and SQLite3 were tested against Lua 5.1, 5.2, 5.3, 5.4 and 5.5-beta
  - Fix retrieval of unknown types in ODBC driver (thanks to Huangqinjin)
  - Fix Unicode build in ODBC driver (thanks to Huangqinjin)
  - Conforming to MSYS2 update in ODBC driver (thanks to Saspivey98)
  - Implement dates and timestamp in OCI driver (thanks to Andreaskem)
  - Fix creation of extra rows in SQLite3 driver (thanks to Damin Risho)
  - Improvement of the test script
LuaSQL 2.7.0 [23/Apr/2025]
  - LuaSQL is adapted to Lua version 5.4 and all the drivers are compatible with To-be-closed variables.
  - The `:close()` method now returns false and a string with appropriate message instead of raising an error when there are related open objects.
LuaSQL 2.6.1 [07/Feb/2024]
  - Corrected compatibility to Lua versions below 5.3 to SQLite3 (thanks to Daniel McCarney)
LuaSQL 2.6.0 [09/Sep/2020]
  - Added read-only mode to SQLite3 and two new methods to MySQL fetch
  - Added library opening functions to ease the initialization process in C applications
LuaSQL 2.5.0 [14/Jun/2019]
  - Added support in MySQL driver for seeking in the result set
  - Bug-fix on number retrieval on ODBC driver (thanks to Mauro Grassia)
LuaSQL 2.4.0 [30/Oct/2018]
  - Added support in MySQL driver for opening a connection based on a Unix socket (thanks to rafis)
  - Added connection ping method (thanks to rafis)
  - Added Makefile for mingw (thanks to watercoldyi)
  - Bug correction on retrieving varchar2 data (thanks to David Gao)
LuaSQL 2.3.5 [23/Feb/2017]
  - Added some bug corrections and tested with Lua versions 5.1, 5.2 and 5.3 (only Postgres, MySQL and SQLite were tested by the time of the launch)
LuaSQL 2.3.4 [30/Oct/2016]
  - Bug correction in Postgres driver: escaping string bigger than the default buffer are now correctly handled
LuaSQL 2.3.3 [16/May/2016]
  - Bug correction in Postgres driver: generating error message after failed connection (thanks to seanpringle)
LuaSQL 2.3.2 [14/May/2016]
  - Bug correction in Postgres driver: freeing memory after failed connection opening (thanks to seanpringle)
LuaSQL 2.3.1 [28/Mar/2016]
  - Improvement on the Postgres driver to avoid the need of compiler support of dynamic array allocation
LuaSQL 2.3.0 [23/May/2012]
  - Added support to compile the drivers for all Lua 5.X versions (only Postgres, MySQL and SQLite were tested by the time of the launch)
  - Correction on MySQL implementation to honor the close of the cursor when the last row is returned
  - Drivers:
    - Postgres: tested with versions 8.4 and 9.1
    - MySQL: tested with version 5.1
    - SQLite3: tested with version 3.6
    - Firebird: compiled but not tested
    - SQLite: adapted but not compiled
    - ODBC: adapted but not compiled
    - Oracle/OCI8: adapted but not compiled
    - ADO: nothing changed
    - JDBC: nothing changed
LuaSQL 2.2.0 [??/??/200?]
  - Added Firebird driver
  - Added LuaRocks specifications
  - escape method added to some drivers
  - getlastautoid method added to MySQL driver
  - fetch method now closes the cursor when there is no more rows to retrieve
  - Uniformization of method's return values on all drivers
LuaSQL 2.1.1 [29/Oct/2007]
  - Fixed a bug in the SQLite3 error handling (patch by David Burgess)
  - Fixed bug [#1770] for SQLite 3 (found by Enrico Tassi, patch by Marc Nijdam)
  - Fixed bug [#1834] for SQLite 3 (found by Savin Zlobec, patch by Marc Nijdam)
LuaSQL 2.1.0 [29/Aug/2007]
  - Added support for SQLite 3
  - Bug correction: freeing PGresults in the Postgres driver (thanks to Michael Broughton)
  - Corrected memory leak when no cursor created (thanks to Klaus Ripke)
  - Corrected bug avoiding duplicate access to stack
LuaSQL 2.0.2 [26/Jun/2006]
  - numrows method added to MySQL driver.
  - Added a `config` for the `makefile`.
  - Added configuration for the UnixODBC driver.
  - Bug fixes to the SQLite driver (bug found by Mike Petersen).
  - Bug fixes to the JDBC, OCI8 and ADO drivers.
  - Improved tests.
  - Updated documentation.
LuaSQL 2.0.1 [02/Jun/2005]
  - Bug fixes to the ODBC driver.
LuaSQL 2.0.0 [22/Mar/2005]
  - Added ADO driver and some bug fixes to the ODBC driver.
LuaSQL 2.0 Beta 3 [23/Dec/2004]
  - Minor bug fixes.
LuaSQL 2.0 Beta 2 [26/Nov/2004]
  - Bug fixes
  - New SQLite and JDBC drivers
  - LuaSQL now follows the package model for Lua 5.1 (see Installation section for more details).
LuaSQL 2.0 Beta [10/Nov/2003]

## Changes from previous versions

Version 2.x has some design changes and implementation improvements compared to version 1.0:

- New `fetch` method: more eficient and more flexible
- New `setautocommit` method
- Lua 5.0 and 5.1 compatible
- Dynamically loadable or statically linked
- New drivers for Oracle and MySQL databases

Valid XHTML 1.0!