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 committed 2016-02-28 16:20:33 +02:00
1 parent 7f0480c966
commit 4c66cfa49d
7 files changed
+190 -97

No files matched your search

+3 -7
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;
}
// ------------------------------------------------------------------------------------------------