mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 22:02:58 -06:00
.Sql: Fixing Joins/SqlId/SqlCol
git-svn-id: svn://ultimatepp.org/upp/trunk@4266 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ed6bc57370
commit
044cd307c6
3 changed files with 27 additions and 3 deletions
|
|
@ -58,7 +58,7 @@ SqlBool FindSchJoin(const String& tables)
|
|||
INTERLOCKED {
|
||||
static VectorMap<String, SqlBool> cache;
|
||||
if(cache.GetCount() > 20000)
|
||||
cache.Clear();
|
||||
cache.Clear(); // Just to defend against unlikely dynamically created SqlSelect Join permutations
|
||||
int q = cache.Find(tables);
|
||||
if(q >= 0)
|
||||
return cache[q];
|
||||
|
|
@ -73,9 +73,9 @@ SqlBool FindSchJoin(const String& tables)
|
|||
}
|
||||
}
|
||||
}
|
||||
NEVER();
|
||||
return SqlBool::False();
|
||||
}
|
||||
NEVER_("Schema join not found");
|
||||
return SqlBool::False();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
@ -152,6 +152,15 @@ SqlSelect& SqlSelect::From(SqlId table) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
SqlSelect& SqlSelect::From(SqlCol table)
|
||||
{
|
||||
String t1 = ~table;
|
||||
text = "select " + text + " from " + t1;
|
||||
tables << ',' << t1;
|
||||
on = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SqlSelect& SqlSelect::From(SqlId table1, SqlId table2) {
|
||||
String t1 = ~table1;
|
||||
String t2 = ~table2;
|
||||
|
|
@ -161,6 +170,15 @@ SqlSelect& SqlSelect::From(SqlId table1, SqlId table2) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
SqlSelect& SqlSelect::From(SqlCol table1, SqlCol table2) {
|
||||
String t1 = ~table1;
|
||||
String t2 = ~table2;
|
||||
text = "select " + text + " from " + t1 + ", " + t2;
|
||||
tables << ',' << t1 << ',' << t2;
|
||||
on = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SqlSelect& SqlSelect::From(SqlId table1, SqlId table2, SqlId table3) {
|
||||
String t1 = ~table1;
|
||||
String t2 = ~table2;
|
||||
|
|
|
|||
|
|
@ -503,7 +503,9 @@ public:
|
|||
SqlSelect& Get();
|
||||
SqlSelect& From(const SqlSet& set);
|
||||
SqlSelect& From(SqlId table);
|
||||
SqlSelect& From(SqlCol table);
|
||||
SqlSelect& From(SqlId table1, SqlId table2);
|
||||
SqlSelect& From(SqlCol table1, SqlCol table2);
|
||||
SqlSelect& From(SqlId table1, SqlId table2, SqlId table3);
|
||||
SqlSelect& From(const SqlVal& a) { return From(SqlSet(a)); }
|
||||
|
||||
|
|
@ -511,6 +513,10 @@ public:
|
|||
SqlSelect& LeftJoin(SqlId table) { return LeftJoin0(~table); }
|
||||
SqlSelect& RightJoin(SqlId table) { return RightJoin0(~table); }
|
||||
SqlSelect& FullJoin(SqlId table) { return FullJoin0(~table); }
|
||||
SqlSelect& InnerJoin(SqlCol table) { return InnerJoin0(~table); }
|
||||
SqlSelect& LeftJoin(SqlCol table) { return LeftJoin0(~table); }
|
||||
SqlSelect& RightJoin(SqlCol table) { return RightJoin0(~table); }
|
||||
SqlSelect& FullJoin(SqlCol table) { return FullJoin0(~table); }
|
||||
|
||||
SqlSelect& InnerJoin(const SqlSet& set) { return InnerJoin0(~set(SqlSet::SET)); }
|
||||
SqlSelect& LeftJoin(const SqlSet& set) { return LeftJoin0(~set(SqlSet::SET)); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue