mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Add method to return strings from MySQL result-set.
This commit is contained in:
parent
7836f0ab23
commit
46d8d12c74
@ -249,6 +249,14 @@ bool ResultSet::GetBoolean(Uint32 idx) const
|
|||||||
return ConvTo< bool >::From(std::strtol(m_Handle->mRow[idx], nullptr, 10));
|
return ConvTo< bool >::From(std::strtol(m_Handle->mRow[idx], nullptr, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
CSStr ResultSet::GetString(Uint32 idx) const
|
||||||
|
{
|
||||||
|
SQMOD_VALIDATE_FIELD(*this, idx);
|
||||||
|
// Retrieve the value directly from the row
|
||||||
|
return m_Handle->mRow[idx];
|
||||||
|
}
|
||||||
|
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
void Register_ResultSet(Table & sqlns)
|
void Register_ResultSet(Table & sqlns)
|
||||||
{
|
{
|
||||||
@ -281,6 +289,7 @@ void Register_ResultSet(Table & sqlns)
|
|||||||
.Func(_SC("GetFloat64"), &ResultSet::GetFloat64)
|
.Func(_SC("GetFloat64"), &ResultSet::GetFloat64)
|
||||||
.Func(_SC("GetBool"), &ResultSet::GetBoolean)
|
.Func(_SC("GetBool"), &ResultSet::GetBoolean)
|
||||||
.Func(_SC("GetBoolean"), &ResultSet::GetBoolean)
|
.Func(_SC("GetBoolean"), &ResultSet::GetBoolean)
|
||||||
|
.Func(_SC("GetString"), &ResultSet::GetString)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +267,11 @@ public:
|
|||||||
* Retrieve a boolean from a field.
|
* Retrieve a boolean from a field.
|
||||||
*/
|
*/
|
||||||
bool GetBoolean(Uint32 idx) const;
|
bool GetBoolean(Uint32 idx) const;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Retrieve a string from a field.
|
||||||
|
*/
|
||||||
|
CSStr GetString(Uint32 idx) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace:: SqMod
|
} // Namespace:: SqMod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user