Nismo_Gleichu Posted October 16, 2017 Share Posted October 16, 2017 (edited) Look this https://ibb.co/cfRLam I have problem with dpCore from Drift Paradise ;x Database.lua --- Основной модуль для работы с базой данных -- @module dpCore.Database -- @author Wherry Database = {} local dbConnection --- Выполняет подключение к базе данных. -- Для подключения используются параметры из DatabaseConfig -- @treturn bool удалось ли подключиться к БД function Database.connect() if isElement(dbConnection) then outputDebugString("WARNING: Database.connect: connection already exists") return false end local host = DatabaseUtils.prepareDatabaseOptionsString { host = DatabaseConfig.host, port = DatabaseConfig.port, dbname = DatabaseConfig.dbName } local options = DatabaseUtils.prepareDatabaseOptionsString(DatabaseConfig.options) dbConnection = Connection( DatabaseConfig.dbType, host, DatabaseConfig.username, DatabaseConfig.password, options ) if not dbConnection then outputDebugString("ERROR: Database.connect: failed to connect") root:setData("dbConnected", false) return false end root:setData("dbConnected", true) return true end --- Возвращает MTA-элемент подключения к БД -- @treturn element подключение function Database.getConnection() if not isElement(dbConnection) then dbConnection = nil end return dbConnection end --- Отключается от базы данных -- @treturn bool удалось ли отключиться от база данных function Database.disconnect() if not isElement(dbConnection) then outputDebugString("WARNING: Database.disconnect: no connection") return false end dbConnection:destroy() dbConnection = nil return true end Edited October 16, 2017 by Nismo_Gleichu Link to comment
Administrators Lpsd Posted October 17, 2017 Administrators Share Posted October 17, 2017 (edited) Hey guys, look at this random chunk of code. Can you try and decipher what problem I'm having without giving you any information whatsoever? First of all it might help to tell us what exactly the problem is. What errors are you getting? Where are your database connection details? Edited October 17, 2017 by LopSided_ 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