mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Complete Poco Data support.
Most of the necessary things are exported. More complex functionality is not exposed because is not necessary for the scope of this project.
This commit is contained in:
parent
e043e28529
commit
2f67eae859
@ -448,6 +448,16 @@ void Register_POCO_Data(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Initialized"), &SqDataStatement::Initialized)
|
||||
.Prop(_SC("Paused"), &SqDataStatement::Paused)
|
||||
.Prop(_SC("Done"), &SqDataStatement::Done)
|
||||
.Prop(_SC("StorageID"), &SqDataStatement::Storage)
|
||||
.Prop(_SC("Storage"), &SqDataStatement::GetStorage, &SqDataStatement::SetStorage)
|
||||
.Prop(_SC("CanModifyStorage"), &SqDataStatement::CanModifyStorage)
|
||||
.Prop(_SC("ColumnsExtracted"), &SqDataStatement::ColumnsExtracted)
|
||||
.Prop(_SC("RowsExtracted"), &SqDataStatement::RowsExtracted)
|
||||
.Prop(_SC("TotalRowCount"), &SqDataStatement::SubTotalRowCount)
|
||||
.Prop(_SC("ExtractionCount"), &SqDataStatement::ExtractionCount)
|
||||
.Prop(_SC("DataSetCount"), &SqDataStatement::DataSetCount)
|
||||
.Prop(_SC("NextDataSet"), &SqDataStatement::NextDataSet)
|
||||
.Prop(_SC("PreviousDataSet"), &SqDataStatement::PreviousDataSet)
|
||||
.Prop(_SC("HasMoreDataSets"), &SqDataStatement::HasMoreDataSets)
|
||||
// Member Methods
|
||||
.Func(_SC("Add"), &SqDataStatement::Add)
|
||||
@ -462,6 +472,9 @@ void Register_POCO_Data(HSQUIRRELVM vm)
|
||||
.Func(_SC("Bind"), &SqDataStatement::Bind)
|
||||
.Func(_SC("BindAs"), &SqDataStatement::BindAs)
|
||||
.Func(_SC("Io"), &SqDataStatement::Io)
|
||||
.Func(_SC("GetColumnsExtracted"), &SqDataStatement::GetColumnsExtracted)
|
||||
.Func(_SC("GetRowsExtracted"), &SqDataStatement::GetRowsExtracted)
|
||||
.Func(_SC("GetSubTotalRowCount"), &SqDataStatement::GetSubTotalRowCount)
|
||||
// Overloaded Member Methods
|
||||
.Overload(_SC("Execute"), &SqDataStatement::Execute)
|
||||
.Overload(_SC("Execute"), &SqDataStatement::Execute_)
|
||||
@ -469,6 +482,18 @@ void Register_POCO_Data(HSQUIRRELVM vm)
|
||||
.Overload(_SC("ExecuteAsync"), &SqDataStatement::ExecuteAsync_)
|
||||
.Overload(_SC("Into"), &SqDataStatement::Into)
|
||||
.Overload(_SC("Into"), &SqDataStatement::Into_)
|
||||
.Overload(_SC("Limit"), &SqDataStatement::Limit1)
|
||||
.Overload(_SC("Limit"), &SqDataStatement::Limit2)
|
||||
.Overload(_SC("Limit"), &SqDataStatement::Limit3)
|
||||
.Overload(_SC("Range"), &SqDataStatement::Range)
|
||||
.Overload(_SC("Range"), &SqDataStatement::RangeEx)
|
||||
// Static Values
|
||||
.SetStaticValue(_SC("WaitForever"), static_cast< SQInteger >(SqDataStatement::WAIT_FOREVER))
|
||||
.SetStaticValue(_SC("UseCurrentDataSet"), static_cast< SQInteger >(Poco::Data::StatementImpl::USE_CURRENT_DATA_SET))
|
||||
.SetStaticValue(_SC("StorageDeque"), static_cast< SQInteger >(SqDataStatement::STORAGE_DEQUE))
|
||||
.SetStaticValue(_SC("StorageVector"), static_cast< SQInteger >(SqDataStatement::STORAGE_VECTOR))
|
||||
.SetStaticValue(_SC("StorageList"), static_cast< SQInteger >(SqDataStatement::STORAGE_LIST))
|
||||
.SetStaticValue(_SC("StorageUnknown"), static_cast< SQInteger >(SqDataStatement::STORAGE_UNKNOWN))
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_POCO_Data_Binding< SQInteger, SqIntegerBinding >(vm, ns, _SC("IntBind"));
|
||||
|
@ -855,6 +855,16 @@ struct SqDataStatement : public Statement
|
||||
return isAsync();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the asynchronous flag. This setting does not affect the statement's capability
|
||||
* to be executed synchronously by directly calling Execute().
|
||||
*/
|
||||
SqDataStatement & SetAsync(bool async)
|
||||
{
|
||||
setAsync(async);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the statement was initialized (i.e. not executed yet).
|
||||
*/
|
||||
@ -881,13 +891,114 @@ struct SqDataStatement : public Statement
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the asynchronous flag. This setting does not affect the statement's capability
|
||||
* to be executed synchronously by directly calling Execute().
|
||||
* Returns true if statement is in a state that allows the internal storage to be modified.
|
||||
*/
|
||||
SqDataStatement & SetAsync(bool async)
|
||||
bool CanModifyStorage()
|
||||
{
|
||||
setAsync(async);
|
||||
return *this;
|
||||
return canModifyStorage();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the internal storage type for the statement.
|
||||
*/
|
||||
SQInteger Storage() const
|
||||
{
|
||||
return static_cast< SQInteger >(storage());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the internal storage type for the statement.
|
||||
*/
|
||||
const std::string & GetStorage() const
|
||||
{
|
||||
return getStorage();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the internal storage type for the statement.
|
||||
*/
|
||||
void SetStorage(StackStrF & storage)
|
||||
{
|
||||
setStorage(storage.ToStr());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the number of columns returned for current data set.
|
||||
* Default value indicates current data set (if any).
|
||||
*/
|
||||
SQInteger GetColumnsExtracted(int data_set) const
|
||||
{
|
||||
return static_cast< SQInteger >(columnsExtracted(data_set));
|
||||
}
|
||||
SQInteger ColumnsExtracted() const
|
||||
{
|
||||
return static_cast< SQInteger >(columnsExtracted());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the number of rows returned for current data set during last statement execution.
|
||||
* Default value indicates current data set (if any).
|
||||
*/
|
||||
SQInteger GetRowsExtracted(int data_set) const
|
||||
{
|
||||
return static_cast< SQInteger >(rowsExtracted(data_set));
|
||||
}
|
||||
SQInteger RowsExtracted() const
|
||||
{
|
||||
return static_cast< SQInteger >(rowsExtracted());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the number of rows extracted so far for the data set.
|
||||
* Default value indicates current data set (if any).
|
||||
*/
|
||||
SQInteger GetSubTotalRowCount(int data_set) const
|
||||
{
|
||||
return static_cast< SQInteger >(subTotalRowCount(data_set));
|
||||
}
|
||||
SQInteger SubTotalRowCount() const
|
||||
{
|
||||
return static_cast< SQInteger >(subTotalRowCount());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the number of extraction storage buffers associated with the current data set.
|
||||
*/
|
||||
SQInteger ExtractionCount() const
|
||||
{
|
||||
return static_cast< SQInteger >(extractionCount());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the number of data sets associated with the statement.
|
||||
*/
|
||||
SQInteger DataSetCount() const
|
||||
{
|
||||
return static_cast< SQInteger >(dataSetCount());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the index of the next data set.
|
||||
*/
|
||||
SQInteger NextDataSet()
|
||||
{
|
||||
return static_cast< SQInteger >(nextDataSet());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the index of the previous data set.
|
||||
*/
|
||||
SQInteger PreviousDataSet()
|
||||
{
|
||||
return static_cast< SQInteger >(previousDataSet());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns false if the current data set index points to the last data set. Otherwise, it returns true.
|
||||
*/
|
||||
bool HasMoreDataSets() const
|
||||
{
|
||||
return hasMoreDataSets();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -941,6 +1052,14 @@ struct SqDataStatement : public Statement
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Swaps the statement with another one.
|
||||
*/
|
||||
void Swap(SqDataStatement & stmt)
|
||||
{
|
||||
swap(stmt);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Bind a reference to the statement.
|
||||
*/
|
||||
@ -1058,11 +1177,25 @@ struct SqDataStatement : public Statement
|
||||
SqDataStatement & Into_(LightObj & obj, LightObj & def);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns false if the current data set index points to the last data set. Otherwise, it returns true.
|
||||
* Sets a limit on the maximum number of rows a select is allowed to return.
|
||||
*/
|
||||
bool HasMoreDataSets() const
|
||||
SqDataStatement & Limit1(SQInteger limit) { return Limit3(limit, false, false); }
|
||||
SqDataStatement & Limit2(SQInteger limit, bool hard) { return Limit3(limit, hard, false); }
|
||||
SqDataStatement & Limit3(SQInteger limit, bool hard, bool lower)
|
||||
{
|
||||
return hasMoreDataSets();
|
||||
(*this), Poco::Data::Limit(static_cast< Poco::Data::Limit::SizeT >(limit), hard, lower);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets a an extraction range for the maximum number of rows a select is allowed to return.
|
||||
*/
|
||||
SqDataStatement & Range(SQInteger lower, SQInteger upper) { return RangeEx(lower, upper, false); }
|
||||
SqDataStatement & RangeEx(SQInteger lower, SQInteger upper, bool hard)
|
||||
{
|
||||
(*this), Poco::Data::Range(static_cast< Poco::Data::Limit::SizeT >(lower),
|
||||
static_cast< Poco::Data::Limit::SizeT >(upper), hard);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user