Lua-SQLite for 0.3.6.0d and newer
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Lua-SQLite for 0.3.6.0d and newer

Started by PPK, 07 December, 2007, 20:21:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PPK

Updated to use with newer PtokaX versions and updated SQLite from 3.2.7 to 3.5.3 :)

Binary: PXLua-SQLite-0.4.1-SQLite-3.5.3.7z

Source: PXLua-SQLite-0.4.1-SQLite-3.5.3-src.7z
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall


PPK

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PPK

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000


Nickolya

Quote from: Setuper on 24 June, 2008, 13:14:49
I cann't create more the one table in the base   >:(
Yes, I have this problem too & at all versions of libs & hubs...  :'(
Wanted to use SQLite in my new scripts but can not to do it. Can somebody help with this, please?!
Error after db:prepare in try to create second table: "SQL logic error or missing database". With one table in db it works perfectly.
P.S. Sorry for my bad english.  :D

Nickolya

The question is already actual :) Can somebody make workable library for new PtokaX to work with SQL database? It's too good thing to forget about it! ;)

zigzagkms

I require in working libraries mysql for ptokax 0.4.1.1, would combine ptokax and mysql without connection of additional libraries, functions most ptokax. Really nobody нуждаеться in it except for me? I do not think that this process is too combined in realization while it is necessary for much and would be very useful in a writing of scripts, would make and ptokax was the best is conclusive.. Forgive for my English, work of the translator

ATAG

#9
Quote from: Nickolya on 15 July, 2008, 10:57:23
Yes, I have this problem too & at all versions of libs & hubs...  :'(
Wanted to use SQLite in my new scripts but can not to do it. Can somebody help with this, please?!
Error after db:prepare in try to create second table: "SQL logic error or missing database". With one table in db it works perfectly.
P.S. Sorry for my bad english.  :D
I use it with several tables without any problems (on nix)

require "luasql.sqlite3"
env = assert(luasql.sqlite3())
con = assert(env:connect("test.db"))

assert(con:execute("CREATE TABLE test1 (id integer prinary key, data text)"))
assert(con:execute("CREATE TABLE test2 (id integer prinary key, data text)"))
con:close()
env:close()
UDPDbg.Send("[LUA] 2 tables created successfully :)")


Quote[12:12:35] 2 tables created successfully :)

PS: there isn't any problem likewise with mysql

Nickolya

Yes, on nix it works nice, but we can't make scripts for all with using sqlite because a lot of hubs works at windows, and win lib is not usable, I tryed to work with it, so it's probably to create second table and row in db, and query with "WHERE" don't return any row or return all table. Can't U try to rebuild the win lib, pleeze?!?!
Offtop: F**ken Windows...

And second question: why ptokax use not original libs (with Px at begining), as I know, it's aviable to make programm that use standart lua.dll, can't U make hub without this changes, and we will be able to use all lua libs in our scripts, like at *nix?

Snooze

FYI: I've had a few goes at mysql on ptokax.

I had great success on older versions, though after API2 I've been unable to do ex. updates to exsisting tables when dealing with multible tables.
This could be due to lack of skills/understanding, though I must say that I've done more than enough testing, that those should be ruled out.

I strongly suggest that the convert to ptokax had a bad impact on this lib rendering semi-useless.

That said, I 100% back the suggestion that doing userreg listing in a sqlite style is a bad idea.
Mostly due to the superb job done by PPK in optimizing the internal version, but also in that sqlite is far slower than even simple tables, unless you're dealing with HUGE numbers (10.000+).

Greets,
Snooze

PPK

Quote from: Nickolya on 10 October, 2008, 18:25:06
as I know, it's aviable to make programm that use standart lua.dll
Here is no standard lua.dll. Lua is released as source, any available libraries are everything but not standard.
Afaik most popular are lua binaries from luaforge, but they can't be used for PtokaX for many reasons (they changing library names, no binary compatible with 32 bit PtokaX compiler, bad compiler settings for 64 bit version that make it impossible to use with 64 bit PtokaX...).
Another reason why is not possible to use some available lua libs is that pxlua have changed memory management and fixed some bugs (for example crash on division by zero).
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Nickolya

Ok, thx for explain. And can't U make a little guide how to compile libs for new api (we can't understand about name mangling, no _ in begin of functions), for VS or borland, for example. With old api version it's all ok. Will be very glad to know this. Thanks!

PPK

PtokaX lua api have nothing to do with libs. _ was on function begin in older versions because they use C calling convention, and calling convention was changed when CrazyGuy reported that pxlua is slow to fastcall calling convention (using cpu registers for passing function parameters and in testing script it take 33 % less cpu time to finish).
You can use source of any of libs compiled by me to see how to compile libs, only thing that you need to change is that calling convention in compiler settings  8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PPK

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

CrazyGuy

#16
There's a small problem with the lua files in the script folder included in the package.

Search "sqlite3.lua" and "luasql-sqlite3.lua" for
local init, error = package.loadlib("pxsqlite3", "luaopen_pxsqlite3")


And replace this with
local init, error = package.loadlib("pxsqlite3.dll", "luaopen_pxsqlite3")


That should do the trick when having the PxSqLite3.dll in the root folder of PtokaX :)
Otherwise the path must also be specified relative to the PtokaX folder (i.e. "./scripts/libs/pxsqlite3.dll")

Quote from: package.loadlib (libname, funcname)This is a low-level function. It completely bypasses the package and module system. Unlike require, it does not perform any path searching and does not automatically adds extensions. libname must be the complete file name of the C library, including if necessary a path and extension.

SMF spam blocked by CleanTalk