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 » OrderBy Descending missing
Re: OrderBy Descending missing [with fix] [message #21049 is a reply to message #21048] Tue, 28 April 2009 19:35 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
phirox wrote on Tue, 28 April 2009 13:25

I found this previous topic about the same thing. But it says there is a descending() function, I could find no such thing. So I just added the suggested OrderByDesc() function.

In Sqlexp.h:
SqlSelect& OrderByDesc(const SqlSet& columnset);
SqlSelect& OrderByDesc(SqlVal a)                      { return OrderByDesc(SqlSet(a)); }
SqlSelect& OrderByDesc(SqlVal a, SqlVal b)            { return OrderByDesc(SqlSet(a, b)); }
SqlSelect& OrderByDesc(SqlVal a, SqlVal b, SqlVal c)  { return OrderByDesc(SqlSet(a, b, c)); }


And in SqlStatement.cpp
SqlSelect& SqlSelect::OrderByDesc(const SqlSet& set) {
	if(!set.IsEmpty())
		text << " order by " << ~set << " desc";
	return *this;
}




Well, this is taken from the code I am working on now:

	sql * Select(ROK, CISLO).From(STIZNOST).OrderBy(Descending(ROK), CISLO);


As argument of OrderBy is set, function is must...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: sql example with 2 table needed
Next Topic: sqlite3 get number of occurrences
Goto Forum:
  


Current Time: Fri May 10 22:02:28 CEST 2024

Total time taken to generate the page: 0.02790 seconds