SA-MP Forums Archive
fetching logs using a command y_ini - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: fetching logs using a command y_ini (/showthread.php?tid=655594)



Fetching last 10 transactions using MySQL R39 - div - 25.06.2018

Hello, i just made some logs using y_ini.. But i'm really noob in using yini, and can't use MySQL for logging, tho i know the way of fetching or inputting the value in MYSQL DB..


My question is like, I've made SM Logs.. How can i fetch data? for like i want to fetch last 10 transactions..


and also, how can i fetch last 10 transactions of a particular player?? like i want to fetch the transactions of a player named Div, it will show the last 10 transactions of him.. <= (this one from start, (not coding but theoritically like doing this that, or maybe if u can explain with codes, that would be best)


Fetching last transactions like in MySQL R39, we use "cache_get_field_content" etc..


Re: fetching logs using a command y_ini - GospodinX - 25.06.2018

Oh..It's really really hard(or impossibly) with y_ini...

For it's MySQL best,why you can't use them?


Re: fetching logs using a command y_ini - div - 25.06.2018

they're going to be really large..

I can fetch but idk how to break lines..


It's going to be like


Like, I will make a transactions tables like FROM, TO, AMOUNT, then fetch the content,


How will i break lines?

It will show in a continued series, like

FROM TO AMOUNT
DIV OTHERID $6969 (HOW TO BREAK A LINE HERE?)

and also, how to see MAX transactions only 10?


Re: fetching logs using a command y_ini - Sew_Sumi - 25.06.2018

MySQL is designed for this sort of thing, why are you reverting to Y_INI?

INI... INI Files... Not really for logging...


Jesus, even the logging plugin uses MySQL IIRC...


Re: fetching logs using a command y_ini - div - 25.06.2018

Please can you tell me how do i fetch last 10 Transactions only? Like it will fetch all the transactions done in past by that player.


Re: fetching logs using a command y_ini - Sew_Sumi - 25.06.2018

That'll be a simple query, that I won't know as I don't get into MySQL, but MySQL is designed for this sort of thing, ESPECIALLY if you are using it to report back a number of results.

Someone will probably throw you a random query which checks for the last 10 results from a database, but it is what MySQL was designed for.

Depends though if they'll spot it seeing as the title says y_ini... Ask a moderator to fix the title if you can't fix it yourself maybe to get it seen better.


Re: fetching logs using a command y_ini - Calisthenics - 25.06.2018

Post the table structure and what needs to be fetched.

Some documentation about what will be required for the query:
Limit rows to N: https://dev.mysql.com/doc/refman/5.5...imization.html
Order by asc/desc: https://dev.mysql.com/doc/refman/8.0...imization.html

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
even the logging plugin uses MySQL IIRC...
It does not. The log plugin is threaded while writing to file but will still need to read from files in PAWN thread to show the last lines and as it was mentioned, this is not suitable*

*reading whole file once to know the number of lines, reading the file for second time to extract only N last lines.


Re: fetching logs using a command y_ini - div - 25.06.2018

Well, since ITS for logging purpose, I will need to have it saved, won't be JUST 10 TABLES, BUT I WANT ONLY THE LAST 10 SENT/RECIEVED TRANSACTIONS TO BE SHOWN..


Like there's going to be a command /SMLOG(I made the command /SM)


It will show a dialogbox with the LAST 10 transactions of the player, WHETHER the monney is SENT or RECIEVED..