added working routine to fill "user" table with data
This commit is contained in:
parent
24b01903ef
commit
ce8cf93f46
@ -1,13 +1,16 @@
|
|||||||
CREATE PROCEDURE prepare_data()
|
CREATE PROCEDURE prepare_data()
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE i INT DEFAULT 1;
|
DECLARE i INT DEFAULT 1;
|
||||||
|
DECLARE emailString CHAR(16) DEFAULT 'test';
|
||||||
|
|
||||||
|
|
||||||
WHILE i < 100
|
WHILE i < 100
|
||||||
DO
|
DO
|
||||||
|
SET emailString = CONCAT(emailString, CAST(i AS CHAR(16)), '@test.de');
|
||||||
INSERT INTO webshop.user(is_active, name, lower_name, email)
|
INSERT INTO webshop.user(is_active, name, lower_name, email)
|
||||||
VALUES ('1', 'harry', 'potter', 'test@test.de');
|
VALUES ('1', 'harry', 'potter', emailString);
|
||||||
SET i = i + 1;
|
SET i = i + 1;
|
||||||
end while;
|
end while;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CALL prepare_data();
|
#CALL prepare_data();
|
||||||
@ -10,7 +10,7 @@ const connection = mysql.createConnection({
|
|||||||
connection.connect(function (err) {
|
connection.connect(function (err) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
console.log("Connected to database")
|
console.log("Connected to database")
|
||||||
connection.query("SELECT * FROM user WHERE ID = 1", function (err, result) {
|
connection.query("SELECT * FROM webshop.user WHERE ID = 1", function (err, result) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
console.log(result)
|
console.log(result)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user