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 » SqlCtrls and IsModified()
Re: SqlCtrls and IsModified() [message #26988 is a reply to message #26978] Thu, 17 June 2010 09:38 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14265
Registered: November 2005
Ultimate Member
kropniczki wrote on Wed, 16 June 2010 08:14

Ok. It didnīt work for me in the beggining, but now I see why:
after some more code diving Iīve seen you gotta call SqlCtrls::ClearModify() right after you SqlCtrls::Load(...) your Ctrl set, or it ainīt gonna work. I must have somewhat assumed that fresh SqlCtrls::Load calls would somehow automatically reset some modification flag internally to the SqlCtrls object. But then again I see this SqlCtrls::ClearModify() method and got a wakeup call, which makes me feellike 'why-havenīt-you-seen-it-before?'.
Anyway, this might come up as somebody else's doubt too, so I thought I should post it.
Sorry for taking up your time...

Many thanks!


Actually, it somewhat comes to my surprise you bother to test it at all.

Usually, I am using SqlCtrls for dialog that edits some database row. Then it is simply, if user presses OK I do update...

BTW, my usual set of methods looks something like this:

PriceEntryDlg::PriceEntryDlg()
{
	CtrlLayoutOKCancel(*this, "Entry");
	ctrls
		(IMPRESSIONS, impressions)
		(REGION, region)
		(DURATION, duration)
		(PRICE, price)
	;
}

void ProductSchemaDlg::NewPe()
{
	if(!product.IsCursor())
		return;
	PriceEntryDlg dlg;
	if(dlg.Execute() == IDOK) {
		SQL * dlg.ctrls.Insert(PRICE)(PRODUCT_ID, product.GetKey());
		int id = SQL.GetInsertedId();
		price.ReQuery();
		price.FindSetCursor(id);
	}		
}

void ProductSchemaDlg::EditPe()
{
	int id = price.GetKey();
	if(IsNull(id))
		return;
	PriceEntryDlg dlg;
	dlg.ctrls.Load(PRICE, ID == id);
	if(dlg.Execute() == IDOK) {
		SQL * dlg.ctrls.Update(PRICE).Where(ID == id);
		price.ReQuery();
	}
}


where product is master SqlArray and price is the SqlArray of those edited rows.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multiple schema files?
Next Topic: MySQL bug: Missing FIELD_TYPE_TIMESTAMP
Goto Forum:
  


Current Time: Sun Jul 13 17:33:24 CEST 2025

Total time taken to generate the page: 0.04304 seconds