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 » SQLITE Insert or Replace
SQLITE Insert or Replace [message #47900] Thu, 20 April 2017 14:44 Go to next message
rxantos is currently offline  rxantos
Messages: 68
Registered: October 2011
Member
Is it possible to do an "INSERT OR REPLACE INTO" query using U++?





Re: SQLITE Insert or Replace [message #47909 is a reply to message #47900] Sat, 22 April 2017 15:27 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1735
Registered: August 2008
Location: Czech Republic
Senior Veteran

Hi rxantos,

rxantos wrote on Thu, 20 April 2017 14:44
Is it possible to do an "INSERT OR REPLACE INTO" query using U++?


That is sqlite syntax, right? Quick and dirty solution is to add the "or replace" part into the query:
SqlStatement OrReplace(const SqlInsert& insert) {
	String s = SqlStatement(insert).Get(SQLITE3);
	ASSERT(s.StartsWith("insert "));
	s = "insert or replace " + s.Mid(7);
	return SqlStatement(s);
}

The same could be of course done for any other dialect as well, as long as you respect the supported SQL syntax.

Best regards,
Honza
Previous Topic: OleDB fails to build
Next Topic: Please Help Me
Goto Forum:
  


Current Time: Tue May 23 14:39:53 CEST 2017

Total time taken to generate the page: 0.00694 seconds