- fixed database fill script
- added new query script
This commit is contained in:
parent
0b58034238
commit
641d14a2dd
@ -3,8 +3,6 @@ BEGIN
|
|||||||
DECLARE i INT DEFAULT 1;
|
DECLARE i INT DEFAULT 1;
|
||||||
DECLARE emailString CHAR(16) DEFAULT 'test';
|
DECLARE emailString CHAR(16) DEFAULT 'test';
|
||||||
|
|
||||||
DELETE FROM webshop.user;
|
|
||||||
|
|
||||||
WHILE i < 100
|
WHILE i < 100
|
||||||
DO
|
DO
|
||||||
SET emailString = CONCAT(emailString, CAST(i AS CHAR(16)), '@test.de');
|
SET emailString = CONCAT(emailString, CAST(i AS CHAR(16)), '@test.de');
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -9,11 +9,9 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"app-root-path": "^3.1.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"app-root-path": "^3.1.0",
|
|
||||||
"dotenv": "^16.4.5",
|
|
||||||
"express": "^4.21.1",
|
|
||||||
"express-session": "^1.18.1",
|
"express-session": "^1.18.1",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"mysql2": "^3.12.0",
|
"mysql2": "^3.12.0",
|
||||||
|
|||||||
17
scripts/query/get_products.js
Normal file
17
scripts/query/get_products.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const mysql = require('mysql');
|
||||||
|
|
||||||
|
const connection = mysql.createConnection({
|
||||||
|
host: "localhost",
|
||||||
|
user: "root",
|
||||||
|
password: "",
|
||||||
|
database: "webshop"
|
||||||
|
})
|
||||||
|
|
||||||
|
connection.connect(function (err) {
|
||||||
|
if (err) throw err
|
||||||
|
console.log("Connected to database")
|
||||||
|
connection.query("SELECT * FROM webshop.product LIMIT 10", function (err, result) {
|
||||||
|
if (err) throw err
|
||||||
|
console.log(result)
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user