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 » Sql::Execute()
Sql::Execute() [message #9414] Sun, 06 May 2007 10:55 Go to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

I think it would be better if Sql::Execute called ClearError before executing the sql statement. Now if I use global SQL object I have to do sth like this everywhere to be sure WasError will return the correct value. It's unecessary IMO:

void Commissions::InsertCommission()
{
	SQL.ClearError(); //execute should clear the error
	
	SQL * ::Insert(PROWIZJE)
		(KOD, list(KOD))
		(PROCENT, list(PROCENT))
		(KWOTA, list(KWOTA));
		
	if(SQL.WasError())
		list.CancelInsert();
	else
		list(ID) = GetInsertedId(SQL.GetSession(), PROWIZJE_ID_SEQ);
}

Re: Sql::Execute() [message #9451 is a reply to message #9414] Tue, 08 May 2007 19:14 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I agree that current solution is not perfect.

However, quite often I left the whole transaction to proceed and then call OkCommit (or several times ErrorRollback during the transaction).

Better solution coming.
Previous Topic: Simple U++ Sql Tutorial
Next Topic: Please help the SQL-challenged
Goto Forum:
  


Current Time: Wed Apr 24 13:19:18 CEST 2024

Total time taken to generate the page: 0.03203 seconds