Home » U++ Library support » U++ SQL » SQLITE Insert or Replace
|
Re: SQLITE Insert or Replace [message #47909 is a reply to message #47900] |
Sat, 22 April 2017 15:27  |
|
Hi rxantos,
rxantos wrote on Thu, 20 April 2017 14:44Is 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
|
|
|
Goto Forum:
Current Time: Mon May 12 03:43:02 CEST 2025
Total time taken to generate the page: 0.00473 seconds
|