return a script number with a weighted choice. */
| 2852 | |
| 2853 | /* return a script number with a weighted choice. */ |
| 2854 | static int |
| 2855 | chooseScript(TState *thread) |
| 2856 | { |
| 2857 | int i = 0; |
| 2858 | int64 w; |
| 2859 | |
| 2860 | if (num_scripts == 1) |
| 2861 | return 0; |
| 2862 | |
| 2863 | w = getrand(&thread->ts_choose_rs, 0, total_weight - 1); |
| 2864 | do |
| 2865 | { |
| 2866 | w -= sql_script[i++].weight; |
| 2867 | } while (w >= 0); |
| 2868 | |
| 2869 | return i - 1; |
| 2870 | } |
| 2871 | |
| 2872 | /* Send a SQL command, using the chosen querymode */ |
| 2873 | static bool |
no test coverage detected