-1
Je reçois une erreur qui dit:MySQL Node.js Erreur de syntaxe (ME CONDUIRE FOU)
C:\Users\Minh Lu\Desktop\MusicMediaWebApp\database\dbService.js:34
[0] con.query(sql, typeCast: function(field, next) {
[0] ^^^^^^^^
[0]
[0] SyntaxError: missing) after argument list
De ceci:
/* Retrieves a User model by ID */
getUserByID: function(ID, callback) {
this.tryConnect().getConnection(function(err, con) {
var sql = queries.getUserByID;
con.query(sql, typeCast: function(field, next) {
// We only want to cast bit fields that have a single-bit in them. If the field
// has more than one bit, then we cannot assume it is supposed to be a Boolean.
if ((field.type === "BIT") && (field.length === 1)) {
var bytes = field.buffer();
// A Buffer in Node represents a collection of 8-bit unsigned integers.
// Therefore, our single "bit field" comes back as the bits '0000 0001',
// which is equivalent to the number 1.
return(bytes[ 0 ] === 1);
}
return next();
}, ID, function (err, result) {
if (err) throw err;
// Call the callback function in the caller of this method so we can do something with this "result"
return callback(result); // [] if not found
});
});
},
Et je suis tellement confus quant à ce que la syntaxe erreur c'est? C'est la même méthode que dans la documentation: https://github.com/mysqljs/mysql#type-casting
Merci!
Oui, j'ai réalisé cela. Merci! –