luasql

Install luaSQL on Ubuntu

可紊 提交于 2021-02-08 08:01:33
问题 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 followed the official documentation which can be found here: http://keplerproject.github.io/luasql/doc/us/ What I've tried (and what was suggested by the official documentation): sudo luarocks install luasql-mysql gave me the following output: Error

UPDATE cell value if a pair matches

时光毁灭记忆、已成空白 提交于 2020-01-06 02:33:10
问题 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`), UNIQUE INDEX `ip` (`ip`) ) COLLATE='utf8_general_ci' ENGINE=MyISAM ROW_FORMAT=DEFAULT and another table ipnstats: CREATE TABLE `ipnstats` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ipstats_id` INT(10) UNSIGNED NOT NULL, `nick` VARCHAR(32) NOT NULL,

Lua mysql, need a way to escape data

孤街醉人 提交于 2019-12-23 18:23:22
问题 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 statements are a solution but it doesn't seem to work for me. What am I doing wrong? require "luasql.mysql" env = assert (luasql.mysql()) con = env:connect("db_name", "user", "pass", "localhost") local stmt = con:prepare([[ SELECT * FROM `user` WHERE

How do I create an Sqlite3 database using luasql?

只谈情不闲聊 提交于 2019-12-19 11:14:02
问题 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? 回答1: SQLLite will create the db automatically if it does not exist. Here is a set of Sample functions for using it in Lua (ignore the fh functions they are just internal to the program I use). require 'luasql.sqlite3' function opendb(dbname) -- Check for Settings Database and create if needed

How do I create an Sqlite3 database using luasql?

◇◆丶佛笑我妖孽 提交于 2019-12-19 11:13:33
问题 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? 回答1: SQLLite will create the db automatically if it does not exist. Here is a set of Sample functions for using it in Lua (ignore the fh functions they are just internal to the program I use). require 'luasql.sqlite3' function opendb(dbname) -- Check for Settings Database and create if needed

Prepared statements for Lua with LuaSQL

北城余情 提交于 2019-12-11 10:55:35
问题 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 (luasql.mysql()) con = assert (env:connect("database","user","password","localhost")) name = "insert_sql_injection_code_here" query= "INSERT INTO `table`(`text`) VALUES ('"..name.."')" cur = assert (con:execute(query)) -- As you can see, query is

How to use prepared statements in lua-dbi?

前提是你 提交于 2019-12-11 03:53:44
问题 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, and use prepared statements (prefered with a bind function to names in the query). Anyone experienced with this? 回答1: You can find it on the project's wiki pages: Establishing connection: https://code.google.com/p/luadbi/wiki/DBDDriverConnection