Home » U++ Library support » U++ SQL » SqlExp and LIMIT
SqlExp and LIMIT [message #2933] |
Sun, 30 April 2006 22:58 |
mezise
Messages: 54 Registered: April 2006
|
Member |
|
|
Code from reference/SQL_Sqlite3/simple.cpp:
// Test selection:
sql*Select(row).From(SIMPLE_TEST1);
How to apply "LIMIT 15" clause?
There is not something like this:
// Test selection:
sql*Select(row).From(SIMPLE_TEST1).Limit(15);
Michal
|
|
|
|
|
Re: SqlExp and LIMIT [message #2943 is a reply to message #2941] |
Mon, 01 May 2006 09:58 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
mezise wrote on Sun, 30 April 2006 21:06 |
luzr wrote on Sun, 30 April 2006 17:01 | Not yet. To put it straight, so far SqlExp was designed for Oracle and will need further tweaks for other SQL engines.
Mirek
|
OFFSET-LIMIT clause is quite necessary in MySQL, SQLite and PostgreSQL.
So, could this code be put into next dev5 release?
|
Definitely! Done. Thank you, that is the kind of response I like
BTW, speaking about it, you should be aware of Sql refactoring plan....
The problem there now is with dialects AND using multiple engines at once (like Oracle and MySql in single app).
There are two problems - SQL dialects differ AND of course, "implicit session" are now two...
Well, several month ago plan was to bind the dialect with "execution" Sql - that would involve storing SqlExp into some intermediate language form and then "compiling" it for target engine. Also, implicit session and default SQL cursor (which in fact are related) would be gone in multisession apps.
However, further thinking revealed that it would still be difficult to use - you would have to quote session when makeing any Sql cursor. So the current plan, somewhat less elegant but I believe more productive, is simply to have per-thread "current session" variable and change it using RAII push/pops, something like
void MyFn() {
UseSqlSession __(MySqlSession);
// now until __ destructor, MySqlSession and MySQL dialect are used for everything, SQL reffers to MySqlSession
}
maybe, using macro hackery, we could also introduce form
void MyFn() {
SQLCONTEXT(MySqlSession) {
.....
}
}
That also means that those "dialect" members of SqlS are likely to be gone in favor of single per-thread global variable.
Mirek
|
|
|
Goto Forum:
Current Time: Sun Apr 28 23:53:25 CEST 2024
Total time taken to generate the page: 0.02868 seconds
|