1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-17 23:57:14 +02:00

Implemented RAII when modifying the stack before returning to sqrat inside SQLite module.

Also enabled the latest C++ revision in the project.
Various other fixes and improvements.
This commit is contained in:
Sandu Liviu Catalin
2016-02-28 16:20:33 +02:00
parent 7f0480c966
commit 4c66cfa49d
7 changed files with 190 additions and 97 deletions

View File

@ -129,15 +129,11 @@ Object Connection::GetLastInsertRowID() const
// Validate the handle
Validate();
// Obtain the initial stack size
const Int32 top = sq_gettop(_SqVM);
const StackGuard sg(_SqVM);
// Push a long integer instance with the requested value on the stack
_SqMod->PushSLongObject(_SqVM, sqlite3_last_insert_rowid(m_Handle));
// Obtain the object from the stack
Var< Object > inst(_SqVM, -1);
// Removed pushed values (if any)
sq_pop(_SqVM, sq_gettop(_SqVM) - top);
// Return the long integer instance
return inst.value;
// Get the object from the stack and return it
return Var< Object >(_SqVM, -1).value;
}
// ------------------------------------------------------------------------------------------------