0
기본적으로 콜백은 SQL 명령이 끝난 후에 실행해야하지만 어떤 이유로 콜백이 실행되지 않습니다.nodejs 인터페이스에서 SQLite3으로 콜백 할 때의 문제
create : function() {
var hit = false;
this.db.serialize(function() {
this.run("CREATE TABLE if not exists messages (phone_from CHAR(20) NOT NULL, phone_to CHAR(20) NOT NULL, message TEXT)");
this.run("CREATE TABLE if not exists forwarding (phone_1 CHAR(20) NOT NULL, phone_2 CHAR(20) NOT NULL, phone_bind CHAR(20) NOT NULL)");
this.get("SELECT * FROM FORWARDING;", function(err, row) {
hit = true; //<--- Why is this never being hit?
});
});
if (hit) {
this.insert_forwarding("+180","+18003214321","+18005432322");
console.log("Inserted initial forwarding address");
}
}
는 SELECT * FROM FORWARDING
SQL 명령을 실행에 관해서 명령 each, get, all
가 작동하지 않는 몇 가지 이유 :
이
내가 현재 가지고있는 코드입니다.내가 뭘 잘못하고 있니? 내가 이해하지 못하는게 뭐야?
감사합니다.