Sorata_Kanda Posted October 6, 2018 Posted October 6, 2018 Hey everyone, as the title might tell you, I'm wondering what's more efficient: Having a single MySQL resource handling all the MySQL work and have something like a MySQL script in each of my scripts where I need it? At the moment, I use a single MySQL resource which manages all the MySQL stuff, but I'm not sure if that's the right way or not. It manages really everything related to MySQL where required: admin system, ticket system, etc. What's your opinion on that? Thanks in advance!
Dimos7 Posted October 7, 2018 Posted October 7, 2018 I use one resource for mysql but i don't use mysql module i use db functions
LyricalMM Posted October 7, 2018 Posted October 7, 2018 that's better for roleplay gamemodes with many scripts, because you can just use export functions for each file, but I agree with @Dimos7 to use db functions, easier to use
Sorata_Kanda Posted October 7, 2018 Author Posted October 7, 2018 (edited) I do use the db functions too, but I'm sort of worried that my meta.xml turns to a mess due to the amount of functions I export. Edited October 7, 2018 by Sorata_Kanda
AJXB Posted October 7, 2018 Posted October 7, 2018 2 hours ago, Sorata_Kanda said: I do use the db functions too, but I'm sort of worried that my meta.xml turns to a mess due to the amount of functions I export. The healthy thing to do is to make one resource and just export the functions. Otherwise, you're just repeating code and that's useless.
Discord Moderators Pirulax Posted October 9, 2018 Discord Moderators Posted October 9, 2018 "Healthy thing" Sure, exports are the fastest thing on earth, even faster than a Lamborghini without an engine. So, back on topic, they're slow af, so avoid using them if possible. Use db* functions instead whenever possible, and in case of dbPoll, please don't use -1, just give a callback function to dbQuery instead.
Sorata_Kanda Posted October 12, 2018 Author Posted October 12, 2018 I do use db* function, but the point of putting everything in one resource is not to create multiple database connections throughout multiple resources. Therefore you have one single resource handling MySQL stuff. But I didn't really notice any performance impact when using exported function. Also, why should I use a callback function instead of a -1? @Pirulax
LilDawage Posted October 12, 2018 Posted October 12, 2018 (edited) yeh Create one File : like getMyDatainfo () return Create table info about you database host name and pass ... Enable Exports info in meta ( getMyDatainfo) exports info database to all resources db = dbConnect( "mysql","dbname="..exports["file name"]:getMyDatainfo () [Colum].." ....................and same for others Edited October 12, 2018 by LilDawage
Dimos7 Posted October 12, 2018 Posted October 12, 2018 56 minutes ago, Sorata_Kanda said: I do use db* function, but the point of putting everything in one resource is not to create multiple database connections throughout multiple resources. Therefore you have one single resource handling MySQL stuff. But I didn't really notice any performance impact when using exported function. Also, why should I use a callback function instead of a -1? @Pirulax Because the server will froze till get answer from database so it better use callbacks
VenomOG Posted October 13, 2018 Posted October 13, 2018 SQLite will be better, sms me if you need help making a table with SQLite
ShayF2 Posted October 13, 2018 Posted October 13, 2018 You can use and improve my SQL Framework and run functions as exports.https://github.com/shaiof/Core-Loader/blob/master/core/sql_s.lua
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