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 » Doubts on a sqlite query
Re: Doubts on a sqlite query [message #38618 is a reply to message #38617] Sat, 29 December 2012 21:27 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
Good news. This works as expected (I got the hint here )

	String teams = "update TEAMS set N = case ";
	for(i=0; i<n; i++) {
		teams += Format(" when ID=%i then %i", ids[i], i+1 );
		{TIMING("player-select"); sqlplayer.Execute("SELECT ID FROM PLAYERS WHERE TEAM_ID=? ORDER BY BOARD ASC", arr_N[i]); }
		String players = "update PLAYERS set N = case ";
		while (sqlplayer.Fetch()) {
			idp = (int) (sqlplayer[0]);
			players += Format(" when ID=%i then %i", idp, np++);
		}
		players += " else N end ";
		{TIMING("players-update"); sqlp.Execute(players); }
	}
	teams += " else N end ";
	{TIMING("teams");sqlteam.Execute(teams);}


with timing

TIMING teams : 56.00 ms - 56.00 ms (56.00 ms / 1 ), min: 56.00 ms, max: 56.00 ms, nesting: 1 - 1
TIMING players-update : 21.90 s - 139.46 ms (21.90 s / 157 ), min: 46.00 ms, max: 646.00 ms, nesting: 1 - 157
TIMING player-select : 177.97 ms - 1.13 ms (178.00 ms / 157 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 157

Much better but still too high. Anyway I saw the things can improve rearranging the query. I'll think about it.

Thanks again,
Luigi
 
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: Use ctrls in another tab as detail problem
Next Topic: Can U++ communicate with a MSACCESS database?
Goto Forum:
  


Current Time: Sat Jul 19 11:27:40 CEST 2025

Total time taken to generate the page: 0.04516 seconds