Question about MySQL and DINI.

Why MySQL is better than dini?

Dini saves the accounts in scripfiles whereas in MySQL everything is online. The most important advantage of MySQL is that you can create UCP for the server as fetching the data dynamically from MySQL is easy. No load on scriptfiles as everything is online. You can edit a user data from anywhere, no need to be in the script folder. There is a lot more you can do with the users in MySQL.
And Dini cant access Offline users while Mysql can
The other thing I like of MySQL server is that you can make a system that allows you to register from the fourm/website, no need to go in game for registering. So MySQL is the best!
And also Dini is outdated use Sqllite or MySql

They are two entirely different systems, but the main problem with dini specifically is that it's so incredibly slow and inefficient. For each transaction the file is opened and closed. Other systems open the file once, execute a bunch of transaction and then close the file once. The hard disk is still the slowest part in the computer and excessive IO access should be avoided.

You can compare both systems with a book.

When using DINI, reading one page with 20 lines on it, is similar to:
- getting the book from the shelf
- opening the book
- searching for the proper page and line
- reading the line
- closing the book
- putting it back onto the shelf

This entire list of actions must be performed for every line you want to read or write using DINI.

Other systems grab the book, open it, go to the proper page and read it entirely (every line on that page) before closing the book and putting it back onto the shelf.

The restriction to all those systems is that only you have access to the book because it's stored on a shelf at your home in a physical form.
The file exists only on your computer and can only be read from there.

When using MySQL, the file is stored on a server somewhere (a database is also just a file on some harddrive).
It can be accessed from anywhere and by any application, not just from your pc.
The book doesn't need to be opened/closed and taken/put back from the shelf.
MySQL keeps the file (database) open while the connection is open.

As an added bonus, MySQL has built-in systems like an index table which allows for very fast search and retrieval of a specific value.
Unlike normal files who don't have an index-table (or table of contents in a book to find each chapter), databases do have such systems.

A database also holds all data of all players at once, where most normal INI files only hold data about one specific player.

Finding the richest player for example would require your computer to open all files, find the money value (by looping through all lines starting from the first and keep reading it until it finds it) and read the value and store it in an array or something, close the file and move on to the next file. And finally sort all values before the list can be displayed.
If you have 1000 accounts (where each account-file may hold 100 lines and values to hold all data about a player), it means your pc needs to open and close 1000 files and probably read alot of data (100 lines) before it finds the money value in each file.

MySQL would simply access the proper table, find the money column and sort it.
Since the database has been opened when the connection was made, no files need to be opened/closed while searching for the data.
Searching the money value itself for each player is simply a lookup action, because the database knows at which byte in the database-file each money-value is stored.

And since SAMP/PAWN doesn't have a native function to browse all playerfiles in a directory, you need to depend on an external plugin that gives you that ability.
MySQL doesn't need that ability because it's all stored in one single table.

Forum Jump:

Users browsing this thread: 1 Guest(s)