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
5
votes
2 answers

Luasql and SQLite?

I just got started looking at Lua as an easy way to access the SQLite DLL, but I ran into an error while trying to use the DB-agnostic LuaSQL module: require "luasql.sqlite" module "luasql.sqlite" print("Content-type:…
Gulbahar
  • 5,343
  • 20
  • 70
  • 93
3
votes
1 answer

Lua mysql, need a way to escape data

I need a way to escape data for mysql statements in lua. I'm used to doing something like mysql_real_escape_string() in php but can't find an equivalent in lua using mysql (con:escape() worked when I was using sqlite3). I've read that prepared…
two13
  • 345
  • 1
  • 3
  • 11
3
votes
3 answers

lua test and assign inside loop control

Is there / please suggest a syntax to achieve a compact 'test and assign' in lua? Consider this segment from luasql examples ( http://keplerproject.org/luasql/examples.html ) -- retrieve a cursor cur = assert (con:execute"SELECT name, email from…
robm
  • 1,303
  • 1
  • 16
  • 24
3
votes
1 answer

luasql nil value

I tried to follow the example at http://www.keplerproject.org/luasql/examples.html Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio > require "luasql.postgres" > env = assert (luasql.postgres()) stdin:1: attempt to index global 'luasql' (a nil…
Russell
  • 2,692
  • 5
  • 23
  • 24
2
votes
1 answer

Installing luasql 2.2 with luarocks onto lua for windows install

So it turns out lua for windows install has some earlier 2.1 version of luasql on it, and I need to be able to use luasql 2.2 (particularly mysql). I've spent all day trying to install this thing with luarocks but keep hitting a wall. This is the…
two13
  • 345
  • 1
  • 3
  • 11
2
votes
1 answer

Compiling LuaSQL 2.1.1 on Ubuntu 10.04 for odbc

I can't get luasql 2.1.1 for odbc to compile out of the box, and I don't understand how to interpret the error. This is on Ubuntu 10.04, and unixodbc is successfully installed. root@server:~/Downloads/luasql-2.1.1# make gcc -O2 -Wall…
Neil
  • 7,042
  • 9
  • 43
  • 78
2
votes
1 answer

How to use prepared statements in lua-dbi?

I want to use prepared statements in my lua scripts. As mentioned in my previous post, people recommend using lua-dbi. Unfortunately there is little documentation available. I just need a basic script that connects to the database with credentials,…
user5330815
2
votes
0 answers

Parameterized query in LuaSQL

Possible Duplicate: How to quote values for LuaSQL? Does LuaSQL offer parameterized queries? I've poked through the source and it seems like a big "no".
ember arlynx
  • 3,129
  • 2
  • 20
  • 22
2
votes
3 answers

How to embed luasql.sqlite3 in a statically linked C program?

The luasql.sqlite3 module has been compiled into my C program successfully, statically linked. But, it seems the module has not been registered yet. The call of require 'luasql.sqlite3' always fails in Lua scripts. Some other modules call…
douyw
  • 4,034
  • 1
  • 30
  • 28
1
vote
1 answer

Catch the LuaSQL error to the xpcall error handler function

How can I get the error output from the LuaSQL driver as an argument to the xpcall error function as assert does? For example, by running the following code: local conn = assert…
Ilie Soltanici
  • 377
  • 2
  • 16
1
vote
1 answer

How to call luasql script from .NET

I am using ZeroBrane IDE for lua script and Visual Studio 2015 for C# I can call lua script from C# with normal variable, but I can't run the script with sql-odbc, it's working in zeroBrane only but from c# I can't. here is c# code try { Lua lua…
EngBashir
  • 21
  • 4
1
vote
1 answer

Installing LuaSQL on Windows without local MySQL-server

I'm part of a project and trying to make sure that our Lua code can interact with a given MySQL-database which I only have remote access to. This causes problems when trying to install LuaSQL (through luarocks), giving the following error…
Joel
  • 21
  • 7
1
vote
0 answers

Prepared statements for Lua with LuaSQL

There is little documentation on prepared statements in luaSQL. So i tried to put together some code to use prepared statements in LuaSQL. Unfortunately it's not working. (I'm using a mysql database) luasql = require "luasql.mysql" env = assert…
user5330815
1
vote
4 answers

Install luaSQL on Ubuntu

TL;DR: You can skip to here. I was trying to use luarocks installer, but the apt-get installer did it without problems. I am experiencing issues when installing luaSQL on Ubuntu. I need it for a script that uses luasql = require "luasql.mysql". I…
user2566212
1
vote
1 answer

How to link LuaSQL in a C++ application?

My script runs fine when I execute it from outside the application (terminal), but when its called from inside the C++ application it shuts down in the require("luasql.mysql") call. Can anyone help?
Fernando Pinheiro
  • 1,796
  • 2
  • 17
  • 21
1
2 3