mwild1 / luadbi Goto Github PK
View Code? Open in Web Editor NEWMulti-backend SQL database library for Lua
License: MIT License
Multi-backend SQL database library for Lua
License: MIT License
What steps will reproduce the problem?
1. wget luadbi...tar.gz
2. tar xfz luadbi...tar.gz
2. make
What is the expected output? What do you see instead?
I expected make to work
tom@math:~/luadbi$ make sqlite3
gcc -c -o build/dbd_common.o dbd/common.c -g -pedantic -Wall -O2 -shared -fpic
-I /usr/include/lua5.1 -I /usr/include/mysql -I /usr/include/postgresql/ -I
/opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I ./
Assembler messages:
Fatal error: can't create build/dbd_common.o: No such file or directory
What version of the product are you using? On what operating system?
0.4
Please provide any additional information below.
mkdir build fixes it, but I'd expect the Makefile to accomplish this.
using ubuntu 10.04
Original issue reported on code.google.com by [email protected]
on 17 Jul 2010 at 5:10
In LuaRocks version 0.5 drivers loaded as dbd.<driver>
but in current repo they loaded like dbd<driver>
Basically LuaDBI will read characters like İ as ? and Ç as ▒, when getting
results after executing a query.
Original issue reported on code.google.com by [email protected]
on 21 Aug 2013 at 10:42
What steps will reproduce the problem?
1. local userSelect = assert(Server.db:prepare('SELECT user_id, password,
username FROM user WHERE username = ?'))
2. userSelect:execute(currentusername);
3. local row = userSelect:fetch();
What is the expected output? What do you see instead?
The expected output is the md5hash for the user's password.
This hash is received successfully, but there often are (about half the time)
trailing characters out of nowhere - this is most likely a allocation issue?
The added strings are e.g.
</)
tion)
bin")
6g="b)
What version of the product are you using? On what operating system?
Lua 5.1.4, luadbi 0.5-1, luadbi-mysql 0.5-1, luasql-mysql 2.3.0-1
Please provide any additional information below.
If you need any further information please let me know!
Original issue reported on code.google.com by [email protected]
on 6 Mar 2013 at 9:24
The LuaDBI PostgreSQL driver does not appear to implement a notice processor, so the libpq
library uses its default behavior of printing these on stderr
.
This can be a bit annoying and surprising for users, so it would be good if this was handled somehow.
What steps will reproduce the problem?
1. CREATE table with a BIGINT column.
2. INSERT 1 into this column
3. SELECT * from table
What is the expected output? What do you see instead?
Expexted output is the same as input: 1
What I see is 4.9406564584125e-324.
What version of the product are you using? On what operating system?
luadbi-mysql 0.5.
MySQL server 5.1.71 and 5.5.38.
Operating systems Ubuntu, FreeBSD, OpenWrt.
Please provide any additional information below.
I think that luadbi-mysql is handling an int like a double.
If I try to read the same table with MySQL-cli, luasql-mysql or Python-MySQLdb
everything is shown as expected.
The root cause is probably the same as for issue #26.
Best regards,
Peter Fassberg
Sweden
Original issue reported on code.google.com by [email protected]
on 30 Jun 2014 at 9:47
What steps will reproduce the problem?
1. Just connect to a postgresql server with luadbi
2. PostgreSQL generates a warning "there is already a transaction in progress"
What is the expected output? What do you see instead?
I would see nothing if there is no such issue.
Please provide any additional information below.
I made a patch and commited on a new branch named 'postgres-fix'.
The new branch is in a cloned repository found on
http://code.google.com/p/luadbi/source/clones
Original issue reported on code.google.com by [email protected]
on 17 Oct 2012 at 1:36
With multiple important issues fixed since the last release, I think it's time to consider a new one.
This time let's not forget the version number! (slaps self)
Anyone object? Any last requests?
When I execute:
dbi = require('DBI')
conn = assert(dbi.Connect("MySQL", "", "user", "", "127.0.0.1", 3306))
user_stmt = assert(conn:prepare("SELECT NULL UNION SELECT 111"))
user_stmt:execute()
print(user_stmt:fetch()[1])
print(user_stmt:fetch()[1])
It gives me:
0
111
Although the correct answer should be:
nil
111
Or I would like to have some way to check whether a field was NULL.
From the well don't do that then
department:
local DBI = require "DBI"
local db = DBI.Connect("SQLite3", ":memory:");
local stmt = db:prepare("SELECT 1");
db:close()
stmt:execute()
This code segfaults, since the database conn is (obviously) no longer valid.
(gdb) bt full
#0 sqlite3_get_autocommit (db=0x0) at sqlite3.c:127785
No locals.
#1 0x00007ffff6c98368 in begin (conn=0x63af58) at dbd/sqlite3/connection.c:19
No locals.
#2 try_begin_transaction (conn=0x63af58) at dbd/sqlite3/connection.c:37
No locals.
#3 0x00007ffff6c98d51 in statement_execute (L=0x62c010)
at dbd/sqlite3/statement.c:193
n = 1
statement = 0x64ce38
p = <optimized out>
errflag = 0
errstr = <optimized out>
expected_params = <optimized out>
num_bind_params = 0
patching file Makefile
mkdir -p build
gcc -c -o build/dbd_common.o dbd/common.c -g -pedantic -Wall -O2 -shared -fpic
-I /usr/include/lua5.1 -I /usr/include/mysql -I
/usr/include/postgresql/internal -I /opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I .
gcc -c -o build/dbd_mysql_main.o dbd/mysql/main.c -g -pedantic -Wall -O2
-shared -fpic -I /usr/include/lua5.1 -I /usr/include/mysql -I
/usr/include/postgresql/internal -I /opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I .
In file included from /usr/include/mysql/mysql.h:71:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_version.h:1:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:72:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_com.h:1:30: error: expected ')' before '*' token
/usr/include/mysql/mysql_com.h:52:2: warning: ISO C does not allow extra ';'
outside of a function [-pedantic]
/usr/include/mysql/mysql_com.h:550:2: error: #endif without #if
/usr/include/mysql/mysql_com.h:551:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:73:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_time.h:1:1: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/mysql_time.h:1:1: warning: type defaults to 'int' in
declaration of 'type' [-Wimplicit-int]
/usr/include/mysql/mysql_time.h:2:1: error: expected identifier or '(' before
'}' token
/usr/include/mysql/mysql_time.h:2:3: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/mysql_time.h:2:3: warning: type defaults to 'int' in
declaration of 'MYSQL_TIME' [-Wimplicit-int]
/usr/include/mysql/mysql_time.h:4:2: error: #endif without #if
/usr/include/mysql/mysql_time.h:5:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:73:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_time.h:5:0: error: unterminated #ifndef
In file included from dbd/mysql/dbd_mysql.h:6:0,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql.h:127:23: warning: ISO C90 does not support 'long
long' [-Wlong-long]
In file included from /usr/include/mysql/mysql.h:131:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/typelib.h:2:43: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:3:45: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:15:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:16:48: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:17:29: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:18:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:18:30: error: unknown type name 'MEM_ROOT'
/usr/include/mysql/typelib.h:18:46: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:20:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:22:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:27:2: error: #endif without #if
/usr/include/mysql/typelib.h:28:1: warning: null character(s) ignored [enabled
by default]
In file included from /usr/include/mysql/mysql.h:146:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/my_alloc.h:1:5: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'for'
/usr/include/mysql/my_alloc.h:5:1: error: expected identifier or '(' before '}'
token
/usr/include/mysql/my_alloc.h:5:3: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/my_alloc.h:5:3: warning: type defaults to 'int' in
declaration of 'USED_MEM' [-Wimplicit-int]
/usr/include/mysql/my_alloc.h:10:3: error: expected specifier-qualifier-list
before 'USED_MEM'
/usr/include/mysql/my_alloc.h:8:16: warning: struct has no members [-pedantic]
/usr/include/mysql/my_alloc.h:30:2: error: #endif without #if
/usr/include/mysql/my_alloc.h:31:1: warning: null character(s) ignored [enabled
by default]
make: *** [build/dbd_mysql_main.o] Error 1
Original issue reported on code.google.com by [email protected]
on 14 Nov 2012 at 10:17
I got some gap like "ØîxÑ6" or partical content of an varchar field if i
fetch an enum field with lua-dbi
lua-dbi-0.5-2,lua-5.1.4-4,mysql-5.1.69,mysql-5.1.69 server,CentOS 6.4 64bit
mysql> describe dp_public;
+--------------------+-----------------------------+------+-----+----------+----
------------+
| Field | Type | Null | Key | Default |
Extra |
+--------------------+-----------------------------+------+-----+----------+----
------------+
| id | int(10) | NO | PRI | NULL |
auto_increment |
| destination_number | varchar(64) | NO | | |
|
| direction | enum('internal','external') | NO | | internal |
|
| bridge | varchar(64) | NO | | |
|
+--------------------+-----------------------------+------+-----+----------+----
------------+
mysql> select * from dp_public;
+----+--------------------+-----------+---------------+
| id | destination_number | direction | bridge |
+----+--------------------+-----------+---------------+
| 4 | playrand | internal | 172.20.120.76 |
+----+--------------------+-----------+---------------+
-- Logging
LOGLEVEL = "info"
-- Progname
PROGNAME = "doit.lua"
-- functions
function logger(message)
print(LOGLEVEL,"["..PROGNAME.."] "..message.."\n")
end
function mysqldp(u)
if u == nil then
return
end
local dbh = assert(DBI.Connect('MySQL', mydb, myuser, mypass, myhost))
--local sth = assert(dbh:prepare('SELECT `id`, `direction`, `bridge` FROM `dp_public` WHERE id=4 LIMIT 1'))
local sth = assert(dbh:prepare('SELECT `direction` FROM `dp_public` WHERE id=4 LIMIT 1'))
sth:execute()
row = sth:fetch ({}, "a")
if not row then
return
end
logger("row.direction " ..row.direction)
id = row.id
direction = row.direction
destination_number = row.destination_number
target = row.bridge
logger("direction "..direction)
dbh:close()
sth:close()
return id,destination_number,direction,target
end
number='playrand'
mysqldp(number)
lua doit.lua
info [sqluser.lua] row.direction internalØîxÑ6
info [sqluser.lua] direction internalØîxÑ6
Original issue reported on code.google.com by [email protected]
on 3 Jun 2013 at 1:40
Running this code:
local dbi = require('DBI')
local db = assert(dbi.Connect("MySQL", "test", "root", "", "localhost", 3306))
local sth = assert(db:prepare('SELECT 1 as id;'))
sth:execute()
row = sth:fetch(true)
print(row.id)
sth:close()
db:close()
I would expect to see `1` in the console. Instead, I see some float number like
`4.9406564584125e-324`
This is a problem because when you try to retrieve the id of the latest
inserted record with the query `SELECT LAST_INSERT_ID() as id`, you won't be
able to.
Original issue reported on code.google.com by [email protected]
on 10 Nov 2013 at 4:36
Please include a LICENSE/COPYING file containing the appropriate license. This
helps
users, packagers, and various automated tools... in addition to removing any
ambiguity as to
what license applies to the code.
You can find a template for MIT here:
http://www.opensource.org/licenses/mit-license.php
Original issue reported on code.google.com by MWild1
on 25 May 2010 at 5:09
When an output column name's length is divisible by 4, the returned column name may contain additional bytes when asking for columns() or by specifying that the query results be keyed by output column name. I have submitted a PR to fix.
hello.
simple: working/build luadbi with Lua 5.2?
greetings
Original issue reported on code.google.com by sL1pKn07
on 16 Oct 2013 at 9:11
Can be reproduced with e.g.
db = assert(require"DBI".Connect("MySQL", "prosody", "prosody", "secret", "127.0.0.1", 3306))
s = assert(db:prepare("SELECT 1 LIMIT ? OFFSET ?"))
assert(s:execute(1, 1))
A MySQL to test against can be brought up easily using:
docker run -d --rm --name mysql \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_USER=prosody \
-e MYSQL_PASSWORD=secret \
-e MYSQL_DATABASE=prosody \
-v mysql:/var/lib/mysql \
-p 3306:3306 \
mysql:8.0.23
Theory: MySQL expects integers in the LIMIT slot but LuaDBI is pushing floats, since before Lua 5.3, all numbers are.
See below
/*
* allocate a new string for the converted SQL statement
*/
newsql = (char *)malloc(sizeof(char) * (len+extra_space+1));
memset(newsql, 0, sizeof(char) * (len+extra_space+1));
Original issue reported on code.google.com by [email protected]
on 23 Jan 2014 at 5:14
Building OSX binaries is not easy. Does anyone have 32/64 bit Intel binaries
ready for download (mysql, postgre, sqlite)?
Original issue reported on code.google.com by [email protected]
on 24 Jan 2013 at 2:29
What steps will reproduce the problem?
1. Downloaded luadbi-0.5.0 and SQLite v.3.7.4
2. Put the .dll files in Lua/5.1/clibs/ and the DBI.lua in /Lua/5.1/lua/
3. Run the following Lua code:
<code>
require 'DBI'
local create_table = true
-- Create a connection
local dbh,err = assert(DBI.Connect('SQLite3', 'test.db'))
if not dbh then print(('could not do that: %s'):format(err)) end
-- Create a table
if create_table then
local suc, err = DBI.Do(dbh, 'CREATE TABLE "users1" ( "id" INTEGER NOT NULL, "name" TEXT NOT NULL, "email" TEXT NOT NULL, "password" TEXT NOT NULL, PRIMARY KEY ("id"));')
if not suc then print(('could not do that: %s'):format(err)) else print(('found %s'):format(suc)) end
end
-- Show available tables
local suc, err = DBI.Do(dbh, "SELECT name FROM sqlite_master WHERE type='table'
ORDER BY name;")
if not suc then print(('could not do that: %s'):format(err)) else print(('found
%s'):format(suc)) end
-- finish up
local ok = dbh:close()
</code>
What is the expected output? What do you see instead?
I was expecting the lines of the found tables. Didn't see any of them.
What version of the product are you using? On what operating system?
luadbi 0.5.0-win32, LuaforWindows 5.1.4-40, Windwos 7.
Please provide any additional information below.
The SQLite was downloaded from :
http://www.sqlite.org/sqlite-dll-win32-x86-3070400.zip
From what I can see with the dependancywalker the dbdsqlite3.dll is linking to
the C:\Program Files\...\Firefox\SQLite3.dll
Original issue reported on code.google.com by [email protected]
on 4 Jan 2011 at 6:44
Both postgresql and mysql support SSL connections and have various options that need to be supplied by the client. Presumably Oracle does too.
We would love to be able to connect our prosody instance to a remote database server over SSL.
Hello,
I just recently started with xmpp and prosody (0.9.12 on CentOS 7.3) which uses luadbi ( lua-dbi.x86_64 0.5-11.el7). I use postgresql (9.6.1) for all storage. Every now and then I get the following error after which I have to restart prosody:
kernel: lua[2581]: segfault at 0 ip 00007f276a7790b8 sp 00007fff01e2adb0 error 4 in dbdpostgresql.so[7f276a776000+4000]
systemd: prosody.service: main process exited, code=killed, status=11/SEGV
prosodyctl: Prosody is not running
systemd: prosody.service: control process exited, code=exited status=1
systemd: Unit prosody.service entered failed state.
systemd: prosody.service failed.
I substracted the base address from the ip to find out where the error occurs:
$ addr2line -e /usr/lib64/lua/5.1/dbdpostgresql.so -fCi 0x30b8
dbd_postgresql_statement_create
??:?
postgres log:
LOG: 08006: could not receive data from client: Connection reset by peer
LOCATION: pq_recvbuf, pqcomm.c:936
LOG: 08006: unexpected EOF on client connection with an open transaction
LOCATION: SocketBackend, postgres.c:341
LOG: 00000: disconnection: session time: 0:46:30.877 user=<username> database=<databasename> host=<hostname> port=33388
LOCATION: log_disconnections, postgres.c:4507
On a FreeBSD 13.0-RELEASE-p3 system, I'd like to use sqlite3.
$ tar -zxvf v0.7.2.tar.gz
$ cd luadbi-0.7.2/
$ LUA_V=52 LUA_INC=/usr/local/include/lua52 SQLITE_INC=/usr/local/include/ make sqlite3
cc -c -o build/dbd_common.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99 -O2 -pipe -I.
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-std=c99' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc -c -o build/dbd_sqlite3_main.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: -lsqlite3: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-std=c99' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I /usr/include' [-Wunused-command-line-argument]
cc -c -o build/dbd_sqlite3_connection.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: -lsqlite3: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc -c -o build/dbd_sqlite3_connection.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -sha
red -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: -lsqlite3: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc -c -o build/dbd_common.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -D
PIC -std=c99 -O2 -pipe -I.
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-std=c99' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc -c -o build/dbd_sqlite3_connection.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -sha
red -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: -lsqlite3: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-std=c99' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I /usr/include' [-Wunused-command-line-argument]
cc -c -o build/dbd_sqlite3_statement.o /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: warning: /usr/local/include/lua52: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: -lsqlite3: 'linker' input unused [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-pedantic' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-Wall' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-D PIC' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-std=c99' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
cc: warning: argument unused during compilation: '-I /usr/include' [-Wunused-command-line-argument]
cc build/dbd_common.o build/dbd_sqlite3_main.o build/dbd_sqlite3_connection.o build/dbd_sqlite3_statement.o -o dbd/sqlite3.so /usr/local/include/lua52 -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99 -O2 -pipe -I. -shared -I/usr/include -lsqlite3
cc: error: no such file or directory: 'build/dbd_common.o'
cc: error: no such file or directory: 'build/dbd_sqlite3_main.o'
cc: error: no such file or directory: 'build/dbd_sqlite3_connection.o'
cc: error: no such file or directory: 'build/dbd_sqlite3_statement.o'
*** Error code 1
Stop.
make: stopped in /usr/home/jabber2/luadbi-0.7.2
Hi Neil, this is a feature request. It would be nice to have access to column
names after a select.
LuaSQL provides a colnames function IIRC. This is handy for dealing with
metadata.
Not related, but in the MySQL statement.c, there is this code:
if (!statement->metadata) {
luaL_error(L, DBI_ERR_FETCH_NO_EXECUTE);
return 0;
}
if (!statement->metadata) {
lua_pushnil(L);
return 1;
}
I am not sure the second test is needed.
Original issue reported on code.google.com by [email protected]
on 7 Mar 2009 at 8:15
I occured a problem, when I tried to select a dataset from joined tables.
MySQL on CLI brings the right output:
mysql> SELECT
-> c.pos_x,
-> c.pos_y,
-> n.position_x,
-> n.position_y,
-> n.npcs_id
-> FROM npc_instances AS n
-> JOIN chunks AS c ON (c.pk_chunk_id = n.chunk_id);
+-------+-------+------------+------------+---------+
| pos_x | pos_y | position_x | position_y | npcs_id |
+-------+-------+------------+------------+---------+
| 1 | 1 | 120 | 645 | 2 |
| 1 | 1 | 600 | 150 | 3 |
| 1 | 1 | 600 | 270 | 1 |
+-------+-------+------------+------------+---------+
3 rows in set (0.00 sec)
When I select the same Statement via luadbi, the pos_x and pos_y values are
empty:
File: dbitest.lua
require('DBI')
local dbh = assert(DBI.Connect('MySQL', 'obg', 'root', 'NeverGonnaGiveYouUp',
'127.0.0.1', '3306'));
dbh:autocommit(true)
local select = assert(dbh:prepare([[
SELECT
c.pos_x,
c.pos_y,
n.position_x,
n.position_y,
n.npcs_id
FROM npc_instances AS n
JOIN chunks AS c ON (c.pk_chunk_id = n.chunk_id)
]])
);
select:execute();
for row in select:rows() do
print(table.concat(row, " | "));
end
Execution:
$ lua dbitest.lua
| | 120 | 645 | 2
| | 600 | 150 | 3
| | 600 | 270 | 1
I am Using:
Ubuntu 12.04.2 LTS (Precise)
lua-dbi-common Version: 0.5+svn78-2~precise1
lua-dbi-mysql Version: 0.5+svn78-2~precise1
mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64) using readline
6.2
Is there a bug in DBI or in the driver?
Do you need further information?
Original issue reported on code.google.com by [email protected]
on 8 May 2013 at 5:05
With luadbi and SQLite3 and pragma journal_mode=wal, there is no lock set on the DB file and the -shm file. Other processes using non-lua libraries accessing the DB do not notice that the DB is still in use and remove the WAL related files, leading to possible DB corruption or data loss. I experienced this running prosody-trunk on Debian Jessie.
With the non-lua sqlite3 commandline client, with pragma journal_mode=wal, the sqlite DB file (and the wal related -shm file) are locked with a read lock. When concurrent processes access the same DB, the temporary -wal and -shm files are remove not earlier than the last client removed its lock.
What are the steps to install this in a "Lua 4 Windows" environment? I tried
copying DBI.lua to the \lua\lua and the DLLs to \lua\clibs, but when i tried to
use it, got complaints about several missing DLLs.
Thanks,
glauber
Original issue reported on code.google.com by [email protected]
on 21 Oct 2010 at 8:27
You need to realize not everyone is going to have the same configuration as you
and that most people are dumb. Please create an autoconf system or at least
explain in the read me about library and include paths. You should have liblua
as a library for this as it won't build without it.
COMMON_LDFLAGS=-llua
That's all I did, and I had to change/add a few of the header include paths and
library include paths. Most people cannot do this. You could also autodetect
where lua modules are installed.
If you need help figuring out how to do so, try Google and look at examples of
other lua modules.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2012 at 1:40
Hi there,
we are in the process of pointing the FreeBSD ports collection to this repo as new location for LuaDBI. Currently the LuaDBI version in FreeBSD ports is "0.5". However we noticed that there are no version number tags in this repo.
Of course we could just map some git commit to version 0.5 on our side. But in a couple of months some other distribution might face the same problem. So it would be great if you could tag the appropriate git commit with something like "v0.5". Thanks :-)
References:
To reproduce: prepare, execute and close multiple SQL statements. Then, on the same connection, SELECT * FROM pg_prepared_statements
- all the previously closed statements are still listed, even though they should have been DEALLOCATEd.
A bisect suggests the problem started with commit b47c4b8.
What steps will reproduce the problem?
1. Create a table with an blob column
2. SELECT blobcolumn FROM sometable
3. You got an infinite loop :(
What is the expected output? What do you see instead?
return just and empty string
What version of the product are you using? On what operating system?
0.5 in Linux
Original issue reported on code.google.com by [email protected]
on 27 May 2012 at 3:31
mysql now supports unix socket, postgresql already has as you can see here:
http://www.postgresql.org/docs/8.3/static/libpq-connect.html (not tested)
test:
local db = require 'DBI'
local con = assert(db.Connect('MySQL', 'tupana', 'tupana', 'qX6MtLED',
'/tmp/mariadb.sock', nil))
Original issue reported on code.google.com by [email protected]
on 8 Feb 2014 at 6:09
Attachments:
I spent some time messing with the Debian luadbi package trying to get it work
with LUA 5.2 before I realised that this work had already been performed
recently. I arrived at a similar solution to the issue but there are a couple
of advantages to the way I did it that could be useful to apply.
Firstly, I have factored out the code that is used to register the LUA for
connection and statement objects into a single function. This means any
further changes can be made in one place.
Secondly, I have amended the registration code to no longer create global
variables or pollute the package.loaded table. This also allows the Connect
method to be simplified and not contain conditional code based on the LUA
version.
I have tested this with LUA 5.1 and LUA 5.2 against SQLite3 and DB2 and it is
working nicely for me. However, please note that I have never used the LUA C
API before this week so there may be subtle problems with the code I haven't
noticed.
I thought it was worth sharing though.
Original issue reported on code.google.com by [email protected]
on 14 Jun 2015 at 5:19
Attachments:
In
Line 221 in 73a234c
is_null
is defined as a pointer. This makes no sense - the pointer (0x0001
if you like) is invalid.
The documentation at https://dev.mysql.com/doc/refman/8.0/en/c-api-prepared-statement-data-structures.html says that you do not have to set is_null
at all where it is not used, and to (bool *)0
if you must (ie. NULL
, which is an acceptable pointer value). Setting a pointer directly to the constant 1
make no sense however.
It should be pretty easy to apply a Github webhook to automatically upload rockspecs to LuaRocks as soon as a version is tagged.
I'm nearing completion of an unrelated project that should make this dead simple. This issue is here as a reminder to myself to try it.
Whilst testing my changes to the LUA object registration I decided to test with
DB2 (as I have a soft spot for DB2 as I used to use it a lot). I noticed the
following test code does not work with the DB2 driver, although it works fine
with the SQLite3 driver:
local DBI = require 'DBI'
local dbh = assert(DBI.Connect('DB2', 'test'))
dbh:autocommit(false)
DBI.Do(dbh, 'DROP TABLE test')
DBI.Do(dbh, 'CREATE TABLE test (id integer not null primary key, value
varchar(255) not null)')
DBI.Do(dbh, "INSERT INTO test values (1, 'test1')")
DBI.Do(dbh, "INSERT INTO test values (3, 'test3')")
DBI.Do(dbh, "COMMIT")
local sth, err = assert(dbh:prepare('SELECT value FROM test WHERE id = ?'))
if sth == nil then
print('Error preparing statement: ', err)
os.exit()
end
local success, err = sth:execute(3)
if not success then
print('Error executing statement: ', err)
os.exit()
end
row = sth:fetch()
if row ~= nil then
print('3 found: ', row[1])
end
success, err = sth:execute(2)
if not success then
print('Error executing statement: ', err)
os.exit()
end
row = sth:fetch()
if row ~= nil then
print('2 found: ', row[1])
end
success, err = sth:execute(1)
if not success then
print('Error executing statement: ', err)
os.exit()
end
row = sth:fetch()
if row ~= nil then
print('1 found: ', row[1])
end
sth:close()
dbh:close()
print('Done')
The second and subsequent sth:execute calls fail due to an invalid cursor state
as the cursor is still open. I also noticed that the code is quite inefficient
because it allocates memory for the resultset after every execute rather than
when the statement is prepared.
The attached patch keeps track of whether the cursor is still open and closes
it when the statement is re-executed, if required. It also moves the code to
initialise the resultset into the statement_create function to avoid repeatedly
allocating the memory every time the statement is executed.
Any comments welcome.
Original issue reported on code.google.com by [email protected]
on 14 Jun 2015 at 5:26
Attachments:
I'm the Gentoo Linux maintainer for the luadbi package. Some of our users found
that luadbi doesn't correctly link with postgres on gentoo systems. Maybe you
can you look into fixing this. (Apparently the header can usually be found at
server/postgres_fe.h.)
More info: https://bugs.gentoo.org/show_bug.cgi?id=364141
Original issue reported on code.google.com by djc.ochtman
on 2 May 2011 at 4:20
What steps will reproduce the problem?
do the following in a loop:
1. local sth = dbh:prepare(sql)
2. sth:execute(...)
3. sth:fetch()
4. collectgarbage()
What is the expected output? What do you see instead?
the statement handles aren't being garbage collected and process vm size
grows, unless sth:close() is called explicitly
What version of the product are you using? On what operating system?
0.4 on Lua 5.1.4 (Linux)
Please provide any additional information below.
I'm digging around looking for what's holding references to the statement
handle udata, if I find it I'll submit a patch for review
Original issue reported on code.google.com by [email protected]
on 21 Apr 2010 at 5:33
Here are some improvements to makefile:
1) install support
2) destdir support
3) some kind of configuration support
So, it will fix #11 and #12, since it will be possible to add
PSQL_INC=-I/usr/include/postgresql/server
or
LUA_INC=-I/usr/include/luajit-2.0
and so on
Original issue reported on code.google.com by mva.name
on 12 May 2013 at 4:53
Hey folks, I think it's time we made a new release. Anyone feel inclined to take this on? If not, I can do it.
Any objections or blockers that anyone is aware of?
What steps will reproduce the problem?
1. Extract a fresh copy of luadbi-0.4
2. Run 'make free'
3. Fatal error: can't create build/dbd_common.o: No such file or directory
What is the expected output? What do you see instead?
Fatal error: can't create build/dbd_common.o: No such file or directory
"mkdir build" fixes it.
What version of the product are you using? On what operating system?
0.4 on Ubuntu 10.04
Please provide any additional information below.
Thanks for luadbi :)
Original issue reported on code.google.com by MWild1
on 25 May 2010 at 2:25
What steps will reproduce the problem?
1. Insert a string with a null character ("\000") into a blob field.
2. Check the database.
What is the expected output? What do you see instead?
I expect the full string, but I get the string until the first null character.
Attached patch fixes this issue.
Original issue reported on code.google.com by [email protected]
on 22 Sep 2013 at 10:20
Please consider making a binary package for Windows available through
"luarocks".
Original issue reported on code.google.com by [email protected]
on 22 Oct 2010 at 4:21
# make mysql
gcc -c -o build/dbd_common.o -g -pedantic -Wall -O2 -shared -fpic -I
/usr/include/lua5.1 -I /usr/include/mysql -I /usr/include/postgresql/ -I
/opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I .
gcc: No input files specified
*** [build/dbd_common.o] Error code 1
make script is broken? It comes from archive: luadbi.0.5.tar.gz.
Platform: FreeBSD.
Original issue reported on code.google.com by [email protected]
on 1 Aug 2013 at 10:47
I can not find describe in doc or test either this should works
sth = dbh:prepare("insert into my_table(?)")
sth:execute(1)
sth:execute(2)
patching file Makefile
mkdir -p build
gcc -c -o build/dbd_common.o dbd/common.c -g -pedantic -Wall -O2 -shared -fpic
-I /usr/include/lua5.1 -I /usr/include/mysql -I
/usr/include/postgresql/internal -I /opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I .
gcc -c -o build/dbd_mysql_main.o dbd/mysql/main.c -g -pedantic -Wall -O2
-shared -fpic -I /usr/include/lua5.1 -I /usr/include/mysql -I
/usr/include/postgresql/internal -I /opt/ibm/db2exc/V9.5/include/ -I
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public/ -I .
In file included from /usr/include/mysql/mysql.h:71:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_version.h:1:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:72:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_com.h:1:30: error: expected ')' before '*' token
/usr/include/mysql/mysql_com.h:52:2: warning: ISO C does not allow extra ';'
outside of a function [-pedantic]
/usr/include/mysql/mysql_com.h:550:2: error: #endif without #if
/usr/include/mysql/mysql_com.h:551:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:73:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_time.h:1:1: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/mysql_time.h:1:1: warning: type defaults to 'int' in
declaration of 'type' [-Wimplicit-int]
/usr/include/mysql/mysql_time.h:2:1: error: expected identifier or '(' before
'}' token
/usr/include/mysql/mysql_time.h:2:3: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/mysql_time.h:2:3: warning: type defaults to 'int' in
declaration of 'MYSQL_TIME' [-Wimplicit-int]
/usr/include/mysql/mysql_time.h:4:2: error: #endif without #if
/usr/include/mysql/mysql_time.h:5:1: warning: null character(s) ignored
[enabled by default]
In file included from /usr/include/mysql/mysql.h:73:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql_time.h:5:0: error: unterminated #ifndef
In file included from dbd/mysql/dbd_mysql.h:6:0,
from dbd/mysql/main.c:1:
/usr/include/mysql/mysql.h:127:23: warning: ISO C90 does not support 'long
long' [-Wlong-long]
In file included from /usr/include/mysql/mysql.h:131:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/typelib.h:2:43: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:3:45: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:15:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:16:48: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:17:29: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:18:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:18:30: error: unknown type name 'MEM_ROOT'
/usr/include/mysql/typelib.h:18:46: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:20:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:22:1: error: unknown type name 'TYPELIB'
/usr/include/mysql/typelib.h:27:2: error: #endif without #if
/usr/include/mysql/typelib.h:28:1: warning: null character(s) ignored [enabled
by default]
In file included from /usr/include/mysql/mysql.h:146:0,
from dbd/mysql/dbd_mysql.h:6,
from dbd/mysql/main.c:1:
/usr/include/mysql/my_alloc.h:1:5: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'for'
/usr/include/mysql/my_alloc.h:5:1: error: expected identifier or '(' before '}'
token
/usr/include/mysql/my_alloc.h:5:3: warning: data definition has no type or
storage class [enabled by default]
/usr/include/mysql/my_alloc.h:5:3: warning: type defaults to 'int' in
declaration of 'USED_MEM' [-Wimplicit-int]
/usr/include/mysql/my_alloc.h:10:3: error: expected specifier-qualifier-list
before 'USED_MEM'
/usr/include/mysql/my_alloc.h:8:16: warning: struct has no members [-pedantic]
/usr/include/mysql/my_alloc.h:30:2: error: #endif without #if
/usr/include/mysql/my_alloc.h:31:1: warning: null character(s) ignored [enabled
by default]
make: *** [build/dbd_mysql_main.o] Error 1
Original issue reported on code.google.com by [email protected]
on 14 Nov 2012 at 10:14
Hello,
There is a bug in the DB2 code. There is a reference to DBD_POSTGRSQL_CONNECTION instead of DBD_DB2_CONNECTION.
I've attach a patch file.
db2_connection.txt
What steps will reproduce the problem?
1. Download the zip release
2. Find no .dll libraries loadable by Lua.
What is the expected output? What do you see instead?
I expected to find dll files to load with Lua.
What version of the product are you using? On what operating system?
0.3
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Sep 2009 at 3:13
Selecting date datatypes using the MySQL driver causes a segfault.
Original issue reported on code.google.com by [email protected]
on 17 Sep 2009 at 11:30
I write ODBC driver for DBI library based on my Lua-ODBC library.
I slitly change tests:
select cast(? as <TYPE>) as retval
to test type encodings.returning id
because MySQL does not support it.For now I add DBI.lua
to my repo because I want run tests on Travis. But I will not add this to luarocks.
I add it only after you change main luadbi module so it can load ODBC driver. So i can just add luadbi as deps to my module.
PS.
I also add some tests to fetch
, close
, tostring
and execute same statement with different query multiple times
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.