Code files

This commit is contained in:
Akhil
2017-07-31 11:33:31 +05:30
parent 073a63ebdd
commit b9ae409ec0
801 changed files with 17535 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
const mysql = require('mysql')
const db = mysql.createConnection({
user: 'root',
//password: 'pw-if-set',
//debug: true
})
db.query('CREATE DATABASE quotes')
db.query('USE quotes')
db.query(`
CREATE TABLE quotes.quotes (
id INT NOT NULL AUTO_INCREMENT,
author VARCHAR ( 128 ) NOT NULL,
quote TEXT NOT NULL, PRIMARY KEY ( id )
)
`)
const ignore = new Set([
'ER_DB_CREATE_EXISTS',
'ER_TABLE_EXISTS_ERROR'
])
db.on('error', (err) => {
if (ignore.has(err.code)) return
throw err
})
db.query(`
INSERT INTO quotes.quotes (author, quote)
VALUES ("Bjarne Stroustrup", "Proof by analogy is fraud.");
`)
db.end()