1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Fixed a range error in the SQLite plugin when validating column indexes.

Added an extra flush overload to flush all elements in a handled manner.
Prefixed the Server table to not clutter the user space.
This commit is contained in:
Sandu Liviu Catalin 2016-03-13 13:39:17 +02:00
parent a00e8c964f
commit bab8146c89
5 changed files with 18 additions and 6 deletions

View File

@ -561,7 +561,7 @@ protected:
*/ */
bool CheckIndex(Int32 idx) const bool CheckIndex(Int32 idx) const
{ {
return (idx >= 0) && (idx < mColumns); return (idx >= 0) && (idx <= mColumns);
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------

View File

@ -526,6 +526,17 @@ public:
*/ */
Int32 Flush(Uint32 num); Int32 Flush(Uint32 num);
/* --------------------------------------------------------------------------------------------
* Flush all queries from the queue and handle errors manually.
*/
Int32 Flush(Object & env, Function & func)
{
// Validate the handle
Validate();
// Return the requested information
return Flush(m_Handle->mQueue.size(), env, func);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Flush a specific amount of queries from the queue and handle errors manually. * Flush a specific amount of queries from the queue and handle errors manually.
*/ */

View File

@ -221,6 +221,7 @@ void RegisterAPI(HSQUIRRELVM vm)
.Func(_SC("PopQueue"), &Connection::PopQueue) .Func(_SC("PopQueue"), &Connection::PopQueue)
.Overload< Int32 (Connection::*)(void) >(_SC("Flush"), &Connection::Flush) .Overload< Int32 (Connection::*)(void) >(_SC("Flush"), &Connection::Flush)
.Overload< Int32 (Connection::*)(Uint32) >(_SC("Flush"), &Connection::Flush) .Overload< Int32 (Connection::*)(Uint32) >(_SC("Flush"), &Connection::Flush)
.Overload< Int32 (Connection::*)(Object &, Function &) >(_SC("Flush"), &Connection::Flush)
.Overload< Int32 (Connection::*)(Uint32, Object &, Function &) >(_SC("Flush"), &Connection::Flush) .Overload< Int32 (Connection::*)(Uint32, Object &, Function &) >(_SC("Flush"), &Connection::Flush)
.SquirrelFunc(_SC("ExecF"), &Connection::ExecF) .SquirrelFunc(_SC("ExecF"), &Connection::ExecF)
.SquirrelFunc(_SC("QueueF"), &Connection::QueueF) .SquirrelFunc(_SC("QueueF"), &Connection::QueueF)

View File

@ -654,7 +654,7 @@ Array Statement::FetchArray() const
// Validate the handle // Validate the handle
Validate(); Validate();
// Return the requested information // Return the requested information
return FetchArray(0, m_Handle->mColumns-1); return FetchArray(0, m_Handle->mColumns);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -663,7 +663,7 @@ Array Statement::FetchArray(Int32 min) const
// Validate the handle // Validate the handle
Validate(); Validate();
// Return the requested information // Return the requested information
return FetchArray(min, m_Handle->mColumns-1); return FetchArray(min, m_Handle->mColumns);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -756,7 +756,7 @@ Table Statement::FetchTable() const
// Validate the handle // Validate the handle
Validate(); Validate();
// Return the requested information // Return the requested information
return FetchTable(0, m_Handle->mColumns-1); return FetchTable(0, m_Handle->mColumns);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -765,7 +765,7 @@ Table Statement::FetchTable(Int32 min) const
// Validate the handle // Validate the handle
Validate(); Validate();
// Return the requested information // Return the requested information
return FetchTable(min, m_Handle->mColumns-1); return FetchTable(min, m_Handle->mColumns);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -110,7 +110,7 @@ void Register_Misc(HSQUIRRELVM vm)
.Func(_SC("AddRadioStream"), &AddRadioStream) .Func(_SC("AddRadioStream"), &AddRadioStream)
.Func(_SC("RemoveRadioStream"), &RemoveRadioStream); .Func(_SC("RemoveRadioStream"), &RemoveRadioStream);
RootTable(vm).Bind(_SC("Server"), srvns); RootTable(vm).Bind(_SC("SqServer"), srvns);
RootTable(vm) RootTable(vm)
.Func(_SC("GetModelName"), &GetModelName) .Func(_SC("GetModelName"), &GetModelName)