1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
tools/netease_music/manual-script/打印SQL.js

41 lines
1.5 KiB
JavaScript

// const mysql = require('mysql');
// await new Promise(function (resolve, reject) {
// //通过MySQL中方法创建连接对象
// var connection = mysql.createConnection({
// "charset": "utf8mb4",
// "host": "localhost",
// "user": "root",
// "password": "123456",
// "port": 3306,
// "database": ""
// });
// //开始连接
// connection.connect();
// var sql = `
// INSERT INTO comment ( comment_id, parent_comment_id, user_id, song_id, content, time, like_count, comment_type ) VALUES ?
// ON DUPLICATE KEY UPDATE content = VALUES(content), like_count = VALUES(like_count), comment_type = GREATEST(comment_type, VALUES(comment_type)), modify_time = CURRENT_TIMESTAMP
// `;
// var params = commentInfoList.map(commentInfo => [
// commentInfo.comment_id,
// commentInfo.parent_comment_id,
// commentInfo.user_id,
// commentInfo.song_id,
// commentInfo.content,
// commentInfo.time,
// commentInfo.like_count,
// commentInfo.comment_type
// ]);
// var formattedSql = connection.format(sql, [params]); // 返回一个格式化后的SQL字符串
// console.log(params); // 打印原始SQL语句
// console.log(formattedSql); // 打印原始SQL语句
// //最后需要关闭连接
// connection.end();
// });
// process.exit(0);
// node index --utils comment --min 1935500000 --max 1935550000 --limit 10