Support mysql in new ptokax
 

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

Support mysql in new ptokax

Started by zigzagkms, 09 October, 2008, 08:15:10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zigzagkms

Please make support mysql and storage of the registered users in base. Very serious change and very necessary to all. Forgive for my English, work of the translator

ATAG

#1
Are you kidding? Anyway you can use mysql through lua... use it if you need it :)

zigzagkms

At present there is no working library allowing to work with mysql for API2. I use api2 only because I use personal scripts which all are written api2. Why the project luaSQL so a long time was not updated? Show me working library for work with mysql on ptokax 0.4.1.1

Fox_home

Quote from: ATAG on 09 October, 2008, 11:12:59
Are you kidding? Anyway you can use mysql through lua... use it if you need it :)
However, it would be easier, quicker and easier option to keep registered users and settings in the database  ::)

PPK

Quote from: zigzagkms on 09 October, 2008, 08:15:10
Please make support mysql and storage of the registered users in base. Very serious change and very necessary to all. Forgive for my English, work of the translator
If you want to have registered users in mysql you can do that from lua with LuaSQL library. I don't have any good reason to waste cpu and memory with storing them in database. It is not necessary and it is not needed by all (if that is not your name ;D).
Quote from: zigzagkms on 09 October, 2008, 13:02:06
At present there is no working library allowing to work with mysql for API2.
PtokaX lua api have nothing to do with external libs. Handling libs is part of lua base and PtokaX lua api don't change anything on that.
Quote from: zigzagkms on 09 October, 2008, 13:02:06
Why the project luaSQL so a long time was not updated?
You are asking on wrong place, you need to ask LuaSQL devs. Maybe it not need updates, last version is less than year old.
Quote from: zigzagkms on 09 October, 2008, 13:02:06
Show me working library for work with mysql on ptokax 0.4.1.1
As you want, screenshot attached 8)
Quote from: Fox_home on 09 October, 2008, 16:55:48
However, it would be easier, quicker and easier option to keep registered users and settings in the database  ::)
It will be harder, slower and using more resources.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

ATAG

Quote from: zigzagkms on 09 October, 2008, 13:02:06Show me working library for work with mysql on ptokax 0.4.1.1
Here you are:
require "luasql.mysql"
mysql = assert(luasql.mysql())

db_name	= "btit"
db_host = "localhost"
db_user = "btit"
db_pass = "xxxxxxxxxx"

con = assert(mysql:connect(db_name, db_user, db_pass, db_host)) 
cur = assert(con:execute("SELECT version()"))
Core.SendToAll("<mysql> MYSQL server version is: "..cur:fetch())
cur:close()

Core.SendToAll("<mysql> MYSQL driver version is: "..luasql._MYSQLVERSION)
Core.SendToAll("<mysql> "..luasql._COPYRIGHT)
Core.SendToAll("<mysql> "..luasql._DESCRIPTION)
Core.SendToAll("<mysql> "..luasql._VERSION)
con:close()
mysql:close()


Quote[19:05:12] <mysql> MYSQL server version is: 5.0.51a-3ubuntu5.1
[19:05:12] <mysql> MYSQL driver version is: 5.0.45
[19:05:12] <mysql> Copyright (C) 2003-2007 Kepler Project
[19:05:12] <mysql> LuaSQL is a simple interface from Lua to a DBMS
[19:05:12] <mysql> LuaSQL 2.1.1
[19:05:12] <PtokaX> *** ATAG started script: sql.lua

zigzagkms

1.lua:
Code: lua
require "luasql.mysql"
mysql = assert(luasql.mysql())

db_name = "testdb"
db_host = "localhost"
db_user = "adm"
db_pass = "****"

con = assert(mysql:connect(db_name, db_user, db_pass, db_host))
cur = assert(con:execute("SELECT version()"))
Core.SendToAll("<mysql> MYSQL server version is: "..cur:fetch())
cur:close()

Core.SendToAll("<mysql> MYSQL driver version is: "..luasql._MYSQLVERSION)
Core.SendToAll("<mysql> "..luasql._COPYRIGHT)
Core.SendToAll("<mysql> "..luasql._DESCRIPTION)
Core.SendToAll("<mysql> "..luasql._VERSION)
con:close()
mysql:close()


LuaSQL 2.1.1
MySQL 5.0.18-nt
msvcr80.dll (8.0.50727.42)

So has spread out files:
scripts\libs\luasql\mysql.dll
scripts\libs\libmysql.dll
msvcr80.dll


I struggled with it a lot of time, nothing turns out, help, what I do not so?

Result on a screenshot

Fox_home

#7
Quote from: PPK on 09 October, 2008, 18:00:28
It will be harder, slower and using more resources.
Using the database will be harder, slower and using more resources than the record / opening files?

Even so, support for storing user registration would more closely unite hub + site or hub + forum 8)

PPK

Quote from: Fox_home on 11 October, 2008, 04:23:23
than the record / opening files?
Regs are on startup loaded to memory, stored in hash table and sometimes saved to file.. database must save data to file sometimes too :P
Quote from: Fox_home on 11 October, 2008, 04:23:23
Even so, support for storing user registration would more closely unite hub + site or hub + forum 8)
Again, you can store them in database if you want with lua script ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Fox_home

#9
Assume there is a forum and want it to users to enter the hub of their login/pass and not to register again.
In such a case would have to edit the registration (on the forum) that data is also recorded in RegisteredUsers.xml?
In the case of storage other *.xml files in the database could be very easy-to write adminpage for the hub, and remotely edit the settings.

ATAG

Quote from: Fox_home on 11 October, 2008, 11:04:17In the case of storage other *.xml files in the database could be very easy-to write adminpage for the hub, and remotely edit the settings.
It's possible to write a simple http server in Lua and manage the hub through it, but it's more simplier to use the PtokaX Remote Administration utility :)

Fox_home

Quote from: ATAG on 11 October, 2008, 11:38:27
It's possible to write a simple http server in Lua and manage the hub through it, but it's more simplier to use the PtokaX Remote Administration utility :)
Thank you, I know about this method
I wanted to show that lisch hub with the support of MySQL will become even easier and more flexible.

zigzagkms

Help me please why at me a mistake gives out, what at once have broken off that? And why to not make support ptokax a database mysql, but on a choice of the user, wants let stores in files, and wants let uses mysql?

ATAG

I tried to use mysql on the gui version (with wine) and got just error "modul not found". I have no idea what's the problem, maybe the Lua5.1 incompatibility because it use the compat options to load the lua libs...

zigzagkms

Decisions of a problem at present do not exist? Except for as refusal of work on a platform windows. The embodiment of idea about ptokax mysql means most ptokax will not be?

SMF spam blocked by CleanTalk