Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「存在しない場合に挿入」を行うための慣用的な方法は何ですか?
これはトランザクションなしで実行できますか?
たとえば、このコードを使用できます
db.query('select from v where rid = 23') .then(function (record) { if(record.length==0){ db.query('insert into v(rid) values (23)'); } });
それが役に立てば幸い。