Skip to content

Commit 76e3381

Browse files
committed
Added testing stubs
1 parent 8c95749 commit 76e3381

6 files changed

Lines changed: 15 additions & 9 deletions

File tree

4 DB in Python/MySQL Demo/DBconnectgrades.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pymysql as my
33

44
#root password is something you set when you install mysql on your system
5-
#the default may be blank; I used python123 for testing
5+
#the default may be blank; I used python123 for testing
66
#BE SURE to match your password to the password you set when installing MySQL. If in doubt, try a blank password
77
dbconn = my.connect (host='127.0.0.1',port=3306,user='root', password='python123', db='students')
88

4 DB in Python/MySQL Demo/StudentsDBdump.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE DATABASE IF NOT EXISTS `students` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */;
1+
CREATE DATABASE IF NOT EXISTS `students` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */;
22
USE `students`;
33
-- MySQL dump 10.13 Distrib 8.0.12, for macos10.13 (x86_64)
44
--
@@ -23,7 +23,7 @@ USE `students`;
2323

2424
DROP TABLE IF EXISTS `grades`;
2525
/*!40101 SET @saved_cs_client = @@character_set_client */;
26-
SET character_set_client = utf8mb4 ;
26+
SET character_set_client = latin1 ;
2727
CREATE TABLE `grades` (
2828
`GradeID` int(11) NOT NULL AUTO_INCREMENT,
2929
`Grade` float DEFAULT NULL,
@@ -32,7 +32,7 @@ CREATE TABLE `grades` (
3232
PRIMARY KEY (`GradeID`),
3333
KEY `UserID_idx` (`UserID`),
3434
CONSTRAINT `UserID` FOREIGN KEY (`UserID`) REFERENCES `user` (`id`)
35-
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
35+
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
3636
/*!40101 SET character_set_client = @saved_cs_client */;
3737

3838
--
@@ -51,7 +51,7 @@ UNLOCK TABLES;
5151

5252
DROP TABLE IF EXISTS `user`;
5353
/*!40101 SET @saved_cs_client = @@character_set_client */;
54-
SET character_set_client = utf8mb4 ;
54+
SET character_set_client = utf8 ;
5555
CREATE TABLE `user` (
5656
`ID` int(11) NOT NULL AUTO_INCREMENT,
5757
`FirstName` varchar(45) DEFAULT NULL,
@@ -60,7 +60,7 @@ CREATE TABLE `user` (
6060
`Password` varchar(45) DEFAULT NULL,
6161
`LastLogin` datetime DEFAULT NULL,
6262
PRIMARY KEY (`ID`)
63-
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
63+
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
6464
/*!40101 SET character_set_client = @saved_cs_client */;
6565

6666
--
0 Bytes
Binary file not shown.

4 DB in Python/SQLite Demo/vinventory.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
For example, the changemade variable does not update once the program is started.
44
So, if someone left the application open for a long time and made changes later, the data would not be accurate.
55
'''
6+
debug = False
67
import sqlite3
78
#importing Error this way let's us refer to it by this name instead of sqlite3.Error
89
from sqlite3 import Error
@@ -89,7 +90,8 @@ def update_data():
8990
sql = "UPDATE vaccines set arrivaldate = ? where id = ?"
9091
elif (feature == "6"):
9192
sql = "UPDATE vaccines set expirationdate = ? where id = ?"
92-
93+
if debug:
94+
print("Update SQL is:",sql)
9395
try:
9496
#if we call the connection execute method it invisibly creates a cursor for us
9597
conn.execute(sql, (update_value,update_ID))
@@ -127,7 +129,8 @@ def delete_data():
127129
now = datetime.datetime.now()
128130

129131
if conn:
130-
print ("Connected to database: ",conn)
132+
if debug:
133+
print ("Connected to database: ",conn)
131134
else:
132135
print("Error connecting to database.")
133136

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "/usr/local/bin/python3"
3+
}

6 Web Page with Flask/basic page/static/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ body {
22
margin: 0;
33
padding: 0;
44
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
5-
color: rgb(50, 77, 13);
5+
color: rgb(107, 141, 58);
66
}
77

88
/*

0 commit comments

Comments
 (0)