static int
com_go(String *buffer,char *line __attribute__((unused)))
{
char buff[200], time_buff[32], *pos;
####
sprintf(buff,"%ld %s in set",
(long) mysql_num_rows(result),
(long) mysql_num_rows(result) == 1 ? "row" : "rows");
##
##
static void end_timer(ulong start_time,char *buff)
{
nice_time((double) (start_timer() - start_time) /
CLOCKS_PER_SEC,buff,1);
}
static void mysql_end_timer(ulong start_time,char *buff)
{
buff[0]=' ';
buff[1]='(';
end_timer(start_time,buff+2);
strmov(strend(buff),")");
}
##
##
static void nice_time(double sec,char *buff,bool part_second)
{
ulong tmp;
if (sec >= 3600.0*24)
{
tmp=(ulong) floor(sec/(3600.0*24));
sec-=3600.0*24*tmp;
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " days " : " day ");
}
if (sec >= 3600.0)
{
tmp=(ulong) floor(sec/3600.0);
sec-=3600.0*tmp;
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " hours " : " hour ");
}
if (sec >= 60.0)
{
tmp=(ulong) floor(sec/60.0);
sec-=60.0*tmp;
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff," min ");
}
if (part_second)
sprintf(buff,"%.2f sec",sec);
else
sprintf(buff,"%d sec",(int) sec);
}
##
##
static ulong start_timer(void)
{
#if defined( __WIN__) || defined( OS2) || defined(__NETWARE__)
return clock();
#else
struct tms tms_tmp;
return times(&tms_tmp);
#endif
}