Eshtiz Posted January 31, 2012 Share Posted January 31, 2012 [2012-01-31 16:35:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:35:25] ERROR: call: failed to call 'mysql:query' [string "?"] [2012-01-31 16:35:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:35:25] ERROR: call: failed to call 'mysql:query' [string "?"] [2012-01-31 16:36:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:36:25] ERROR: call: failed to call 'mysql:query_fetch_assoc' [string "?"] [2012-01-31 16:37:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:37:25] ERROR: call: failed to call 'mysql:query_fetch_assoc' [string "?"] [2012-01-31 16:38:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:38:25] ERROR: call: failed to call 'mysql:query_fetch_assoc' [string "?"] [2012-01-31 16:38:47] ERROR: Client triggered serverside event itemResourceStarted, but event is not added serverside [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:53] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:53] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-01-31 16:38:53] ERROR: Client triggered serverside event attemptRegister, but event is not added serverside [2012-01-31 16:38:54] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:54] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:54] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:54] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:54] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:54] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:54] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-01-31 16:38:55] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:55] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:55] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:55] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:55] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:55] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:55] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-01-31 16:38:56] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:56] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:56] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:56] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:56] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-01-31 16:38:56] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-01-31 16:38:56] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-01-31 16:39:25] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-01-31 16:39:25] ERROR: call: failed to call 'mysql:query_fetch_assoc' [string "?"] script: -- connection settings local hostname = "lxx" local username = "xxx" local password = "xxx" local database = "xxx" local port = tonumber( get( "port" ) ) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local sqllog = false local countqueries = 0 -- connectToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR ! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end Link to comment
AeroXbird Posted January 31, 2012 Share Posted January 31, 2012 You require the mta-mysql module to use the MySQL resource in the valhalla gamemode. You will find the download link in the wiki article: https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL Link to comment
Eshtiz Posted February 2, 2012 Author Share Posted February 2, 2012 I got it. Full log when you start the server, login & register (tries, doesn't actually work). (Skype/teamviewer via PM would be appreciated) Server is on 1.1 [2012-02-01 15:11:13] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-02-01 15:11:13] ERROR: call: failed to call 'mysql:query' [string "?"] [2012-02-01 15:11:13] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-02-01 15:11:13] ERROR: call: failed to call 'mysql:query' [string "?"] [2012-02-01 15:12:13] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2012-02-01 15:12:13] ERROR: call: failed to call 'mysql:query_fetch_assoc' [string "?"] [2012-02-01 15:12:49] ERROR: Client triggered serverside event itemResourceStarted, but event is not added serverside [2012-02-01 15:12:50] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:50] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:50] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-02-01 15:12:50] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:50] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:50] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-02-01 15:12:50] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) [2012-02-01 15:12:53] ERROR: Client triggered serverside event attemptRegister, but event is not added serverside [2012-02-01 15:12:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-02-01 15:12:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:53] ERROR: mysql/connection.lua:206: attempt to call global 'mysql_escape_string' (a nil value) [2012-02-01 15:12:53] ERROR: call: failed to call 'mysql:escape_string' [string "?"] [2012-02-01 15:12:53] ERROR: account-system/s_account_system_sapphire.lua:678: attempt to concatenate local 'safepassword' (a boolean value) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now