node.js如何利用studio 3T工具来连接数据库

node.js如何利用studio 3T工具来连接数据库,第1张

下面是查询数据库的类,sql 在外部传入,通过回调把结果返回。可以在其他地方初始化实例或者继承此类从而达到连接的目的

[javascript] view plain copy

'use strict'

var mysql = require('mysql')

function DB() {

if (this instanceof DB) {

this.connect()

} else {

throw {

error_msg: 'Please create the constructor of DB like this: "var _db = new DB()"'

}

}

}

DB.prototype.connect = function() {

this.DATABASE = 'philip'

this.client = mysql.createConnection({

user: 'root',

password: '123456',

})

您是想问数据已经传入studio3T数据库但是数据库没有显示怎么办?数据已经传入studio3T数据库但是数据库没有显示的解决办法是修改code码为0。原因是前后端请求格式不匹配,数据格式和和前端要求一致即可


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/9583863.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存