#!/bin/bash

##
## create table ft1 with one fulltext column:
##
mysql -B test <<EOF
drop table if exists ft1;

CREATE TABLE ft1 (
  data text NOT NULL,
  FULLTEXT KEY data (data)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

EOF

max=1000

##
## fill table with data:
##
i=0
while [ $i -lt $max ] ; do
  i=$(($i + 1))
  echo "insert into ft1 values ('textstring');"
done | mysql -B test 

##
## loop endless selecting data.
##
## on success (regardless if there is a match) print a . on success
## or print the mysql error message.
##
while true ; do
  mysql -B test -e "select match (data) against ('something'), data \
      from ft1 where  match (data) against ('something')" > /dev/null
  if [ $? = 0 ] ; then
      echo -n .
  fi
done

exit 0

