36#ifdef HAVE_FCDB_POSTGRES
37#include "ls_postgres.h"
39#ifdef HAVE_FCDB_SQLITE3
40#include "ls_sqlite3.h"
73#define SCRIPT_FCDB_LUA_FILE "database.lua"
75#define FCDB_CAPS "+fcdb"
81 const char *format, ...)
159 log_error(
"Database script '%s' does not define the required function "
164 log_verbose(
"Database script '%s' does not define the optional "
179 const char *format, ...)
255 log_error(
"Error loading the Freeciv database lua definition.");
272#ifdef HAVE_FCDB_MYSQL
280#ifdef HAVE_FCDB_POSTGRES
284#ifdef HAVE_FCDB_SQLITE3
297 log_error(
"Error loading the Freeciv database lua script '%s'.",
305 log_error(
"Error connecting to the database");
311 log_error(
_(
"Database capabilities not compatible with server"));
341 log_error(
_(
"Database not compatible. Freeciv caps: %s, DB caps: %s"),
381 log_error(
"Error closing the database connection. Continuing anyway...");
408 fcl->caller = caller;
int api_fcdb_specenum_open(lua_State *L)
bool has_capabilities(const char *us, const char *them)
#define log_verbose(message,...)
#define fc_assert_ret_val(condition, val)
#define log_fatal(message,...)
#define log_error(message,...)
int luascript_do_string(struct fc_lua *fcl, const char *str, const char *name)
int luascript_do_file(struct fc_lua *fcl, const char *filename)
struct fc_lua * luascript_new(luascript_log_func_t output_fct, bool secured_environment)
void luascript_destroy(struct fc_lua *fcl)
void(* luascript_log_func_t)(struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__
bool luascript_func_call_valist(struct fc_lua *fcl, const char *func_name, va_list args)
bool luascript_func_check(struct fc_lua *fcl, struct strvec *missing_func_required, struct strvec *missing_func_optional)
void luascript_func_init(struct fc_lua *fcl)
void luascript_func_add(struct fc_lua *fcl, const char *func_name, bool required, int nargs, int nreturns,...)
void create_md5sum(const unsigned char *input, int len, char output[MD5_HEX_BYTES+1])
void script_fcdb_free(void)
bool script_fcdb_do_string(struct connection *caller, const char *str)
bool script_fcdb_call(const char *func_name,...)
bool script_fcdb_init(const char *fcdb_luafile)
bool script_fcdb_capstr(void)
struct setting_list * level[OLEVELS_NUM]
struct server_arguments srvarg
void cmd_reply(enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *format,...)
void strvec_destroy(struct strvec *psv)
struct strvec * strvec_new(void)
#define strvec_iterate(psv, str)
#define strvec_iterate_end
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
TOLUA_API int tolua_common_a_open(lua_State *tolua_S)
TOLUA_API int tolua_common_z_open(lua_State *tolua_S)
TOLUA_API int tolua_fcdb_open(lua_State *tolua_S)
TOLUA_API int tolua_game_open(lua_State *tolua_S)