aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-03-24 13:48:52 +0100
committerlonkaars <loek@pipeframe.xyz>2023-03-24 13:48:52 +0100
commita48660843cc0191b62865b54f29bd9b230589a5e (patch)
tree071f520c8ccc6caa0a209a2f812e210668f5d0dd
parentedbdc5e5893802e74b7d8043f7e1817f77ac1c3a (diff)
implement `spUpdateFlags`
-rw-r--r--dbinit/demo.sql1
-rw-r--r--dbinit/makefile3
-rw-r--r--dbinit/procedures.sql12
-rw-r--r--readme.md8
4 files changed, 23 insertions, 1 deletions
diff --git a/dbinit/demo.sql b/dbinit/demo.sql
index 2672489..56abc36 100644
--- a/dbinit/demo.sql
+++ b/dbinit/demo.sql
@@ -20,6 +20,7 @@ insert into `formula1`.`nationality` (`country`) values
("United states of America"),
("Japan"),
("North Korea"),
+ ("Australiƫ"),
("Gelderland zuid");
insert into `formula1`.`racetype` (`raceType`) values
diff --git a/dbinit/makefile b/dbinit/makefile
index 9e5d5d4..76f867f 100644
--- a/dbinit/makefile
+++ b/dbinit/makefile
@@ -33,7 +33,8 @@ data.sql:
# grant all database permissions (development only)
permissions:
- echo "grant all privileges on formula1.* to '$(USER)'@'$(HOST)';"
+ echo "grant all privileges on formula1.* to '$(USER)'@'$(HOST)';" | sudo $(SQL)
+ echo "grant file on *.* to '$(USER)'@'$(HOST)';" | sudo $(SQL)
# delete generated sql files
clean:
diff --git a/dbinit/procedures.sql b/dbinit/procedures.sql
index e69de29..b6b0042 100644
--- a/dbinit/procedures.sql
+++ b/dbinit/procedures.sql
@@ -0,0 +1,12 @@
+drop procedure if exists spUpdateFlags;
+
+delimiter $$
+create procedure spUpdateFlags(imgPath varchar(255))
+ begin
+ update `nationality` as `A`
+ set `A`.`flag` = (
+ select load_file(concat(imgPath, `country`, ".png")) as `flag`
+ from `nationality` as `B`
+ where `B`.`ID` = `A`.`ID`);
+ end$$
+delimiter ;
diff --git a/readme.md b/readme.md
index 1a20fdd..f5658a2 100644
--- a/readme.md
+++ b/readme.md
@@ -6,3 +6,11 @@
- [Driver images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Coureurs.zip)
- [Country images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Landen.zip)
- [Circuit images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Circuits.zip)
+
+## klaagmuur
+
+- de zip bestanden van brightspace moeten met het volgende commando uitgepakt
+ worden op \*nix systemen om de accenten op de landnamen te behouden:
+ ```bash
+ unzip -O IBM437 <zip>
+ ```