Jump to content

MySQL as a single resource?


Recommended Posts

Posted

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!

Posted (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 by Sorata_Kanda
Posted
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.

~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.

~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.

 

  • Moderators
Posted

"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.

Posted

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

Posted (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 by LilDawage

RPG/CnR servers Developer , You want help ? contact me on discord >>>lilDawage#8508<<< i'm at your Service 10/24 hours 7/7 days , >>>Welcome<<<

Asking Discord Channel JOIN US ON here , you are welcome 10/24 active

Posted
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 

 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...