A transaction issue
Aperta
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 13.7k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I just found I can't do a transaction.
LOG: 'BEGIN', []
LOG: 'INSERT OR IGNORE INTO device_model (device_sn) VALUES (?);', ['abcdefg']
LOG: 'COMMIT', []
LOG: 'executeSql error -> ', 'cannot commit - no transaction is active'
My table.
CREATE TABLE IF NOT EXISTS device_model(device_sn TEXT PRIMARY KEY ON CONFLICT REPLACE NOT NULL, status TEXT, properties TEXT);
SqliteObject class
export class SQLiteObject {
private _objectInstance;
constructor() {
this._objectInstance = new SQL.Database();
}
public executeSql(statement: string, params: any): Promise<any> {
return new Promise((resolve, reject) => {
try {
console.log(statement, params);
const st = this._objectInstance.prepare(statement, params);
const rows: Array<any> = [];
while (st.step()) {
let row = st.getAsObject();
rows.push(row);
}
st.free();
const payload = {
rows: {
item: function (i) {
return rows[i];
},
length: rows.length
},
rowsAffected: this._objectInstance.getRowsModified() || 0,
insertId: this._objectInstance.insertId || void 0
};
resolve(payload);
} catch (e) {
console.log('executeSql error -> ', e.message);
reject(e);
}
});
}
}
Did I do something wrong?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
The reported entry point is SQLiteObject.executeSql, using SQL.Database; start by reproducing the logged BEGIN, INSERT OR IGNORE, and COMMIT sequence. Compare the transaction behavior with the SQLite table definition and determine the expected handling of the no-active-transaction error; done means the reported sequence has a clear, verified outcome.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, sqlite
- Ambito
- database
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100