mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-02 06:06:59 -06:00
SqlExp: Decode nonOracle variants improved
git-svn-id: svn://ultimatepp.org/upp/trunk@7878 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7bdd4527c7
commit
12853cdcef
1 changed files with 7 additions and 3 deletions
|
|
@ -248,11 +248,15 @@ SqlBool SqlBoolFunc(const char *n, const SqlBool& a, const SqlBool& b, const Sql
|
|||
SqlVal Decode(const SqlVal& exp, const SqlSet& variants) {
|
||||
ASSERT(!variants.IsEmpty());
|
||||
Vector<SqlVal> v = variants.Split();
|
||||
ASSERT(v.GetCount() > 2);
|
||||
ASSERT(v.GetCount() > 1);
|
||||
Case cs(exp == v[0], v[1]);
|
||||
for(int i = 2; i + 1 < v.GetCount(); i += 2)
|
||||
int i;
|
||||
for(i = 2; i + 1 < v.GetCount(); i += 2)
|
||||
cs(exp == v[i], v[i + 1]);
|
||||
cs(v.Top());
|
||||
if(i < v.GetCount())
|
||||
cs(v[i]);
|
||||
else
|
||||
cs(Null);
|
||||
return SqlVal(SqlCase(ORACLE, "decode(" + ~exp + ", " + ~variants + ')')('(' + ~cs + ')'),
|
||||
SqlS::FN);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue