URL:
<http://gna.org/bugs/?13643>
Summary: [RFC] Use lua for customizable database access
Project: Freeciv
Submitted by: mbook
Submitted on: Sunday 06/07/2009 at 04:44
Category: general
Severity: 3 - Normal
Priority: 3 - Low
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release:
Operating System: None
_______________________________________________________
Details:
I propose that the current auth code and all
future database interfacing code be written
in lua scripts.
This would have the following advantages:
- No need to recompile to change the way the
database is used (e.g. table field names,
sql statment format, etc.).
- Support for databases other than mysql.
- Easily extended beyond just auth.
For example longturn currently uses postgresql
instead of mysql, and warclient servers use
password salt.
The lua database bindings are provided by LuaSQL
(http://www.keplerproject.org/luasql/). It would
be added to the 'dependencies' directory, with
specific driver libraries only being compiled
and linked to the main server executable if the
corresponding database is detected by configure.
As a first step the lua integration would
proceed by combining much of the functionality
of the functions
authenticate_user
process_authentication_status
handle_authentication_reply
into a single script entry point (i.e. a function
that is expected to exist in the database script).
A stand-alone lua state is created for this script
in auth_init().
The lua function will need to return a status
value indicating how the connection should be
handled (e.g. 'accept', 'wait', 'reject').
The script would need to be able to manipulate
'user' objects, which correspond to 'struct
connection'. Methods should be provided which
allow access to at least 'id', 'name' and
'password' information. An alternative would
be to pass the required information to the
script function each time it is invoked.
Possibly all "auth" string occurences in the code
and in filenames should be changed to "database",
in preparation for future generalization.
I'll clarify and revise the details as I test out
a tentative implementation (though this will not
be very high priority for a while).
----------------------------------------------------------------
誰かが月を一口食いちぎたようだ。
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?13643>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev