Я использую NodeJS для вставки своих данных в таблицу.Я продолжаю получать эту странную ошибку.
Код выглядит следующим образом:
fs.watch('./Assetto1/results/', (eventType, filename) => {
console.log("EventType:"+eventType);
if (eventType == "rename") {
//Gets most recent .json file loads it using require
console.log("Debug: Rename");
console.log("./Assetto1/results/"+filename);
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1000);
result = require("./Assetto1/results/"+filename);
console.log(result.TrackName);
//extracts the data out of the file and puts it in mySQL table
connection.query('INSERT INTO results(1GUID, 1NAME, 1NATION, 1CARMODEL,
1CARSKIN, 1BESTTIME, 1TOTALTIME) VALUES (' +
race.getResultDriverGuid(result, 0)
+ ',' + race.getResultDriverName(result, 0) + ',' +
race.getResultDriverNation(result, 0) + ',' +
race.getResultDriverCarModel(result, 0) + ',' +
race.getResultDriverCarSkin(result, 0) + ',' +
race.getResultDriverBestLap(result, 0) + ',' +
race.getResultDriverTotalTime(result, 0) + ');');
}
})
Ошибка выглядит примерно так:
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near '!, -,mercedes_sls_gt3,Black_Falcon_Dubai_24H_2,159303,688052)' at line 1
at Query.Sequence._packetToError (/home/node_modules/mysql/lib/protocol/sequ ences/Sequence.js:47:14)
at Query.ErrorPacket (/home/node_modules/mysql/lib/protocol/sequences/Query. js:77:18)
at Protocol._parsePacket (/home/node_modules/mysql/lib/protocol/Protocol.js: 278:23)
at Parser.write (/home/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/home/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/home/node_modules/mysql/lib/Connection.js:91:28)
at Socket.<anonymous> (/home/node_modules/mysql/lib/Connection.js:502:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
--------------------
at Protocol._enqueue (/home/node_modules/mysql/lib/protocol/Protocol.js:144: 48)
at Connection.query (/home/node_modules/mysql/lib/Connection.js:200:25)
at FSWatcher.fs.watch (/home/main.js:49:14)
at FSWatcher.emit (events.js:182:13)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:130:12)
Emitted 'error' event at:
at Connection._handleProtocolError (/home/node_modules/mysql/lib/Connection.
js:425:8)
at Protocol.emit (events.js:182:13)
at Protocol._delegateError (/home/node_modules/mysql/lib/protocol/Protocol.j
s:390:10)
at Query.<anonymous> (/home/node_modules/mysql/lib/protocol/Protocol.js:153:
12)
at Query.emit (events.js:182:13)
at Query.Sequence.end (/home/node_modules/mysql/lib/protocol/sequences/Seque
nce.js:78:12)
at Query.ErrorPacket (/home/node_modules/mysql/lib/protocol/sequences/Query.
js:90:8)
at Protocol._parsePacket (/home/node_modules/mysql/lib/protocol/Protocol.js:
278:23)
at Parser.write (/home/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/home/node_modules/mysql/lib/protocol/Protocol.js:38:16)
Похоже, она получаетПравильная информация из JSON - и, очевидно, это не проблема.Но это не вставит это в мой стол.Я действительно не понимаю, что не так.Надеюсь, вы, ребята, можете мне помочь.