I have a dll file from the MySQL official and I want to use it to create a plug-in to the C# that would use this class.
What you need to do for this?
Solved Using official MySQL DLL?
Discussion in 'Rust Development' started by TheRyuzaki, Jun 9, 2015.
-
Wulf Community Admin
MySQL is already provided by Oxide via the Oxide.Ext.MySql extension. http://oxidemod.org/extensions/mysql-extension.901/
-
Please explain - why are you constantly after each send close connection to the database, as long as I use a database - I did not close concatenate, and a maximum of what was happening - it proy timeout connectings - and then I did reconnect and everything was fine.
After a connection to the database is also to spend time. And if it is at the request kazhdm - why such a class?
[DOUBLEPOST=1433826611][/DOUBLEPOST]
And my friends are faced with a problem for a large request - serv begins to hang out.
is it possible to make a request was not expecting an answer - that would perform particular tasks or stream?Last edited by a moderator: Jun 9, 2015 -
If you create a connection once per query/transaction, it is much easier to manage "closing" these connections.
I can see why you'd want to open one and use it throughout, but this will most likely cause issues with multithreading. So basically you'd want to open a connection pool and this is actually what the .NET framework already does (https://msdn.microsoft.com/en-us/library/8xx3tyca(v=vs.71).aspx).
When you open a connection when you need it and then dispose of it after running the query/transaction, it will not actually close the connection but it will just return it to the connection pool so that it can be used again.
And regarding large requests that freeze the server, if you are using C# you can run the query in a separate thread, if you are using another languague you will probably need a C# wrapper plugin that runs them in a separate thread for you. -
But what about the black list of names of space that I have seen in the source code, there are prohibited "NET", "IO", and separate streams
The only thing - there nebylo prohibited tasks.
[DOUBLEPOST=1433840512][/DOUBLEPOST]And anyway,thendoso-so that peoplethemselves canclose theconnection to thebase,because sometimesyou need toperforma number of requestsat once.
[DOUBLEPOST=1433840626][/DOUBLEPOST]And no one answered the question, I have to work it biltioteka with "Mysql" from the developers themselves "Mysql"
How do I connect it to my plugin that can use it?
[DOUBLEPOST=1433844599][/DOUBLEPOST]Code:public string GetOne(string SQL) { try { MySqlCommand myCommand = new MySqlCommand(SQL, myConnection); return myCommand.ExecuteScalar().ToString(); } catch { return "FALSE"; } } public void query(string SQL) { MySqlCommand myCommand = new MySqlCommand(SQL, myConnection); myCommand.ExecuteNonQuery(); }
ExecuteNonQuery, ExecuteScalar - Well, I believe you and I will use your library))
[DOUBLEPOST=1433844638][/DOUBLEPOST]But I'm still against the closure of the database connection. -
-
I just plan on PvE content will develop and - setting, achievements, titles, profession and yet it's not so hard to do - how to write kernel work with the database. The structure with the interaction.
And sometimes if konekt will close after a few queries kgda I will collect a large request and otprovlyat it - it will impact greatly on the performance. -
You need to be running all your queries in a separate threads.
-
Here is an example base characters, and the server it runs on the server when online 5000 online
http://wiki.ytdb.ru/index.php/Charactersdb_struct
[DOUBLEPOST=1433854030][/DOUBLEPOST][ru] То есть можно выполнить вот так вот:
[en] That is, you can do so here:
Code:QueueWorkerThread( { Puts("Hi! I new Thread ))"); });
[en] And it will work? -
I just remember doing such a thing when he created a multi-threaded server on a TCP
Code:this.Invoke(new Action(() => { MessageBox.Show("I dont delegat thread"); }));
[DOUBLEPOST=1433863138][/DOUBLEPOST]It does not work is not one of the options ....
Give please example
[DOUBLEPOST=1433869005,1433856331][/DOUBLEPOST]forum sleeping =(
solution:
Code:QueueWorkerThread(delegate { Puts("test"); });