How to drop multiple tables in MySQL

After an experiment with a MediaWiki Wiki on my website, I decided that I preferred to use Joomla for my site content. I needed to delete the Wiki content to free up some space.

Deleting the wiki folder was easily done through FTP.
Deleting the database tables had the potential to be time consuming.
I used this SQL to find all the relevant tables and delete the WIKI tables with SQL statements.



Returned a list of tables like this….







wiki_interwiki  etc. etc.


Using a text editor (I like TextPad from Helios Software), create SQL to drop each table in the list.


drop table wiki_archive;

drop table wiki_categorylinks;

drop table wiki_externallinks;

drop table wiki_hitcounter;

drop table wiki_image;

drop table wiki_imagelinks;

drop table wiki_interwiki; etc. etc.


This deletes all the tables at once.







C Function – Add five minutes to current time

I needed to write a function which added five minutes to the current time in a LoadRunner script. This allowed a script to simulate appointment bookings for a web application.

The function could be modified to add more or less time, the clever bit was making sure that it handled the last few minutes of an hour properly.

For example.
13:56 + 5 minutes = 14:01

The function handles this by converting the 13 and the 56 into integers, doing the necessary sums and then converting the results back into strings which LoadRunner can use.

When the integers are converted back to strings, single digit number are displayed correctly e.g. 01,02,03 etc. rather than 1,2,3.

The function will not work in the last five minutes of the day because I haven’t added a function to add five minutes to 23:56 to get 00:01. (If you’re running tests this late, don’t use this function).



int iCurrentHour;

int iCurrentMinute;

int iTotalMinutes;

int iNextHour;

int iNextMinute;

char sTimeNow[6];

char sTimeInFiveMins[6];

char sTemporaryTimeValue[3];

char sCharCurrentHour[3];

char sCharCurrentMinute[3];

char sCharNextHour[3];

char sCharNextMinute[3];

lr_save_datetime(“%H”, TIME_NOW , “sCurrentHour”);

lr_save_datetime(“%M”, TIME_NOW , “sCurrentMinute”);

// Uncomment these next two lines if you need to test the function using alternative times.

// lr_save_string(“12”, “sCurrentHour”);

// lr_save_string(“58”, “sCurrentMinute”);

//Convert Hour and Minute into iHour and iMinute (integers)

//Convert Hours into Minutes

iCurrentHour = atoi(lr_eval_string(“{sCurrentHour}”));

iCurrentMinute = atoi(lr_eval_string(“{sCurrentMinute}”));

//Add 5 minutes to the current time



//If after the 54th minute in the hour, add 1 hour to the “hour” time and take 55 minutes off the “minute” time

if (iCurrentMinute>54)





//Convert integers back into strings

//The “if” statements make sure that the times are formatted correctly after the maths has been done.

//e.g. Five past One in the morning is 01:05, instead of 1:5


if (strlen(lr_eval_string(“{sCurrentHour}”))<2)


strcpy(sTemporaryTimeValue, “0”);

strcat(sTemporaryTimeValue, lr_eval_string(“{sCurrentHour}”));

sprintf(sCharCurrentHour, “%s”, sTemporaryTimeValue);

lr_save_string(sTemporaryTimeValue, “sCurrentHour”);



if (strlen(lr_eval_string(“{sCurrentMinute}”))<2)


strcpy(sTemporaryTimeValue, “0”);

strcat(sTemporaryTimeValue, lr_eval_string(“{sCurrentMinute}”));

sprintf(sCharCurrentMinute, “%s”, sTemporaryTimeValue);

lr_save_string(sTemporaryTimeValue, “sCurrentMinute”);



if (strlen(lr_eval_string(“{sNextHour}”))<2)


strcpy(sTemporaryTimeValue, “0”);

strcat(sTemporaryTimeValue, lr_eval_string(“{sNextHour}”));

sprintf(sCharNextHour, “%s”, sTemporaryTimeValue);

lr_save_string(sTemporaryTimeValue, “sNextHour”);



if (strlen(lr_eval_string(“{sNextMinute}”))<2)


strcpy(sTemporaryTimeValue, “0”);

strcat(sTemporaryTimeValue, lr_eval_string(“{sNextMinute}”));

sprintf(sCharNextMinute, “%s”, sTemporaryTimeValue);

lr_save_string(sTemporaryTimeValue, “sNextMinute”);


lr_output_message(“The current time is %s:%s”,lr_eval_string(“{sCurrentHour}”),lr_eval_string(“{sCurrentMinute}”));

lr_output_message(“The time in 5 minutes will be %s:%s”,lr_eval_string(“{sNextHour}”),lr_eval_string(“{sNextMinute}”));

return 0;