0

I want to simulate the updating process's for my mysql table I want to insert every one second a data into mysql table in autaumatic way

the idea is to write a small loop with C API that support sql request (or any other languages) and execute this loop to insert data to mysql I read many topics here or in others forum but I need help to find how to implement the constraint of time ( every one second ).

2 Answers 2

2

Most languages have a sleep() function. In the loop sleep() for one second. PHP: Sleep() C: Sleep()

Sign up to request clarification or add additional context in comments.

1 Comment

thanks jim very good news for me ! but for the case of php how I start insert my data, that means my php script should be independent of my system so how to trigger the execution of my loop ?!
1

Sure, this is a standard load testing methodology:

 while (not done)
 {
      sleep (1);
      mysql.query("insert into table values (blah, blah, blah)");
 }

Probably you would want to run several instances of this program, and probably refine the use of sleep() to use greater precision based on how long the query took.

1 Comment

yes that's right I have many data to add, but I want to trigger the program just one time Thanks for your helpful post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.