blob: 5f499ef555eb20b6581668fca642e741a0b9a178 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/bin/bash
cd $(dirname $0)
DBNAME=${LIGA_PLAYERS_DB_NAME}
curl 'https://msc.com.pl/cezar/download/baza.csv' | grep '^[0-9]' > baza.csv
mysql ${LIGA_MYSQL_CONNECTION_OPTS} --local-infile=1 $DBNAME -e "LOAD DATA LOCAL INFILE 'baza.csv'
REPLACE
INTO TABLE players
FIELDS TERMINATED BY ';' ENCLOSED BY '\"'
(ID, gname, sname, rank, loc1, info, loc2, flag1, flag2);
UPDATE players SET age = REPLACE(info, 'K', ''), sex = IF(POSITION('K' IN info), 'K', '');
UPDATE players SET info = NULL;
"
rm baza.csv
|