Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » SqlArray Limit and Offset
SqlArray Limit and Offset [message #4466] Fri, 11 August 2006 01:03 Go to previous message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
I have implemented it. I don't know if this is a good interface or not, but I hope so.

SqlArray declaration private section (SqlCtrl.h):
	unsigned int limit;
	bool        limit_set;
	int64       offset;
	bool        offset_set;


SqlArray declaration public section:
	SqlArray& SetLimit(unsigned int _limit)                { limit = _limit; limit_set = true; return *this; }
	SqlArray& SetOffset(int64 _offset)                     { offset = _offset; offset_set = true; return *this; }


In SqlArray::SqlArray() and SqlArray::Clear()
	limit_set = false;
	offset_set = false;


In void SqlArray::AppendQuery(SqlBool where)
I have changed
		sql * ::Select(cols).From(table).Where(wh).OrderBy(orderby);

to
		SqlSet set = ::Select(cols).From(table).Where(wh).OrderBy(orderby);
		if(limit_set)
			if(offset_set) set.Limit(offset, limit);
			else set.Limit(limit);
		else
			if(offset_set) set.Offset(offset);
		sql * set;
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SqlArray::SetDistinct()
Next Topic: ODBC ?
Goto Forum:
  


Current Time: Tue May 14 14:43:06 CEST 2024

Total time taken to generate the page: 0.01893 seconds