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 » An improvement to SqlArray::PerformInsert
An improvement to SqlArray::PerformInsert [message #8583] Tue, 20 March 2007 04:17
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I think it would be useful to replace
	for(int i = 0; i < GetIndexCount(); i++)
		if(!GetId(i).IsNull())
			insert(GetId(i), Get(i));
	if(!fk.IsNull())
		insert(fk, fkv);

with
	bool fk_added = false;
	
	for(int i = 0; i < GetIndexCount(); i++)
		if(!GetId(i).IsNull()) {
			if (!fk.IsNull() && GetId(i) == fk) {
				Set(i, fkv);
				fk_added = true;
			}
			insert(GetId(i), Get(i));
		}
	if(!fk.IsNull() && !fk_added)
		insert(fk, fkv);

in SqlArray::PerformInsert.

That will let add a foreign key index to an array explicitly. An explicit foreign key index might be needed to build a multi-index one-to-many relationship between two arrays.

Thanks.


Regards,
Novo

[Updated on: Tue, 20 March 2007 04:18]

Report message to a moderator

Previous Topic: Sqlite3 Blob sample code required
Next Topic: Is this correct?
Goto Forum:
  


Current Time: Mon Apr 29 09:38:37 CEST 2024

Total time taken to generate the page: 0.02835 seconds