mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Add Exec[Async] shotrcuts to session.
This commit is contained in:
parent
8607c65872
commit
09a1767ffe
@ -111,6 +111,32 @@ SqDataStatement SqDataSession::GetStatement(StackStrF & data)
|
||||
return SqDataStatement(*this, data);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SqDataSession & SqDataSession::Execute(StackStrF & query)
|
||||
{
|
||||
// Create a statement instance
|
||||
Statement stmt(impl()->createStatementImpl());
|
||||
// Add the query to the
|
||||
stmt << (query);
|
||||
// Execute it
|
||||
stmt.execute();
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SqDataSession & SqDataSession::ExecuteAsync(StackStrF & query)
|
||||
{
|
||||
// Create a statement instance
|
||||
Statement stmt(impl()->createStatementImpl());
|
||||
// Add the query to the
|
||||
stmt << (query);
|
||||
// Execute it
|
||||
stmt.executeAsync();
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SqDataStatement::UseEx(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir)
|
||||
{
|
||||
@ -426,6 +452,8 @@ void Register_POCO_Data(HSQUIRRELVM vm, Table &)
|
||||
.FmtFunc(_SC("GetFeature"), &SqDataSession::GetFeature)
|
||||
.FmtFunc(_SC("SetProperty"), &SqDataSession::SetProperty)
|
||||
.FmtFunc(_SC("GetProperty"), &SqDataSession::GetProperty)
|
||||
.FmtFunc(_SC("Execute"), &SqDataSession::Execute)
|
||||
.FmtFunc(_SC("ExecuteAsync"), &SqDataSession::ExecuteAsync)
|
||||
// Static Functions
|
||||
.StaticFunc(_SC("GetURI"), &SqDataSession::BuildURI)
|
||||
// Static Values
|
||||
|
@ -788,6 +788,16 @@ struct SqDataSession : public Session
|
||||
* Look up the value of a property.
|
||||
*/
|
||||
SQMOD_NODISCARD SqDataStatement GetStatement(StackStrF & data);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Create a statement and execute the given query immediately.
|
||||
*/
|
||||
SqDataSession & Execute(StackStrF & query);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Create a statement and execute the given query whenever possible.
|
||||
*/
|
||||
SqDataSession & ExecuteAsync(StackStrF & query);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user