Questions tagged [luasql]

LuaSQL is a simple interface from Lua to a number of database management systems. It includes a set of drivers to some popular databases (currently PostgreSQL, ODBC, MySQL, SQLite, Oracle, and ADO).

LuaSQL is a simple interface from Lua to a DBMS. It enables a Lua program to:

  • Connect to ODBC, ADO, Oracle, MySQL, SQLite and PostgreSQL databases;
  • Execute arbitrary SQL statements;
  • Retrieve results in a row-by-row cursor fashion.

LuaSQL is a simple interface from Lua to a number of database management systems. It includes a set of drivers to some popular databases (currently PostgreSQL, ODBC, MySQL, SQLite, Oracle, and ADO). It defines a simple object-oriented API. All drivers should implement this common API, but each one is free to offer extensions. It is free software. It's latest version is LuaSQL 2.1.1 released on October 29th, 2007.

It was originally designed by Pedro Miller Rabinovitch and Roberto Ierusalimschy. The first implementation was compatible with Lua 4.0a and its development was sponsored by Fábrica Digital, FINEP and CNPq.

LuaSQL's progress can be tracked on its github project page.

44 questions
1
vote
1 answer

Lua SQL: peeking at cursors

I am using LuaSQL, and query for a result set using con:execute(sql_stmt), which returns a cursor. How do I see if there is at least one row in that resultset, without doing a cursor:fetch to pop that first row?
Neil
  • 7,042
  • 9
  • 43
  • 78
1
vote
0 answers

How to implement date query in luasql oci8?

I am using oci8 driver of luasql to access Oracle database. All the queries are working fine. But if I try to implement a date query as: conn:execute "select sysdate from dual" It throws as error: invalid type 12 # I read it somewhere that the…
user3213851
  • 1,068
  • 2
  • 12
  • 24
1
vote
1 answer

Lua script to stop firing a query in mysql via mysql proxy

I am a beginner to lua language.The main concept is when a user fire the DROP TABLE command in mysql it should not be executed.But he can fire all other commands as usual in mysql.But i don't want to use GRANTS for this.Is there any luaScript to…
robin
  • 19
  • 1
  • 10
1
vote
0 answers

SELECT statement silently dies - postgresql

I'm testing the differences between SELECT and SELECT FOR UPDATE in postgresql. One thing that I've noticed with SELECT statements is that when a lock or contention occurs, postgresql "seems" to be silently dying. Consider the following script:…
dot
  • 14,928
  • 41
  • 110
  • 218
1
vote
0 answers

connecting to two different sqlite databases in lua using luasql

Goal I'm trying to connect to two different databases, one after the other. I know the first connection is working because I attempt to create a new record, and it works. When I try to connect to the second database and query a table, the logic…
dot
  • 14,928
  • 41
  • 110
  • 218
1
vote
1 answer

How do I query a columns data type in access 2003?

I am looking for a way to get the data type of a column given the table that it is in and the name of the column. I have seen other answers refer to the MSysIMEXColumns table but my Access database does not have that table. I am using Access 2003…
Wryte
  • 885
  • 2
  • 10
  • 23
1
vote
1 answer

How do I create an Sqlite3 database using luasql?

I am trying to create a Sqlite3 database with luasql. After I require luasql.sqlite3, how do I create the database on a file? Also, I can't seem to find the manual for luasql. Is it available anywhere?
Milind
  • 415
  • 8
  • 24
1
vote
1 answer

UPDATE cell value if a pair matches

I am using luasql. I have two tables of this type: IPINFO CREATE TABLE `ipstats` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ip` VARCHAR(15) NOT NULL, `last_used` DATETIME NOT NULL DEFAULT '1981-09-30 00:00:00', PRIMARY KEY (`id`), …
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
0
votes
0 answers

Install luasql.oci8 without the use of luarocks in my debian 11 bullseyes

lua version I am having is lua5.2.4 OS is debian 11 bullseye I want to install luasql.oci8 in my debian 11 I am already having luasql.mysql, luasql.postgres and so on . I have installed oci8.so file and provided in…
ayush jain
  • 71
  • 1
  • 1
  • 5
0
votes
0 answers

LuaSQL does not work under Apache 2.4 64 bit

Installed Lua x86 from here: https://code.google.com/archive/p/luaforwindows/downloads Set up LUA_CPATH Added to C:/xampp/apache/conf/httpd.conf LoadModule lua_module modules/mod_lua.so SetHandler lua-script
0
votes
0 answers

lua require "luasql.mysql" occurs error loading module infomation

i want to use mysql in lua program. But when run require "luasql.mysql", throws error infomation error loading module 'luasql.mysql' from file '/usr/local/luarocks/lib/lua/5.4/luasql/mysql.so': /usr/local/luarocks/lib/lua/5.4/luasql/mysql.so:1:…
geng
  • 1
0
votes
0 answers

DLL file format not recognized

So I've been trying to install the luasql-mysql module for a while now and I keep running into problems. This time when I go to install it gives me this error: luasql-mysql 2.5.0-1 depends on lua >= 5.1 (5.3-1 provided by VM) mingw32-gcc -O2 -c -o…
Outflows
  • 163
  • 11
0
votes
2 answers

How to add function output to a variable using luasql

I am trying to assign the output of a function to a variable, but I can’t do it. :( I use Lua 5.3.4 and luarocks 3.2.1 (+luasql-postgres) My script: luasql = require "luasql.postgres" value=arg[1] current_time=os.date("%Y-%m-%d %H:%M:%S") env =…
0
votes
1 answer

Communication to DB-File with Luasql and sqlite3 is not working

I'm trying to communicate to my database using luasql and sqlite3. I've read myself through many sites and found some examples. But there were many different ways that seem to work to use luasql. But for me it seems none of them is working... I'm…
prix
  • 99
  • 1
  • 11
0
votes
1 answer

Lua Script can't connect to MySQL-Database

I'm following the Lua part of this tutorial: http://wiki.dragino.com/index.php?title=Save_Data_to_MySQL. Especially this code: require "luasql.mysql" env = assert (luasql.mysql()) con = assert…