Execute query which is fetched from a table using MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ssharma
    New Member
    • Jun 2011
    • 3

    Execute query which is fetched from a table using MySQL

    I am using ruby on rails.
    Hence through my controller I am fetching the list of data(query strings saved in the database) on the basis of some condition. Now I need to execute these queries.
    Do any one know how to do this?
    Last edited by Frinavale; Nov 1 '12, 07:13 PM. Reason: This thread has been closed because the question is to vague. If you have a specific question about how to use MySql with Ruby/Ruby On Rails please start a new thread with your question.
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    You should be able to execute the queries in the same way you fetch them. If not, you could maybe use something like DBI to connect to the database.

    Comment

    • ssharma
      New Member
      • Jun 2011
      • 3

      #3
      hi improvcornartis t,
      I think you did'nt get me.
      I am using MySql and I have a table where one column namely "action" contains certain queries.
      Now, in controller I wrote a method which is able to fetch the data from the column but I want to execute the same.
      What will the command for that in ruby on rails.
      Thank you

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        They are saying that you can use the same command you use to fetch the data to execute the SQL string in the data that you fetched.

        Comment

        • ssharma
          New Member
          • Jun 2011
          • 3

          #5
          no not at all we can't.
          When the data is fetched from the table its just like a string fetching. Here, in the case the data fetched is in a query format itself eg( Select * from tablename). So, I need to apply the execution command on the data which is fetched through the method in the controller.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            How are you executing the query that gets the data in the first place?

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              This thread has been closed because the question is to vague. If you have a specific question about how to use MySql with Ruby/Ruby On Rails please start a new thread with your question.

              Comment

              Working...