I am in a position where I need to call rail in an stored procedure, but I can Either breaks the MySQL connection, or else the pseudo hack can not return a large number of data.
Now my solution is to use system ()
and call the mysql
command line directly. I'm thinking that a less uncomfortable solution would be to free up the connections of active records of your own MySQL connection.
I have no reason to know why this would be bad but I do not even know it is 100% safe. It does not adequately know MySQL's indoors to solve my problem in a compact manner. In it there is a need to call a stored proc with controller functions, call a new database connection, call it and close it I can sacrifice some performances, but if it works then it is good enough to be the same The process solves the issue of many users (we are currently) we use in the shore rail, where it is finally safe now, because hacks have two SQL Snon need and I do not think I guarantees that I am using it to go active record of the same database connection through.
So, is this a bad idea and / or dangerous?
Ruby on Rails Usually save stored procedures, or implement any other commercial reasoning in the database . Someone can say that you are not following "railroad" to call a stored procedure beforehand.
But if you want to call the stored procedure, then there should be an IMO that opens another connection with Ruby system ()
with better to hide. The latter method will open some other connection with MySQL, plus it will raise the overhead of forking a process to run mysql client.
You should check out "by Mac Schmidt" This is a chapter on calling railworks stored procedures.
MySQL can handle more than one connection with each request, though this database will increase the load on the server. You should open the second connection in a 'lazy' way, only when you need it on a specific request.
However, if performance is important in this application, then you will not use the railroad! > :-)
(Fun!)
Comments
Post a Comment