mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-14 03:37:16 +01:00
140 lines
4.8 KiB
C++
140 lines
4.8 KiB
C++
|
#ifndef _SQMYSQL_RESULTSET_HPP_
|
||
|
#define _SQMYSQL_RESULTSET_HPP_
|
||
|
|
||
|
// ------------------------------------------------------------------------------------------------
|
||
|
#include "Handle/Result.hpp"
|
||
|
|
||
|
// ------------------------------------------------------------------------------------------------
|
||
|
namespace SqMod {
|
||
|
|
||
|
/* ------------------------------------------------------------------------------------------------
|
||
|
* Allows management and interaction with a result set.
|
||
|
*/
|
||
|
class ResultSet
|
||
|
{
|
||
|
private:
|
||
|
|
||
|
// --------------------------------------------------------------------------------------------
|
||
|
ResHnd m_Handle; // The managed result set.
|
||
|
|
||
|
public:
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Default constructor.
|
||
|
*/
|
||
|
ResultSet()
|
||
|
: m_Handle()
|
||
|
{
|
||
|
/* ... */
|
||
|
}
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Base constructor.
|
||
|
*/
|
||
|
ResultSet(const ResHnd & hnd)
|
||
|
: m_Handle(hnd)
|
||
|
{
|
||
|
/* ... */
|
||
|
}
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Copy constructor.
|
||
|
*/
|
||
|
ResultSet(const ResultSet & o) = default;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Move constructor.
|
||
|
*/
|
||
|
ResultSet(ResultSet && o) = default;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Destructor.
|
||
|
*/
|
||
|
~ResultSet() = default;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Copy assignment operator.
|
||
|
*/
|
||
|
ResultSet & operator = (const ResultSet & o) = default;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Move assignment operator.
|
||
|
*/
|
||
|
ResultSet & operator = (ResultSet && o) = default;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Used by the script engine to compare two instances of this type.
|
||
|
*/
|
||
|
Int32 Cmp(const ResultSet & o) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Used by the script engine to convert an instance of this type to a string.
|
||
|
*/
|
||
|
CSStr ToString() const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Used by the script engine to retrieve the name from instances of this type.
|
||
|
*/
|
||
|
static SQInteger Typename(HSQUIRRELVM vm);
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a signed 8 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetInt8(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve an unsigned 8 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetUint8(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a signed 16 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetInt16(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve an unsigned 16 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetUint16(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a signed 32 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetInt32(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve an unsigned 32 bit integer from a field.
|
||
|
*/
|
||
|
SQInteger GetUint32(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a signed 64 bit integer from a field.
|
||
|
*/
|
||
|
Object GetInt64(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve an unsigned 64 bit integer from a field.
|
||
|
*/
|
||
|
Object GetUint64(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a 32 bit floating point from a field.
|
||
|
*/
|
||
|
SQFloat GetFloat32(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a 64 bit floating point from a field.
|
||
|
*/
|
||
|
SQFloat GetFloat64(Uint32 idx) const;
|
||
|
|
||
|
/* --------------------------------------------------------------------------------------------
|
||
|
* Retrieve a boolean from a field.
|
||
|
*/
|
||
|
bool GetBoolean(Uint32 idx) const;
|
||
|
|
||
|
};
|
||
|
|
||
|
} // Namespace:: SqMod
|
||
|
|
||
|
#endif // _SQMYSQL_RESULTSET_HPP_
|