Guest User

Untitled

a guest
Jul 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #
  2. # usage: gendata 10000 # Generates 20000 rows data approx.
  3. #
  4.  
  5. gendata(){
  6.  
  7. (
  8. cat <<EOF
  9. use test;
  10.  
  11. drop table if exists thavatab;
  12.  
  13. create table thavatab(name char(144), no integer primary key);
  14. EOF
  15.  
  16. echo "insert into thavatab values ('hello', 1 );"
  17. i=1
  18.  
  19. if [ -n "$1" ]
  20. then
  21. limit=$1
  22. else
  23. limit=10000
  24. fi
  25.  
  26. while [ $i -lt $limit ]
  27. do
  28. echo "insert into thavatab select 'hello', $i+no from thavatab;"
  29. ((i=$i*2))
  30. done
  31.  
  32. ) | mysql -u root
  33.  
  34. }
Add Comment
Please, Sign In to add comment