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

Allow RecordSet to be constructed from statements.

This commit is contained in:
Sandu Liviu Catalin 2021-03-04 22:00:19 +02:00
parent 20cb308c3f
commit c4c88fd97c
2 changed files with 12 additions and 3 deletions

View File

@ -581,6 +581,7 @@ void Register_POCO_Data(HSQUIRRELVM vm, Table &)
ns.Bind(_SC("RecordSet"),
Class< SqDataRecordSet >(vm, SqPcDataRecordSet::Str)
// Constructors
.Ctor< SqDataStatement & >()
.Ctor< SqDataSession &, StackStrF & >()
// Meta-methods
.SquirrelFunc(_SC("_typename"), &SqPcDataRecordSet::Fn)

View File

@ -1230,7 +1230,7 @@ struct SqDataStatement : public Statement
void UseInst_(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir);
/* --------------------------------------------------------------------------------------------
* Bind a value to the statement and mark it as input (i.e alias of Use).
* Bind a reference to the statement and mark it as input (i.e alias of Use).
*/
SqDataStatement & In(LightObj & obj)
{
@ -1238,7 +1238,7 @@ struct SqDataStatement : public Statement
}
/* --------------------------------------------------------------------------------------------
* Bind a named value to the statement mark it as input (i.e alias of UseAs).
* Bind a named reference to the statement mark it as input (i.e alias of UseAs).
*/
SqDataStatement & InAs(LightObj & obj, StackStrF & name)
{
@ -1292,7 +1292,7 @@ struct SqDataStatement : public Statement
void BindInst_(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir);
/* --------------------------------------------------------------------------------------------
* Bind a value to the statement and mark it as input/output.
* Bind a value/reference to the statement and mark it as input/output.
*/
SqDataStatement & Io(LightObj & obj)
{
@ -1373,6 +1373,14 @@ template < class T > inline SqDataBinding< T > & SqDataBinding< T >::BindAs(SqDa
*/
struct SqDataRecordSet : public RecordSet
{
/* --------------------------------------------------------------------------------------------
* Creates the RecordSet for the given statement.
*/
SqDataRecordSet(SqDataStatement & stmt)
: RecordSet(stmt)
{
}
/* --------------------------------------------------------------------------------------------
* Creates the RecordSet for the given query.
*/