Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update has no effect on database #119

Open
dwome opened this issue Jan 21, 2021 · 2 comments
Open

Update has no effect on database #119

dwome opened this issue Jan 21, 2021 · 2 comments

Comments

@dwome
Copy link

dwome commented Jan 21, 2021

Hello,

I am trying to update some values in my database, but the transaction shows no effect. Do you have an idea what I am doing wrong here?

var con = fb.createConnection();
con.connectSync('pwrhsb.gdb'), 'SYSDBA', 'masterkey', '');
const query = 'UPDATE OBJEKT SET BEZ = 'ABCDEFG' WHERE OB_KEY = 25984';

const transaction = con.startNewTransactionSync();
const result = transaction.prepareSync(query);

result.execInTransSync(transaction);
transaction.commitSync();
@miiguelperes
Copy link

I have same problem

@miiguelperes
Copy link

In my case I was not doing the commit or the disconect, this way it worked:

return new Promise((resolve, reject) => {
var conn = fb.createConnection();
conn.connect(self.configuracoes.database,self.configuracoes.user,self.configuracoes.password,'',function(err){
if(self.reportError(err, query)) reject(err) ;
conn.query(query, function(err,qres){
if(self.reportError(err, query)) reject(err) ;
let obj = qres.fetchSync('all',true)
conn.commit(function(err){
console.log("Commit done ", err);
});
conn.disconnect();
resolve(obj)
});
});
conn.on('error',function(error){
reject(error)
console.log(error)
});

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants